📄 mobilegamemidlet.java
字号:
package com.tianxia.qipai;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import com.tianxia.qipai.control.MainControl;
import com.tianxia.qipai.event.*;
public class MobileGameMidlet extends MIDlet {
private MainControl maincontrol;
public MobileGameMidlet() {
super();
maincontrol=MainControl.getInstance();
maincontrol.init(this);
maincontrol.handleEvent(MainGameEvent.MAINGAMESTART,new MainGameEvent());
// TODO 自动生成构造函数存根
}
protected void startApp() throws MIDletStateChangeException {
if(maincontrol!=null){
maincontrol.handleEvent(MainGameEvent.MAINGAMEWAKEN,new MainGameEvent());
}
// TODO 自动生成方法存根
}
protected void pauseApp() {
// TODO 自动生成方法存根
maincontrol.handleEvent(MainGameEvent.MAINGAMEPAUSE,new MainGameEvent());
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO 自动生成方法存根
try {
Thread.sleep(100); //为了给socket连接有足够的时间发送数据
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
public void gameExit(){
try {
destroyApp(true);
} catch (MIDletStateChangeException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
notifyDestroyed();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -