⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fivegame.java

📁 J2ME的游戏原代码!希望能帮助有需要帮助的师兄弟们!..
💻 JAVA
字号:
/*
 *游戏MIdlet
 *作者:肖昶
 *
*/
package fivegame;

import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.rms.*;

public class FiveGame extends MIDlet {

	public static Display display = null;// 显示器
	public static FiveGame fiveGame = null;// 本类自身
	private static Displayable show = null;// 显示画面

	// 构造函数
	public FiveGame() {
		display = Display.getDisplay(this);// 获取显示器
		fiveGame = this;// 指向自身
		show = MainMenu.getInstance();// 指向主菜单画面
		RecordStore rs = null;
		try {
			rs = RecordStore.openRecordStore("UserInfo", true, 0, false);// 打开记录
			if (rs.getNumRecords() == 0) {// 不存在记录
				// 写入默认信息
				Setting.writeUserName(rs, "Player", true);
				Setting.writeWLData(rs, true, false, true);
			}
			rs.closeRecordStore();// 关闭记录
		} catch (RecordStoreException e) {
			e.printStackTrace();
		}
	}

	// 游戏退出
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		notifyDestroyed();
	}

	// 游戏暂停
	protected void pauseApp() {
		show = display.getCurrent();
	}

	// 游戏启动
	protected void startApp() throws MIDletStateChangeException {
		display.setCurrent(show);// 设置画面

	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -