亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rmssystem.java

?? 基于J2ME的Java游戲夢幻炸彈人源程序
?? JAVA
字號:
/**
 * <p>
 * Title:RMSSystem
 * </p>
 * <p>
 * Description:手機RMS系統的設計,用來存儲分數
 * </p>
 * <p>
 * Copyright: Copyright (c) 2005
 * </p>
 * <p>
 * Company:
 * </p>
 * 非作者授權,請勿用于商業用途。
 * @author bruce.fine@gmail.com
 * @version 1.0
 */
import javax.microedition.rms.*;

public class RMSSystem {
	/**
	 * 建立RMSSystem系統 主要存儲當前關卡與分數
	 */
	public static void init() {
		// 創建N個名次

		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
				// 如果是第一次使用
				// 寫入當前關卡數
				int currentLevelId = 0;
				if (Consts.SIS_DEBUG) {
					currentLevelId = Consts.SN_ABS_MAX_LEVEL;
				}
				byte bytes[] = longToBytes(currentLevelId);
				hsRecorder.addRecord(bytes, 0, bytes.length);
				// 寫入每一個關卡的分數
				bytes = new byte[8 * (Consts.SN_ABS_MAX_LEVEL + 1)];
				for (int i = 0; i <= Consts.SN_ABS_MAX_LEVEL; i++) {
					byte[] bBytes = longToBytes(0);
					for (int j = 0; j < bBytes.length; j++) {
						bytes[i * 8 + j] = bBytes[j];
					}
				}
				hsRecorder.addRecord(bytes, 0, bytes.length);
				// Sound on off
				bytes = new byte[1];
				bytes[0] = 1;
				hsRecorder.addRecord(bytes, 0, bytes.length);
				// 背景
				bytes = new byte[1];
				bytes[0] = 0;
				hsRecorder.addRecord(bytes, 0, bytes.length);
				// 難度
				bytes = new byte[1];
				bytes[0] = 0;
				hsRecorder.addRecord(bytes, 0, bytes.length);
			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms init: " + ex.getMessage());
		}

	}

	//
	public static int getBackId() {
		int flag = 0;
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[1];
				hsRecorder.getRecord(4, bytes, 0);
				flag = bytes[0];
			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			System.out.println("rms s: " + ex.getMessage());
		}
		return flag;
	}

	//
	public static int getEasyHardId() {
		int flag = 0;
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[1];
				hsRecorder.getRecord(5, bytes, 0);
				flag = bytes[0];
			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			System.out.println("rms s: " + ex.getMessage());
		}
		return flag;
	}

	//
	public static boolean isSoundOn() {
		boolean flag = false;
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[1];
				hsRecorder.getRecord(3, bytes, 0);
				if (bytes[0] == 0) {
					flag = false;
				} else {
					flag = true;
				}

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			System.out.println("rms s: " + ex.getMessage());
		}
		return flag;
	}

	public static void saveSound(boolean srcSound) {
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {

				byte[] bytes = new byte[1];
				if (srcSound) {
					bytes[0] = 1;
				} else {
					bytes[0] = 0;
				}
				hsRecorder.setRecord(3, bytes, 0, bytes.length);

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms slel: " + ex.getMessage());
		}
	}

	public static void saveBackId(int id) {
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {

				byte[] bytes = new byte[1];
				bytes[0] = (byte) id;
				hsRecorder.setRecord(4, bytes, 0, bytes.length);

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms slel: " + ex.getMessage());
		}
	}

	public static void saveEasyHardId(int id) {
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {

				byte[] bytes = new byte[1];
				bytes[0] = (byte) id;
				hsRecorder.setRecord(5, bytes, 0, bytes.length);

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms slel: " + ex.getMessage());
		}
	}

	/**
	 * 獲得當前打開的關卡
	 */
	public static int loadLevelOpened() {

		int bLevelId = 0;
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[8];
				hsRecorder.getRecord(1, bytes, 0);
				bLevelId = (int) bytesToLong(bytes);

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms oplel: " + ex.getMessage());
		}
		return bLevelId;

	}

	/**
	 * 
	 */
	public static void saveLevelOpened(int nLevelId) {
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[8];
				hsRecorder.getRecord(1, bytes, 0);
				long value = bytesToLong(bytes);
				if (value < nLevelId) {
					bytes = longToBytes(nLevelId);
					hsRecorder.setRecord(1, bytes, 0, bytes.length);

				}

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms slel: " + ex.getMessage());
		}

	}

	/***/
	public static long[] loadHighScoresPerLevel() {
		long longHighScore[] = new long[Consts.SN_ABS_MAX_LEVEL + 1];

		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				byte[] bytes = new byte[(Consts.SN_ABS_MAX_LEVEL + 1) * 8];
				hsRecorder.getRecord(2, bytes, 0);

				for (int i = 0; i <= Consts.SN_ABS_MAX_LEVEL; i++) {
					byte[] bBytes = new byte[8];
					for (int j = 0; j < bBytes.length; j++) {
						bBytes[j] = bytes[i * 8 + j];
					}
					longHighScore[i] = bytesToLong(bBytes);
				}

			}
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms ichi: " + ex.getMessage());
		}
		return longHighScore;
	}

	/***/
	public static void saveHighScoreByLevel(int levelId, long highScore) {
		byte[] bytes = new byte[(Consts.SN_ABS_MAX_LEVEL + 1) * 8];
		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			if (hsRecorder.getVersion() == 0) {
			} else {
				hsRecorder.getRecord(2, bytes, 0);

			}
			byte[] bBytesTemp = longToBytes(highScore);

			for (int i = 0; i < bBytesTemp.length; i++) {
				bytes[levelId * 8 + i] = bBytesTemp[i];
			}
			hsRecorder.setRecord(2, bytes, 0, bytes.length);
			hsRecorder.closeRecordStore();

		} catch (Exception ex) {
			// System.out.println("rms hl: " + ex.getMessage());
		}

	}

	public static byte[] longToBytes(long seed) {
		byte tempByte[] = new byte[8];
		tempByte[0] = (byte) ((seed >> 56) & 0x00000000000000FF);
		tempByte[1] = (byte) ((seed >> 48) & 0x00000000000000FF);
		tempByte[2] = (byte) ((seed >> 40) & 0x00000000000000FF);
		tempByte[3] = (byte) ((seed >> 32) & 0x00000000000000FF);
		tempByte[4] = (byte) ((seed >> 24) & 0x00000000000000FF);
		tempByte[5] = (byte) ((seed >> 16) & 0x00000000000000FF);
		tempByte[6] = (byte) ((seed >> 8) & 0x00000000000000FF);
		tempByte[7] = (byte) ((seed) & 0x00000000000000FF);
		return tempByte;
	}

	public static long bytesToLong(byte[] seeds) {
		long tempLong = 0x0000000000000000;
		tempLong |= (((long) (seeds[0])) << 56) & 0xFF000000;
		tempLong |= (((long) (seeds[1])) << 48) & 0x00FF0000;
		tempLong |= (((long) (seeds[2])) << 40) & 0x0000FF00;
		tempLong |= (((long) (seeds[3])) << 32) & 0x000000FF;
		tempLong |= (((long) (seeds[4])) << 24) & 0xFF000000;
		tempLong |= (((long) (seeds[5])) << 16) & 0x00FF0000;
		tempLong |= (((long) (seeds[6])) << 8) & 0x0000FF00;
		tempLong |= (((long) (seeds[7]))) & 0x000000FF;
		return tempLong;
	}

	/**
	 * 清空
	 */
	public static void clearRecords() {

		try {
			RecordStore hsRecorder = RecordStore.openRecordStore(
					Consts.SSTR_RMS_NAME, true);
			byte bytes[] = longToBytes(0);
			hsRecorder.setRecord(1, bytes, 0, bytes.length);
			// 寫入每一個關卡的分數
			bytes = new byte[8 * (Consts.SN_ABS_MAX_LEVEL + 1)];
			for (int i = 0; i <= Consts.SN_ABS_MAX_LEVEL; i++) {
				byte[] bBytes = longToBytes(0);
				for (int j = 0; j < bBytes.length; j++) {
					bytes[i * 8 + j] = bBytes[j];
				}
			}
			hsRecorder.setRecord(2, bytes, 0, bytes.length);
			hsRecorder.closeRecordStore();
		} catch (Exception ex) {
			// System.out.println("cl rsm:" + ex.getMessage());
		} // try-catch
	}

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
奇米色一区二区| 丰满亚洲少妇av| 欧美久久久久中文字幕| 国产精品你懂的在线欣赏| 久久精品二区亚洲w码| 99久久伊人精品| 91精品国产手机| 亚洲二区在线观看| 欧美羞羞免费网站| 一区二区三区**美女毛片| 99综合电影在线视频| 国产精品女主播av| 丁香桃色午夜亚洲一区二区三区| 日韩三级视频在线看| 蜜桃91丨九色丨蝌蚪91桃色| 日韩一卡二卡三卡国产欧美| 免费成人在线网站| 久久综合狠狠综合久久激情| 国产成人av电影在线观看| 国产日韩av一区二区| 色综合咪咪久久| 日本中文字幕一区二区视频 | 亚洲不卡在线观看| 欧美一个色资源| 亚洲mv在线观看| 欧美日韩一区二区三区在线| 日本不卡一区二区| 国产午夜亚洲精品羞羞网站| 91香蕉视频mp4| 狠狠色狠狠色综合日日91app| 国产偷国产偷精品高清尤物| 99国产精品久久久| 老汉av免费一区二区三区| 国产精品色一区二区三区| 在线国产亚洲欧美| 国产专区综合网| 午夜在线电影亚洲一区| 精品国产一区二区精华| 欧美在线观看18| av一区二区三区| 国内成人精品2018免费看| 一区二区三区小说| 国产日韩欧美高清| 久久精品亚洲精品国产欧美| 欧美理论在线播放| 国产乱码精品一区二区三区av | 亚洲成人av电影| 国产精品另类一区| 久久综合国产精品| 精品久久五月天| 精品国精品国产| 精品久久久久久久人人人人传媒| 欧美人体做爰大胆视频| 欧洲一区在线电影| 在线观看免费亚洲| 欧美专区在线观看一区| 日本韩国视频一区二区| 91福利在线免费观看| 91影视在线播放| 91国偷自产一区二区三区成为亚洲经典| 成人av在线播放网址| 9i在线看片成人免费| 欧洲国内综合视频| 欧美日本韩国一区二区三区视频 | 色婷婷香蕉在线一区二区| 日本道免费精品一区二区三区| 99久久久精品免费观看国产蜜| av亚洲精华国产精华精华| 成人黄色777网| 欧美三级乱人伦电影| 日韩免费视频一区二区| 亚洲国产精品t66y| 亚洲人成电影网站色mp4| 亚洲成av人片在线观看无码| 丝袜美腿高跟呻吟高潮一区| 国产一区二区三区四区五区美女 | 欧美激情一区二区在线| 亚洲在线观看免费| 久久成人综合网| 色综合久久久久久久久久久| 69精品人人人人| 欧美一二区视频| 国产亚洲成年网址在线观看| 亚洲成在线观看| 国产91精品一区二区麻豆亚洲| 在线看日韩精品电影| 久久久久久免费网| 午夜视频在线观看一区二区| 国产高清精品在线| 日韩一区二区三区免费观看| 专区另类欧美日韩| 国产精品1区2区| 欧美电影免费观看完整版| 亚洲国产精品久久久男人的天堂| 国产精品99精品久久免费| 欧美成人a∨高清免费观看| 亚洲一二三级电影| 在线视频中文字幕一区二区| 欧美精彩视频一区二区三区| 日韩电影免费一区| 欧美理论电影在线| 亚洲一区二区视频| 精品视频全国免费看| 一区二区不卡在线播放 | 免费日韩伦理电影| 在线成人免费视频| 日韩高清在线电影| 欧美大片在线观看一区| 激情综合色播五月| 国产人伦精品一区二区| 成人动漫精品一区二区| 亚洲天堂a在线| 欧美性生活大片视频| 性久久久久久久久久久久| 5566中文字幕一区二区电影| 老司机免费视频一区二区 | 欧美日韩国产精品成人| 日韩avvvv在线播放| 久久网站热最新地址| 成人污视频在线观看| 一区二区三区鲁丝不卡| 欧美日韩国产成人在线91| 精品一区二区三区在线观看国产| 久久在线观看免费| 在线观看免费视频综合| 精品亚洲免费视频| 91精品国产综合久久小美女| 精品亚洲国产成人av制服丝袜 | 亚洲电影激情视频网站| 日韩欧美第一区| 在线影视一区二区三区| 国产精品综合av一区二区国产馆| 国产精品久久久久久久久免费樱桃 | 亚洲影视资源网| 国产精品毛片a∨一区二区三区| 欧美色电影在线| a亚洲天堂av| 国产精品一卡二卡| 免费久久99精品国产| 一区二区三区欧美| 国产精品理伦片| 欧美精品一区二| 日韩视频在线观看一区二区| 国产iv一区二区三区| 久久夜色精品国产噜噜av| 欧美一区二区三区四区视频| 色综合久久天天| 99久久久精品| 99久久综合狠狠综合久久| 韩国精品在线观看| 免费在线成人网| 久久99精品久久只有精品| 日韩精品亚洲一区二区三区免费| 一区二区三区在线免费| 亚洲人吸女人奶水| 亚洲欧美日韩国产一区二区三区| 久久久久综合网| 国产精品国产馆在线真实露脸 | 免费日本视频一区| 精品在线一区二区三区| 国产精品一区二区在线看| 国产精品1区2区| 色网站国产精品| 成人av在线一区二区| 色94色欧美sute亚洲线路二| 欧美在线一区二区| 日韩欧美国产一区二区在线播放| 精品国产亚洲一区二区三区在线观看| 色综合天天综合网天天看片| 91免费版在线| 91精品国产一区二区三区香蕉| 日韩精品一区二区三区四区| 国产视频一区不卡| 亚洲一区二区在线观看视频| 久久精品国产第一区二区三区| 成人激情小说乱人伦| 欧美日韩卡一卡二| 亚洲国产精品99久久久久久久久 | 国产九色sp调教91| 91污片在线观看| 日韩精品资源二区在线| 国产精品黄色在线观看| 喷白浆一区二区| 91在线小视频| 国产日韩欧美不卡在线| 五月婷婷激情综合| 色综合天天狠狠| 欧美国产精品v| 国产伦理精品不卡| 7777精品伊人久久久大香线蕉的| 日本一区二区动态图| 久久精品国产一区二区| 欧美色精品在线视频| 18成人在线视频| 精品一区二区三区视频| 日韩视频免费观看高清完整版在线观看 | 亚洲美女区一区| av不卡免费电影| 国产精品美女视频| 高清在线成人网|