private void drawDialog(Graphics g) { Painter.drawDialog( g, 0, gd.screenHeight - g.getFont().getHeight() * 3 - 20, gd.screenWidth, g.getFont().getHeight() * 3 + 20, Painter.DIALOG_DEEP); g.setFont(Const.Font.FONTSMALL_PLAIN); // 对话人 Painter.drawString( g, gd.dialog_name + ":", 10, gd.screenHeight - g.getFont().getHeight() * 3 - 10, 0xffffff); // 两行对话内容 Painter.drawString( g, gd.dialog_content[gd.dialog_index], 10, gd.screenHeight - g.getFont().getHeight() * 2 - 10, 0xffffff); if (gd.dialog_index + 1 < gd.dialog_content.length) { Painter.drawString( g, gd.dialog_content[gd.dialog_index + 1], 10, gd.screenHeight - g.getFont().getHeight() - 10, 0xffffff); } }
private void paint_Confirm(Graphics g) { int h = 50; Painter.drawDialog(g, 0, gd.screenHeight - h, gd.screenWidth, h, Painter.DIALOG_DEEP); g.setColor(Color.black); if (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) { if (gd.bag_tabIndex == 0) { g.drawString( "是否要使用物品\"" + (gd.gameObjectManager.getItem(gd.player.bag.getList(Bag.ITEM)[gd.bag_curIndex]) .name) + "\"", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } else { g.drawString( "是否要将装备\"" + (gd.gameObjectManager.getEquip(gd.player.bag.getList(Bag.EQUIP)[gd.bag_curIndex]) .name) + "\"穿上", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } } }
private void init(String exp) { // 将表达式的各元素存入向量中 expVector.removeAllElements(); String[] temp = Painter.split(exp, " "); for (int i = 0; i < temp.length; i++) { expVector.addElement(temp[i]); } }
/** 绘图 */ public void paint(Graphics g) { Painter.fillRect(g, 0, 0, gd.screenWidth, gd.screenHeight, 0x000000); drawMap(g); drawPlayer(g); switch (gd.pageIndex) { case PAGE_MAP: break; case PAGE_MENU: drawMenu(g); break; case PAGE_DIALOG: drawDialog(g); break; case PAGE_WAIT: Painter.drawString( g, "等待" + (gd.waitTime - gd.waitIndex) + "秒", 5, gd.screenHeight - g.getFont().getHeight(), 0xffffff); break; } }
private void paint_Tip(Graphics g) { int h = 50; Painter.drawDialog(g, 0, gd.screenHeight - h, gd.screenWidth, h, Painter.DIALOG_DEEP); g.setColor(Color.black); if (gd.bag_tabIndex == 0) { g.drawString( "使用成功", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } else { g.drawString( "装备成功", gd.screenWidth / 2, gd.screenHeight - h + (h - g.getFont().getHeight()) / 2, Graphics.TOP | Graphics.HCENTER); } }
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); }
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); }