mobilegamemidlet.java

来自「java程序五子棋源代码。 java程序五子棋源代码。」· Java 代码 · 共 54 行

JAVA
54
字号
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 + =
减小字号Ctrl + -
显示快捷键?