Ejemplo n.º 1
0
 private void drawMenu(Graphics g) {
   int w = 160, h = 30, gap = 5;
   Painter.drawTable(
       g,
       (gd.screenWidth - w) / 2,
       (gd.screenHeight - Const.Str.MENU_MAP.length * h - (Const.Str.MENU_MAP.length - 1) * gap)
           / 2,
       w,
       h,
       Const.Str.MENU_MAP.length,
       gap,
       Const.Str.MENU_MAP,
       Const.Color.BLACK,
       0,
       gd.map_menuIndex,
       Const.Anchor.HV,
       Painter.NODIALOG,
       Painter.CELL_LIGHT);
 }
Ejemplo n.º 2
0
  private void paint_Main(Graphics g) {

    int th = 50; // 标题栏高度
    int ih = 80; // 介绍栏高度
    int ch = gd.screenHeight - th - ih; // 中间列表区域高度
    int gap = 10; // 间距
    int cellW = 160, cellH = 30;
    /** 标题 */
    Painter.drawDialog(g, 0, 0, gd.screenWidth, th, Painter.DIALOG_DEEP);
    g.setFont(Const.Font.FONTLARGE_BOLD);
    g.setColor(Const.Color.GREEN);
    g.drawString("背 包", gd.screenWidth / 2, (th - g.getFont().getHeight()) / 2, Const.Anchor.HT);
    /** 列表 */
    // 底框
    Painter.drawDialog(g, 0, th, gd.screenWidth, ch, Painter.DIALOG_DEEP);
    // 选项卡
    Painter.drawTab(g, 0, th, gd.screenWidth, ch, Painter.DIALOG_LIGHT, gd.bag_tabIndex, tabItems);
    // 列表
    gd.bag_showNum = (ch - 5 * gap) / cellH; // 可显示技能数量
    int space = ch - 3 * gap - gd.bag_showNum * cellH; // 总的竖向剩余空间
    space = space / (gd.bag_showNum + 1); // 间距
    g.setColor(Const.Color.BLACK);
    g.setFont(Const.Font.FONTSMALL_PLAIN);
    Painter.drawTable(
        g,
        (gd.screenWidth - cellW) / 2 - gap / 2,
        th + 3 * gap,
        cellW,
        cellH,
        gd.bag_showNum,
        space,
        gd.bag_tabIndex == 0 ? gd.items : gd.equips,
        Const.Color.BLACK,
        gd.bag_topIndex,
        gd.bag_curIndex,
        Const.Anchor.HV,
        Painter.NODIALOG,
        Painter.CELL_DEEP);

    /** 介绍 */
    Painter.drawDialog(g, 0, th + ch, gd.screenWidth, ih, Painter.DIALOG_DEEP);
    if (gd.player.bag.getList(gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP).length > 0
        && gd.player.bag.get(
                gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP,
                gd.player.bag.getList(gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP)[gd.bag_curIndex])
            != null) {
      Painter.drawWordWrapString(
          g,
          gd.player.bag.get(
                  gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP,
                  gd.player
                      .bag
                      .getList(gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP)[gd.bag_curIndex])
              .intro,
          gap / 2,
          th + ch + gap / 2,
          gd.screenWidth - gap,
          ih - gap,
          Const.Color.WHITE);
    }
    /** 滚动条 */
    Painter.drawScrollbar(
        g,
        Painter.SCROLLBAR_VERTICAL,
        (gd.screenWidth - cellW) / 2 + cellW + gap / 2,
        th + 3 * gap + space,
        th + ch - space,
        gd.bag_topIndex,
        gd.bag_showNum,
        gd.player.bag.getList(gd.bag_tabIndex == 0 ? Bag.ITEM : Bag.EQUIP).length);
  }