?? menulist.java
字號:
/**********************************************************
File name:MenuList.java
Author:夏文濤
Version:Beta1.0
Data:2007/10/16
Description:
手機菜單的顯示和處理.
Function List:
1.setGameActive(boolean)
更新游戲運行狀態.如果暫停游戲,則加入"繼續游戲"項.
*********************************************************/
package com.Izual.MetalMax;
import javax.microedition.lcdui.*;
public class MenuList extends List implements CommandListener{
private MetalMax midlet;
private Command exitCommand;
/*游戲是否暫停*/
private boolean gameActive = false;
public MenuList(MetalMax midlet) {
// TODO 自動生成構造函數存根
super("MetalMax",List.IMPLICIT);
this.midlet = midlet;
append("新游戲",null);
append("讀取進度",null);
append("制作組",null);
exitCommand = new Command("退出",Command.EXIT,1);
addCommand(exitCommand);
setCommandListener(this);
}
/*更新游戲狀態,如果暫停,則加入"繼續游戲",否則,把以前加入的"繼續游戲"刪去*/
public void setGameActive(boolean active){
if(active && !gameActive){
gameActive = true;
insert(0,"繼續游戲",null);
}else if(!active && gameActive){
gameActive = false;
delete(0);
}
}
/*監聽事件處理*/
public void commandAction(Command c ,Displayable d){
if( c == List.SELECT_COMMAND){
int index = getSelectedIndex();
if(index != -1){
if(!gameActive){
index++;
}
/*根據菜單編號決定游戲狀態*/
switch(index){
/*繼續游戲*/
case 0:
midlet.menuListContinue();
break;
/*新游戲*/
case 1:
midlet.menuListNewGame();
break;
/*顯示記錄*/
case 2:
midlet.menuListRecord();
break;
/*顯示游戲介紹*/
case 3:
midlet.menuListInstructions();
break;
default:
break;
}
}
}else if(c == exitCommand){
midlet.menuListQuit();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -