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

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

?? score.java

?? 貪食蛇小游戲 用j2me編的 用的是ide 大家參考一下下哦
?? JAVA
字號:
/*
 * @(#)Score.java	1.2 03/01/22
 *
 * Copyright (c) 2004 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms
 */

package example.pushpuzzle2;

import javax.microedition.rms.*;

/**
 * Keep track of the last level played.
 * For each level keep track of the number of moves.
 * <p>
 * The scores are kept in a RecordStore named PushPuzzleScores.
 * There are two types of records:
 * - Last level
 * - Level history
 *   Name of level (either resource name "/..." or...)
 */
class Score {
    // Current level record = {byte LEVEL_TAG; int level;}
    private int levelId;	// The record Id of the level record
    private byte[] levelRec;	// Byte array holding the level
    private static final int LEVEL_LEN = 9;
    private static final byte LEVEL_TAG = 1;

    // Score for level = {byte SCORE_TAG; int level, int pushes; int moves;}
    private int scoreId; // The record Id of the current level
    private byte[] scoreRec; // scores for the current level.
    private static final int SCORE_LEN = 13;
    private static final byte SCORE_TAG = 2;

    private RecordStore store;		// Record store, null if not open


    /*
     * Construct a new Score handler.
     */
    Score() {
	store = null;

	levelId = 0;
	levelRec = new byte[LEVEL_LEN];
	levelRec[0] = LEVEL_TAG;
	putInt(levelRec, 1, 0);
	putInt(levelRec, 5, 0);

	scoreId = 0;
	scoreRec = new byte[SCORE_LEN];
	scoreRec[0] = SCORE_TAG;
	putInt(scoreRec, 1, 0);
    }

    /**
     * Open the record store and locate
     * the record with the level number in it.
     */
    boolean open() {

	try {
	    store = RecordStore.openRecordStore("PushPuzzleScores", true);
	} catch (RecordStoreException ex) {
	}

	if (store == null)
	    return false;

	try {
	    /*
	     * Locate the record containing the level.
	     */
	    levelId = 0;
	    RecordEnumeration en = store.enumerateRecords(null, null, false);
	    while (en.hasNextElement()) {
	        int ndx = en.nextRecordId();
		if (store.getRecordSize(ndx) == LEVEL_LEN) {
		    int l = store.getRecord(ndx, levelRec, 0);
		    if (l == LEVEL_LEN &&
		        levelRec[0] == LEVEL_TAG) {
	                levelId = ndx;
	                break;
		    }
		} 
	    }
	} catch (RecordStoreException ex) {
	    ex.printStackTrace();
	    return false;
	}

	return true;
    }

    /**
     * Get the current Theme number.
     */
    int getTheme() {
	return getInt(levelRec, 5);
    }

    /**
     * Retrieve the level from the level record.  It should
     * have already been read from the store or created.
     * The first byte is a tag, the second byte the level.
     */
    int getLevel() {
	return getInt(levelRec, 1);
    }

    /**
     * Set the level and theme into the RecordStore.
     * @param level the current level
     * @param theme the current theme
     */
    boolean setLevel(int level, int theme) {
	putInt(levelRec, 1, level);
	putInt(levelRec, 5, theme);
	putInt(scoreRec, 1, level);

	if (store == null)
	    return false;
	try {
	    if (levelId == 0) {
		levelId = store.addRecord(levelRec, 0, levelRec.length);
	    } else {
		store.setRecord(levelId, levelRec, 0, levelRec.length);
	    }
	} catch (RecordStoreException ex) {
	    System.out.println("RecordStoreException");
	    ex.printStackTrace();
	    return false;
	}
	readScore(level);	// get the score for the level
	return true;
    }

    /**
     * Get the number of pushes on the current level.
     */
    int getPushes() {
	return getInt(scoreRec, 5);
    }
    
    /**
     * Get the number of moved on the current level.
     */
    int getMoves() {
	return getInt(scoreRec, 9);
    }
    
    /**
     * Read the score for the current level.
     * Read through the records looking for the one for this level.
     */
    boolean readScore(int level) {
	try {
	    scoreId = 0;

	    // Locate the matching record
	    RecordEnumeration en = store.enumerateRecords(null, null, false);
	    while (en.hasNextElement()) {
	        int ndx = en.nextRecordId();
		if (store.getRecordSize(ndx) == SCORE_LEN) {
		  int l = store.getRecord(ndx, scoreRec, 0);
		  if (l == SCORE_LEN &&
		      scoreRec[0] == SCORE_TAG &&
		      getInt(scoreRec, 1) == level) {
	            scoreId = ndx;
		    return true;
		  }
		} 
	    }
	} catch (RecordStoreException ex) {
	    ex.printStackTrace();
	    return false;
	}

	// No record found, start fresh
	scoreRec[0] = SCORE_TAG;
	putInt(scoreRec, 1, level);
	putInt(scoreRec, 5, 0);
	putInt(scoreRec, 9, 0);
	return true;
    }

    /**
     * Set the updated score to the RecordStore.
     */
    boolean setLevelScore(int pushes, int moves) {
	// Update the scores in the buffer.
	putInt(scoreRec, 5, pushes);
	putInt(scoreRec, 9, moves);

	try {
	    // Write/Add the record to the  store
	    if (scoreId == 0) {
		scoreId = store.addRecord(scoreRec, 0, scoreRec.length);
	    } else {
		store.setRecord(scoreId, scoreRec, 0, scoreRec.length);
	    }

	} catch (RecordStoreException ex) {
	    ex.printStackTrace();
	    return false;
	}
	return true;
    }

    /**
     * Get an integer from an array.
     */
    private int getInt(byte[] buf, int offset) {
	return (buf[offset+0] & 0xff) << 24 |
	    (buf[offset+1] & 0xff) << 16 |
	    (buf[offset+2] & 0xff) << 8 |
	    (buf[offset+3] & 0xff);
    }

    /**
     * Put an integer to an array
     */
    private void putInt(byte[] buf, int offset, int value) {
	buf[offset+0] = (byte)((value >> 24) & 0xff);
	buf[offset+1] = (byte)((value >> 16) & 0xff);
	buf[offset+2] = (byte)((value >>  8) & 0xff);
	buf[offset+3] = (byte)((value >>  0) & 0xff);
    }

    /**
     * Close the store.
     */
    void close() {
	try {
	    if (store != null) {
		store.closeRecordStore();
	    }
	} catch (RecordStoreException ex) {
	    ex.printStackTrace();
	}
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久不卡网国产精品一区| 欧美丰满嫩嫩电影| 久久99九九99精品| 亚洲第一av色| 午夜视频一区二区三区| 香蕉成人伊视频在线观看| 一区二区三区精品视频在线| 亚洲美女少妇撒尿| 亚洲一区二区三区小说| 午夜精品久久久| 免费在线观看成人| 国产毛片精品国产一区二区三区| 精东粉嫩av免费一区二区三区| 久久成人18免费观看| 激情综合亚洲精品| 成人av在线一区二区三区| 97精品国产露脸对白| 欧美日韩一区二区在线观看| 91麻豆精品国产91久久久更新时间 | 91精品国产免费| 欧美va在线播放| 国产精品丝袜一区| 一区二区三区不卡视频在线观看| 亚洲一区自拍偷拍| 国产在线不卡视频| 91香蕉视频污| 欧美久久高跟鞋激| 国产日韩精品一区二区三区在线| 亚洲欧洲中文日韩久久av乱码| 亚洲成人一区二区在线观看| 激情成人综合网| 色综合天天综合| 久久久精品天堂| 亚洲免费观看在线观看| 久久电影网电视剧免费观看| 99在线热播精品免费| 欧美一级在线免费| 亚洲欧洲国产专区| 久久er精品视频| 色婷婷精品久久二区二区蜜臂av| 91麻豆精品91久久久久同性| 综合色中文字幕| 黄页视频在线91| 欧美日韩大陆一区二区| 国产农村妇女精品| 久久不见久久见免费视频7| 色一情一乱一乱一91av| 日本一区二区三区四区在线视频 | 亚洲6080在线| av一区二区三区四区| 日韩免费福利电影在线观看| 一区二区三区蜜桃| 99久久伊人网影院| 久久久久国产精品麻豆ai换脸| 午夜欧美大尺度福利影院在线看| www.爱久久.com| 久久精品亚洲精品国产欧美kt∨| 午夜精品久久久久| 欧美亚洲一区三区| 日韩一区日韩二区| www.亚洲免费av| 久久女同性恋中文字幕| 免费观看在线综合| 欧美精品丝袜中出| 亚洲123区在线观看| 一本到不卡精品视频在线观看| 国产亚洲午夜高清国产拍精品| 蜜臀av在线播放一区二区三区| 欧美精品电影在线播放| 亚洲国产精品久久人人爱| 欧美在线你懂得| 一区二区三区中文字幕精品精品| 91美女精品福利| 亚洲女爱视频在线| 91行情网站电视在线观看高清版| 国产精品久久久久久久久晋中 | 亚洲va国产天堂va久久en| 欧美亚洲高清一区| 亚洲国产日韩在线一区模特| 在线亚洲一区二区| 亚洲一区成人在线| 欧美日韩国产在线播放网站| 日韩激情一区二区| 日韩欧美一区在线观看| 蜜臀99久久精品久久久久久软件| 欧美一区二区女人| 国产一区999| 中文一区在线播放| 色综合久久天天综合网| 亚洲人成在线观看一区二区| 欧美私人免费视频| 日本欧美大码aⅴ在线播放| 欧美大片在线观看一区| 成人一区二区三区视频在线观看| 最新中文字幕一区二区三区| 91黄色免费版| 91女厕偷拍女厕偷拍高清| 亚洲色图在线播放| 538prom精品视频线放| 麻豆极品一区二区三区| 国产精品久久久久久久久搜平片| 色婷婷综合久久久久中文一区二区| 一个色在线综合| 欧美变态凌虐bdsm| 91亚洲精品久久久蜜桃网站| 日日摸夜夜添夜夜添精品视频| 欧美第一区第二区| 色婷婷av一区二区三区gif| 男人的天堂久久精品| 欧美激情综合网| 4438x亚洲最大成人网| 懂色av一区二区三区免费看| 亚洲成av人在线观看| 国产日韩精品一区二区浪潮av| 色婷婷av一区二区三区软件| 国产真实精品久久二三区| 一区二区三区色| 26uuu国产日韩综合| 欧美综合亚洲图片综合区| 狠狠色丁香久久婷婷综合丁香| 一区二区中文视频| 2021久久国产精品不只是精品| 91久久精品网| 粉嫩在线一区二区三区视频| 麻豆极品一区二区三区| 亚洲高清免费在线| 亚洲欧洲精品一区二区三区 | 91色porny在线视频| 麻豆免费精品视频| 一区二区三区精品| 国产精品成人在线观看| www久久精品| 日韩一区二区在线看片| 色综合天天综合网天天看片| 国产高清不卡一区| 寂寞少妇一区二区三区| 日韩中文字幕麻豆| 一区二区三区在线观看欧美| 国产精品区一区二区三区| 精品99一区二区| 91精品国产一区二区三区香蕉| 欧美影院午夜播放| 色哟哟亚洲精品| 99久精品国产| 不卡欧美aaaaa| 国产成人精品一区二区三区四区 | 亚洲一区二区av在线| 亚洲欧美日韩国产另类专区| 国产欧美日韩一区二区三区在线观看| 日韩免费高清视频| 精品欧美一区二区在线观看| 日韩免费看的电影| 欧美va亚洲va香蕉在线| 欧美大片国产精品| 久久夜色精品国产噜噜av| 欧美大片拔萝卜| 精品国免费一区二区三区| 欧美zozozo| 久久综合九色欧美综合狠狠| 久久久五月婷婷| 国产亚洲一二三区| 亚洲欧洲成人av每日更新| 成人欧美一区二区三区视频网页 | 欧美xxxxxxxxx| 久久亚洲欧美国产精品乐播| 久久看人人爽人人| 国产精品久线观看视频| 亚洲欧美日韩国产另类专区| 亚洲一区在线电影| 裸体一区二区三区| 国产ts人妖一区二区| 波波电影院一区二区三区| 日本丶国产丶欧美色综合| 欧美日韩精品福利| 久久综合一区二区| 亚洲人成伊人成综合网小说| 洋洋av久久久久久久一区| 美女视频黄免费的久久| 懂色一区二区三区免费观看 | 欧美成人伊人久久综合网| 久久综合中文字幕| 亚洲美女电影在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 国产精品自拍一区| 色综合久久综合网欧美综合网| 51精品秘密在线观看| 中文字幕第一区| 亚洲丶国产丶欧美一区二区三区| 免费视频一区二区| 91伊人久久大香线蕉| 日韩欧美在线1卡| 亚洲精品视频一区| 激情综合色综合久久| 色网站国产精品| 久久亚洲二区三区| 午夜电影一区二区三区| av高清久久久| 精品动漫一区二区三区在线观看| 亚洲免费高清视频在线| 国产一区视频导航|