📄 block.java
字号:
package hujkay;
import hujkay.record.*;
import hujkay.game.*;
import hujkay.menu.*;
import hujkay.help.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
import java.lang.*;
public class Block extends MIDlet {
//定义程序运行的状态
private Display display ;
private static Block block ;
///////////////////////
private RecordCanvas recordcanvas = null;
private GameCanvas gamecanvas = null;
private MenuCanvas menucanvas = null;
private HelpCanvas helpcanvas = null;
public Block()
{
display = Display.getDisplay(this) ;
block = this ;
menucanvas = new MenuCanvas(this);
display.setCurrent(menucanvas) ;
}
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void destroyApp(boolean arg0)/* throws MIDletStateChangeException */{
// TODO Auto-generated method stub
}
public void ErrProcess()
{
destroyApp(false);
this.notifyDestroyed() ;
}
public void start0(int source)
{
//这是启动菜单
/*
* * source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*
*/
/*private RecordCanvas recordcanvas = null;
private GameCanvas gamecanvas = null;
private MenuCanvas menucanvas = null;
private HelpCanvas helpcanvas = null;*/
/*
*
if(menucanvas != null)
menucanvas = null ;
if( helpcanvas != null)
helpcanvas = null ;
if( gamecanvas != null)
gamecanvas = null ;
if( recordcanvas != null)
recordcanvas = null ;
*/
menucanvas = new MenuCanvas(this);
display.setCurrent(menucanvas) ;
if( helpcanvas != null)
helpcanvas = null ;
if( gamecanvas != null)
gamecanvas = null ;
if( recordcanvas != null)
recordcanvas = null ;
}
public void start1(int source)
{
/*0 启动菜单
* 1 启动游戏
* 2 启动记录
* 3 启动帮助
* 4 退出游戏
*
* source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*/
gamecanvas = new GameCanvas(this);
display.setCurrent(gamecanvas);
if(menucanvas != null)
menucanvas = null ;
if( helpcanvas != null)
helpcanvas = null ;
if( recordcanvas != null)
recordcanvas = null ;
}
public void start2(int source)
{
/*0 启动菜单
* 1 启动游戏
* 2 启动记录
* 3 启动帮助
* 4 退出游戏
*
* source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*/
if(source == 0)
recordcanvas = new RecordCanvas(this,0);
else
recordcanvas = new RecordCanvas(this,gamecanvas.getscore());
display.setCurrent(recordcanvas);
if(menucanvas != null)
menucanvas = null ;
if( helpcanvas != null)
helpcanvas = null ;
if( gamecanvas != null)
gamecanvas = null ;
if( recordcanvas != null)
recordcanvas = null ;
}
public void start3(int source)
{
/*0 启动菜单
* 1 启动游戏
* 2 启动记录
* 3 启动帮助
* 4 退出游戏
*
* source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*/
helpcanvas = new HelpCanvas(this);
display.setCurrent(helpcanvas);
if(menucanvas != null)
menucanvas = null ;
if( gamecanvas != null)
gamecanvas = null ;
if( recordcanvas != null)
recordcanvas = null ;
}
public void start4( int source)
{
/*0 启动菜单
* 1 启动游戏
* 2 启动记录
* 3 启动帮助
* 4 退出游戏
*
* source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*/
this.destroyApp(false);
this.notifyDestroyed() ;
}
public void mangeaction( int event , int source)
{
//event 代表事件
/*0 启动菜单
* 1 启动游戏
* 2 启动记录
* 3 启动帮助
* 4 退出游戏
*
* source代表发送事件的来源
* 0 菜单
* 1 游戏
* 2 记录
* 3 帮助
*/
switch( event)
{
case 0: //启动菜单menu
start0(source) ; break ;
case 1: //启动游戏game
start1(source) ;break ;
case 2: // 启动记录record
start2(source) ;break ;
case 3://启动帮助
start3(source) ;break ;
case 4://退出游戏
start4(source) ;break ;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -