📄 wall.java
字号:
/** * Title: 吃豆子<p> * Description: 小游戏<p> * Copyright: Copyright (c) Nothing<p> * Company: Raindrop<p> * @author Nothing * @version 1.0 */package eatbean;import java.awt.*;import java.util.*;//import eatbean.util.ImageTool;public class Wall extends MapElement { public static final int BASE_NUM = 100; public static final int STYLE_B_2 = BASE_NUM + 1; public static final int STYLE_H_2 = BASE_NUM + 2; public static final int STYLE_H_B_3 = BASE_NUM + 3; public static final int STYLE_H_T_3 = BASE_NUM + 4; public static final int STYLE_L_2 = BASE_NUM + 5; public static final int STYLE_L_B_2 = BASE_NUM + 6; public static final int STYLE_L_T_2 = BASE_NUM + 7; public static final int STYLE_R_2 = BASE_NUM + 8; public static final int STYLE_R_B_2 = BASE_NUM + 9; public static final int STYLE_R_T_2 = BASE_NUM + 10; public static final int STYLE_T_2 = BASE_NUM + 11; public static final int STYLE_V_2 = BASE_NUM + 12; public static final int STYLE_V_L_3 = BASE_NUM + 13; public static final int STYLE_V_R_3 = BASE_NUM + 14; public static final int STYLE_C_1 = BASE_NUM + 15; private static Hashtable styleTable = new Hashtable(); static { styleTable.put(new Integer(STYLE_B_2), "wb2.gif"); styleTable.put(new Integer(STYLE_H_2), "wh2.gif"); styleTable.put(new Integer(STYLE_H_B_3), "whb3.gif"); styleTable.put(new Integer(STYLE_H_T_3), "wht3.gif"); styleTable.put(new Integer(STYLE_L_2), "wl2.gif"); styleTable.put(new Integer(STYLE_L_B_2), "wlb2.gif"); styleTable.put(new Integer(STYLE_L_T_2), "wlt2.gif"); styleTable.put(new Integer(STYLE_R_2), "wr2.gif"); styleTable.put(new Integer(STYLE_R_B_2), "wrb2.gif"); styleTable.put(new Integer(STYLE_R_T_2), "wrt2.gif"); styleTable.put(new Integer(STYLE_T_2), "wt2.gif"); styleTable.put(new Integer(STYLE_V_2), "wv2.gif"); styleTable.put(new Integer(STYLE_V_L_3), "wvl3.gif"); styleTable.put(new Integer(STYLE_V_R_3), "wvr3.gif"); styleTable.put(new Integer(STYLE_C_1), "c1.gif"); } private Image img = null; private static Hashtable imgBuffTable = new Hashtable(); public Wall(int style, int x, int y) { super(style, x, y); img = getImage(style); } public void parseWidthAndHeight() { width = ELEMENT_MAX_SIZE; height = ELEMENT_MAX_SIZE; } public void draw(OffScreen offScreen) { if(img == null) return; offScreen.drawImage(img, x, y); } private Image getImage(int imgIndex) { Image result = null; synchronized(imgBuffTable) { // 同步,保证同一个Image不被调入内存两次 result = super.getImage(imgBuffTable, styleTable, imgIndex); } return result; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -