📄 menus.java
字号:
/*******************************************************************************
**
** Class: Menus (Menus.java)
**
** The "Menus" class encapsulates all the data and functionality associated
** with the game menu system
**
******************************************************************************/
// Menus header.
import javax.microedition.lcdui.Graphics;
//#if Nokia_3220 || Nokia_3220_Unobfuscated || Nokia_3100 || Nokia_3100_Unobfuscated
//#define MENU_DIRTY_RENDER
//#endif
// the Menus class itself.
public class Menus {
/****************************************************************************
** Constants
***************************************************************************/
// SPECIAL IDS
public static final int NUM_SPECIAL_MENUS = 5;
public static final int NUM_SPECIAL_MENU_ITEMS = 5;
// MENU IDS
public static final int MENU_LANGUAGE = 0;
public static final int MENU_SOUND = 1;
public static final int MENU_MAIN = 2;
public static final int MENU_OPTIONS = 3;
public static final int MENU_INGAME = 4;
public static final int MENU_ADVENTURE_CONT = 5;
public static final int MENU_TIMETRIAL_CONT = 6;
public static final int MENU_LOSE = 7;
public static final int MENU_TUTORIALS = 8;
public static final int NUM_MENUS = 9 + NUM_SPECIAL_MENUS;
// MENU ITEM IDS
public static final int MENU_ITEM_LANGUAGE_0 = 0;
public static final int MENU_ITEM_LANGUAGE_1 = 1;
public static final int MENU_ITEM_LANGUAGE_2 = 2;
public static final int MENU_ITEM_LANGUAGE_3 = 3;
public static final int MENU_ITEM_LANGUAGE_4 = 4;
public static final int MENU_ITEM_SOUND_ON = 5;
public static final int MENU_ITEM_SOUND_OFF = 6;
public static final int MENU_ITEM_ADVENTURE_MODE = 7;
public static final int MENU_ITEM_PUZZLE_MODE = 8;
public static final int MENU_ITEM_TIME_MODE = 9;
public static final int MENU_ITEM_SURVIVAL_MODE = 10;
public static final int MENU_ITEM_HIGHSCORES = 11;
public static final int MENU_ITEM_OPTIONS = 12;
public static final int MENU_ITEM_ABOUT = 13;
public static final int MENU_ITEM_INSTRUCTIONS = 14;
public static final int MENU_ITEM_QUIT = 15;
public static final int MENU_ITEM_SOUND_TOGGLE = 16;
public static final int MENU_ITEM_LANGUAGE = 17;
public static final int MENU_ITEM_TUTORIAL_TOGGLE = 18;
public static final int MENU_ITEM_ERASE_DATA = 19;
public static final int MENU_ITEM_GO_BACK = 20;
public static final int MENU_ITEM_RESUME = 21;
public static final int MENU_ITEM_BACK_TO_TITLE = 22;
public static final int MENU_ITEM_RESTART_LEVEL = 23;
public static final int MENU_ITEM_SKIP_LEVEL = 24;
public static final int MENU_ITEM_SKIP_LEVEL_CONFIRM = 25;
public static final int MENU_ITEM_ADVENTURE_CONT = 26;
public static final int MENU_ITEM_ADVENTURE_NEW = 27;
public static final int MENU_ITEM_TIMETRIAL_CONT = 28;
public static final int MENU_ITEM_TIMETRIAL_NEW = 29;
public static final int MENU_ITEM_RESTART_YES = 30;
public static final int MENU_ITEM_RESTART_NO = 31;
public static final int MENU_ITEM_LEVEL_SELECT = 32;
public static final int MENU_ITEM_OK = 33;
public static final int MENU_ITEM_TUTORIALS = 34;
public static final int MENU_ITEM_TUTORIAL_0 = 35;
public static final int MENU_ITEM_TUTORIAL_1 = 36;
public static final int MENU_ITEM_TUTORIAL_2 = 37;
public static final int MENU_ITEM_TUTORIAL_3 = 38;
public static final int MENU_ITEM_TUTORIAL_4 = 39;
public static final int MENU_ITEM_TUTORIAL_5 = 40;
public static final int MENU_ITEM_TUTORIAL_6 = 41;
public static final int MENU_ITEM_TUTORIAL_7 = 42;
public static final int MENU_ITEM_TUTORIAL_8 = 43;
public static final int MENU_ITEM_TUTORIAL_9 = 44;
public static final int MENU_ITEM_TUTORIAL_10 = 45;
public static final int MENU_ITEM_TUTORIAL_11 = 46;
public static final int MENU_ITEM_TUTORIAL_12 = 47;
public static final int MENU_ITEM_TUTORIAL_13 = 48;
public static final int MENU_ITEM_STAT_TOTAL_CHAINS = 49;
public static final int MENU_ITEM_STAT_LONGEST_CHAIN = 50;
public static final int MENU_ITEM_STAT_JEWELS_CAUGHT = 51;
public static final int MENU_ITEM_STAT_LEFTOVER_AMMO = 52;
public static final int MENU_ITEM_STAT_LEFTOVER_MOVES = 53;
public static final int MENU_ITEM_STAT_TIME_LEFT = 54;
public static final int MENU_ITEM_STAT_SPEEDUPS = 55;
public static final int MENU_ITEM_STAT_TOTAL_BONUS = 56;
public static final int MENU_ITEM_STAT_TOTAL_POINTS = 57;
public static final int MENU_ITEM_HIGHSCORE_1 = 58;
public static final int MENU_ITEM_HIGHSCORE_2 = 59;
public static final int MENU_ITEM_HIGHSCORE_3 = 60;
public static final int MENU_ITEM_HIGHSCORE_4 = 61;
public static final int MENU_ITEM_HIGHSCORE_5 = 62;
public static final int MENU_ITEM_HIGHSCORE_6 = 63;
public static final int MENU_ITEM_HIGHSCORE_7 = 64;
public static final int MENU_ITEM_HIGHSCORE_8 = 65;
public static final int MENU_ITEM_LEVEL_0 = 66;
public static final int MENU_ITEM_LEVEL_1 = 67;
public static final int MENU_ITEM_LEVEL_2 = 68;
public static final int MENU_ITEM_LEVEL_3 = 69;
public static final int MENU_ITEM_LEVEL_4 = 70;
public static final int MENU_ITEM_LEVEL_5 = 71;
public static final int MENU_ITEM_LEVEL_6 = 72;
public static final int MENU_ITEM_LEVEL_7 = 73;
public static final int MENU_ITEM_LEVEL_8 = 74;
public static final int MENU_ITEM_LEVEL_9 = 75;
public static final int NUM_MENU_ITEMS = 76 + NUM_SPECIAL_MENU_ITEMS;
public static final int MENU_ITEM_POOL_SIZE = 100; // reflects the total number of menu item insertions
public static final int MENU_TYPE_NORMAL = 0;
public static final int MENU_TYPE_BASE = 1; // this menu becomes the bottom of the stack
public static final int MENU_TYPE_PROMPT = 2; // for confirmation screens
public static final int MENU_TYPE_TEXT_BOX = 3; // a text box
public static final int MENU_TYPE_STATS = 4; // stats screen
public static final int MENU_TYPE_LIST = 5; // a menu that scretches vertically to fit all listed items
public static final int MENU_TYPE_LEVEL_LIST = 6; // a level select list of 10 levels
public static final int MENU_STATE_NORMAL = 1;
public static final int MENU_STATE_INACTIVE = 2; // not selectable
public static final int MENU_ANIM_STATE_NORMAL = 0;
public static final int MENU_ANIM_STATE_INTRO = 1; // intermediate menu intro transition
public static final int MENU_ANIM_STATE_OUTRO = 2; // intermediate menu outro transition
public static final int MENU_ANIM_STATE_START = 3; // first menu opening transition
public static final int MENU_ANIM_STATE_END = 4; // last menu closing transition
public static final int MENU_ITEM_TYPE_NORMAL = 0; // normal navigatable menu items
public static final int MENU_ITEM_TYPE_TOGGLE = 1; // menu items with an on/off toggle
public static final int MENU_ITEM_TYPE_TEXT = 2; // a chunk of text
public static final int MENU_ITEM_TYPE_STAT = 3; // a score screen statistic
public static final int MENU_ITEM_TYPE_LEVEL = 4; // a level from the level select screen
public static final int MENU_ITEM_TYPE_CONFIRM = 5; // an item that causes a confirmation screen
// state flags
public static final int MENU_ITEM_STATE_NORMAL = 0x00;
public static final int MENU_ITEM_STATE_INACTIVE = 0x01; // not selectable
public static final int MENU_ITEM_STATE_TOGGLE_OFF = 0x00; // toggle set to "off"
public static final int MENU_ITEM_STATE_TOGGLE_ON = 0x02; // toggle set to "on"
public static final int MENU_ITEM_STATE_HIGHLIGHT = 0x04; // use highlight font colour
public static final int MENU_ITEM_ANIM_STATE_NORMAL = 0;
public static final int MENU_ITEM_ANIM_STATE_INTRO = 1;
public static final int MENU_ITEM_ANIM_STATE_OUTRO = 2;
// MENU SPECIAL VALUES
public static final int MENU_SPECIAL_TEXT = NUM_MENUS - 1;
public static final int MENU_SPECIAL_CONFIRMATION = NUM_MENUS - 2;
public static final int MENU_SPECIAL_STATS = NUM_MENUS - 3;
public static final int MENU_SPECIAL_HIGHSCORES = NUM_MENUS - 4;
public static final int MENU_SPECIAL_LEVEL_SELECT = NUM_MENUS - 5;
public static final int MENU_ITEM_SPECIAL_BLANK = NUM_MENU_ITEMS - 1;
public static final int MENU_ITEM_SPECIAL_OK = NUM_MENU_ITEMS - 2;
public static final int MENU_ITEM_SPECIAL_BACK = NUM_MENU_ITEMS - 3;
public static final int MENU_ITEM_SPECIAL_TEXT = NUM_MENU_ITEMS - 4;
public static final int MENU_ITEM_SPECIAL_HIGH_SCORE = NUM_MENU_ITEMS - 5;
// MENU TEXT SCREEN TYPES
public static final int TEXT_TYPE_WINDOW = 0;
public static final int TEXT_TYPE_FULLSCREEN = 1;
public static final int TEXT_TYPE_WINSCREEN = 2;
public static final int TEXT_TYPE_END = 3;
public static final int NONE = -1;
public static final int GO_BACK = -2;
public static final int CLOSE = -3;
public static final int ARROW_LABEL = -4;
public static final int MENU_INTRO_TIME = 0;
public static final int MENU_OUTRO_TIME = 0;
//#if DefaultConfiguration || Nokia_6600 || Nokia_6600_Unobfuscated || Razr
public static final int NUM_DISPLAY = 4;
public static final int NUM_STATS = 10;
public static final int NUM_SCORES = 8;
public static final int NUM_LEVELS = 10;
public static final int MENU_WINDOW_MARGIN = 60;
public static final int TUTORIAL_WINDOW_X_MARGIN = 20;
public static final int TUTORIAL_WINDOW_Y_MARGIN = 40;
public static final int MENU_ITEM_Y_SPACE = 10;
public static final int MENU_ITEM_STAT_Y_SPACE = 12;
public static final int MENU_TITLE_MARGIN = 1;
public static final int MENU_BIGGS_FRAMES = 12;
public static final int MENU_BIGGS_X_OFFSET = 45;
public static final int MENU_BIGGS_Y_OFFSET = 50;
//#elif Nokia_3220 || Nokia_3220_Unobfuscated
//# public static final int NUM_DISPLAY = 4;
//# public static final int NUM_STATS = 10;
//# public static final int NUM_SCORES = 8;
//# public static final int NUM_LEVELS = 10;
//# public static final int NUM_TEXT_LINES = 4;
//# public static final int MENU_WINDOW_MARGIN = 44;
//# public static final int TUTORIAL_WINDOW_X_MARGIN = 10;
//# public static final int TUTORIAL_WINDOW_Y_MARGIN = 32;
//# public static final int MENU_ITEM_Y_SPACE = 9;
//# public static final int MENU_ITEM_STAT_Y_SPACE = 9;
//# public static final int MENU_TITLE_MARGIN = 1;
//#
//#elif Nokia_3100 || Nokia_3100_Unobfuscated
//# public static final int NUM_DISPLAY = 4;
//# public static final int NUM_STATS = 10;
//# public static final int NUM_SCORES = 8;
//# public static final int NUM_LEVELS = 10;
//# public static final int NUM_TEXT_LINES = 4;
//# public static final int MENU_WINDOW_MARGIN = 30;
//# public static final int TUTORIAL_WINDOW_X_MARGIN = 10;
//# public static final int TUTORIAL_WINDOW_Y_MARGIN = 32;
//# public static final int MENU_ITEM_Y_SPACE = 9;
//# public static final int MENU_ITEM_STAT_Y_SPACE = 9;
//# public static final int MENU_TITLE_MARGIN = 1;
//#
//#endif
public static int MENU_MAIN_Y_MID;
public static int MENU_STATS_Y_MID;
public static int MENU_WIDTH;
public static int MENU_ITEM_TOGGLE_WIDTH;
public static int MENU_ITEM_STAT_WIDTH;
public static int MENU_ITEM_TEXT_WIDTH;
public static int MENU_ITEM_TEXT_HEIGHT;
public static int MENU_ITEM_TEXT_FULL_WIDTH;
public static int MENU_ITEM_TEXT_FULL_HEIGHT;
public static int MENU_ITEM_TEXT_END_WIDTH;
public static int MENU_ITEM_TEXT_END_HEIGHT;
public static final int SKY_RGB_1 = 0x7dcce0;
public static final int SKY_RGB_2 = 0x9ee5f9;
//#if Nokia_3100 || Nokia_3100_Unobfuscated
//# public static final int GREEN_BACK_RGB_1 = 0xd0c87e;
//# public static final int GREEN_BACK_RGB_2 = 0xe8dc97;
//#else
public static final int GREEN_BACK_RGB_1 = 0xf4d38d;
public static final int GREEN_BACK_RGB_2 = 0xe6c173;
//#endif
public static final int MAX_MENU_DEPTH = 8;
/****************************************************************************
** Variables
***************************************************************************/
// The menu system is a graph-like data structure comprised of "menus" and "menu items".
// - each menu contains a list of menu items
// - each menu item has an associated block of event code and can point to another menu
// Menus
public static final short[] m_menu_title = new short[NUM_MENUS]; // locale index of title (-1 = none)
public static final byte[] m_menu_type = new byte[NUM_MENUS]; // visual/functional type template
public static final byte[] m_menu_list_start = new byte[NUM_MENUS];
// Menu Items
public static final short[] m_menu_item_text = new short[NUM_MENU_ITEMS]; // locale index of menu item text
public static final byte[] m_menu_item_type = new byte[NUM_MENU_ITEMS]; // visual/functional type template
public static final byte[] m_menu_item_state = new byte[NUM_MENU_ITEMS]; // logical state
//public static final byte[] m_menu_item_anim_state = new byte[NUM_MENU_ITEMS]; // animation state
public static final byte[] m_menu_item_pointer = new byte[NUM_MENU_ITEMS]; // pointer to the next menu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -