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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? wormscore.java

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

/*
 * WormScore.java
 *
 * Created on March 30, 2001, 16:15
 * @author Todd M Kennedy
 * @version 1.0
 */

package example.wormgame2;

import java.lang.System;
import java.lang.Runnable;
import java.lang.InterruptedException;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;

import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;

/**
 * The WormScore keeps track of the high scores for each of the worm
 * levels. All access to the scores occur through static methods. There
 * can never be a WormScore object.
 *
 * We cache the scores and names for quick access during game play. The
 * calling application must first call openHighScores() to open the
 * score database. Finally, a closeHighScores() must be called to release
 * system resources.
 */
public class WormScore {
    /** Array of high scores for each game level. */
    private static short[] highScore = new short[WormPit.MAX_LEVELS];
    /** Array of player names for each high score level. */
    private static String[] highScoreName = new String[WormPit.MAX_LEVELS];
    /** Current score for this game. */
    private static RecordStore myStore;
    /** Is the internal score struct intialized? */
    private static boolean highScoresHaveBeenInit; /* = false; */

    /** Default constructor can not be instantiated. */
    private WormScore() {
    }

    /**
     * Initialize all high scores to 0.
     */
    private static void initializeScores() {
	/* Initialize the score store */
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	DataOutputStream dos = new DataOutputStream(baos);
	byte[] b;

	try {
	    try {
		dos.writeShort(0);
		dos.writeUTF("");
		b = baos.toByteArray();
		dos.close();
	    } catch (IOException ioe) {
		throw new RecordStoreException();
	    }
	    
	    
	    for (int i = 0; i < WormPit.MAX_LEVELS; i++) {
		myStore.addRecord(b, 0, b.length);
	    }
	} catch (RecordStoreException rse) {
	    /* Silently fail; exception to read high score is non-critical */
	    closeHighScores();
	}
    }

    /**
     * Open the high score storage file. If the file doesn't exist,
     * initialize all high scores to 0.
     */
    static void openHighScores() {
	try {
	    myStore = RecordStore.openRecordStore("HighScores", true);

	    if (highScoresHaveBeenInit) return;

	    /* Intialize the internal score structures */
	    if (myStore.getNumRecords() == 0) {
		initializeScores();
	    } else {
		/* Read high score store */
		ByteArrayInputStream bais;
		DataInputStream      dis;
		byte                 data[];
		
		for (int i = 0; i < WormPit.MAX_LEVELS; i++) {
		    data = myStore.getRecord(i+1);
		    if (data != null) {
			try {
			    bais = new ByteArrayInputStream(data);
			    dis  = new DataInputStream(bais);
			    highScore[i]     = dis.readShort();
			    highScoreName[i] = dis.readUTF();
			    dis.close();
			} catch (IOException ioe) {
			}
		    }
		}
	    }
	    highScoresHaveBeenInit = true;
	    
	} catch (RecordStoreException rse) {
	    /* Silently fail; exception to read high score is non-critical */
	}
    }

    /**
     * Close the high score file
     */
    static void closeHighScores() {
	if (myStore != null) {
	    try {
		myStore.closeRecordStore();
	    } catch (RecordStoreException frse) {
	    }
	    myStore = null;
	}
    }

    /**
     * Save high score for posterity.
     * @param level current game level
     * @param newScore current game score to be recorded
     * @param name current user name to be recorded
     */
    static void setHighScore(int level, int newScore, String name) {
	ByteArrayOutputStream baos;
	DataOutputStream      das;
	byte[]                data;

	/* Only save score if it's higher */
	if (newScore <= highScore[level]) {
	    return;
	}

	try {
	    try {
		baos = new ByteArrayOutputStream();
		das = new DataOutputStream(baos);

		das.writeShort((short)newScore);
		das.writeUTF(name);
		data = baos.toByteArray();
		das.close();
	    } catch (IOException ioe) {
		throw new RecordStoreException();
	    }

            if (myStore == null) {
		openHighScores();
		myStore.setRecord(level + 1, data, 0, data.length);
		closeHighScores();
	    } else {
		myStore.setRecord(level + 1, data, 0, data.length);
	    }
	} catch (RecordStoreException rse) {
	    /* Silently fail; exception to save high score is non-critical */
	}

	highScore[level]     = (short)newScore;
	highScoreName[level] = name;
    }

    /**
     * Return the high score for a given level.
     * @param level current level for high score check
     * @return numeric value for highest score at the 
     * requested level
     */
    static short getHighScore(int level) {
	if (!highScoresHaveBeenInit) {
	    openHighScores();               // Force scores to be initialized
	    closeHighScores();
	}
	return highScore[level];
    }

    /**
     * Return the high score name for a given level.
     * @param level current level for high score check
     * @return name for highest score at the 
     * requested level
     */
    static String getHighScoreName(int level) {
	if (!highScoresHaveBeenInit) {
	    openHighScores();               // Force scores to be initialized
	    closeHighScores();
	}
	return highScoreName[level];
    }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品婷婷国产综合久久竹菊| 国产精品中文有码| 欧美日韩黄色影视| 午夜精品久久久久久久99水蜜桃| 欧美综合一区二区| 午夜精品在线视频一区| 日韩美女一区二区三区四区| 国产一区在线看| 中文字幕中文字幕一区二区| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 久久综合久久综合亚洲| 国产成人精品午夜视频免费| 中文字幕乱码久久午夜不卡 | 韩国v欧美v亚洲v日本v| 国产精品网站导航| 在线精品视频小说1| 久久国产精品免费| 中文字幕二三区不卡| 91成人免费电影| 久久狠狠亚洲综合| 亚洲欧美日韩国产综合在线| 欧美一区二区在线播放| 成人黄色大片在线观看| 日产欧产美韩系列久久99| 欧美经典一区二区| 欧美精选午夜久久久乱码6080| 国产盗摄一区二区| 日韩激情av在线| 国产精品美女久久久久久| 欧美日韩精品系列| 不卡一区二区中文字幕| 美美哒免费高清在线观看视频一区二区| 亚洲国产岛国毛片在线| 91精品欧美综合在线观看最新| 粉嫩欧美一区二区三区高清影视| 亚洲一区二区三区美女| 国产日产欧美一区二区视频| 欧美日韩一二三| 成人av在线看| 理论电影国产精品| 亚洲小说欧美激情另类| 国产午夜三级一区二区三| 欧美午夜在线一二页| 成人免费看片app下载| 亚洲123区在线观看| 亚洲欧美日韩小说| 国产精品欧美极品| 欧美精品一区二区三区久久久| 欧美手机在线视频| 色欧美片视频在线观看| 成人久久视频在线观看| 国内精品免费在线观看| 美女诱惑一区二区| 亚洲h在线观看| 亚洲最大色网站| 亚洲日本va午夜在线电影| 国产精品乱人伦中文| 26uuu久久综合| 日韩欧美国产一区在线观看| 欧美色图片你懂的| 欧美在线不卡视频| 色88888久久久久久影院野外| 成人性生交大合| 成人一区二区三区视频| 国产精品中文字幕日韩精品 | 免费成人在线影院| 日韩精品亚洲一区二区三区免费| 亚洲国产精品自拍| 亚洲高清在线精品| 亚洲图片欧美综合| 亚洲福利一区二区| 午夜精品久久久久久不卡8050| 一片黄亚洲嫩模| 亚洲愉拍自拍另类高清精品| 亚洲欧美成人一区二区三区| 17c精品麻豆一区二区免费| 亚洲欧洲韩国日本视频| 中文字幕在线免费不卡| 亚洲人xxxx| 一区二区三区四区不卡视频| 亚洲黄色性网站| 亚洲一区国产视频| 日韩av一区二区三区四区| 日本麻豆一区二区三区视频| 九色综合国产一区二区三区| 国模冰冰炮一区二区| 国产成人综合在线播放| 粉嫩嫩av羞羞动漫久久久 | 欧美美女一区二区三区| 欧美精品三级在线观看| 精品国产亚洲一区二区三区在线观看| 日韩一级免费一区| 久久精品视频免费观看| 亚洲视频在线观看一区| 亚洲激情在线激情| 日韩av电影天堂| 精品制服美女久久| 不卡一区中文字幕| 欧美美女喷水视频| 久久久蜜臀国产一区二区| 国产精品久久网站| 亚洲丰满少妇videoshd| 免费观看成人av| 成人福利电影精品一区二区在线观看| 不卡的电影网站| 在线成人av影院| 久久久久青草大香线综合精品| 亚洲丝袜精品丝袜在线| 日日夜夜一区二区| 国产+成+人+亚洲欧洲自线| 色一情一乱一乱一91av| 日韩亚洲欧美高清| 亚洲欧洲av另类| 免费视频一区二区| 91网页版在线| 精品不卡在线视频| 一区二区三区精品在线观看| 日本麻豆一区二区三区视频| jlzzjlzz欧美大全| 日韩视频在线你懂得| 亚洲视频每日更新| 久久99精品久久只有精品| 一本到不卡免费一区二区| 精品日产卡一卡二卡麻豆| 亚洲欧美日韩精品久久久久| 精品一区二区在线看| 欧美专区亚洲专区| 国产婷婷一区二区| 日日欢夜夜爽一区| 一本久久a久久精品亚洲| 精品国产乱码久久久久久夜甘婷婷 | 三级欧美在线一区| 一本色道综合亚洲| 国产欧美精品区一区二区三区| 亚洲va欧美va天堂v国产综合| 国产大陆精品国产| 欧美本精品男人aⅴ天堂| 亚洲第一电影网| 色综合久久中文综合久久97| 国产女同性恋一区二区| 久久99久久99| 日韩视频在线观看一区二区| 性做久久久久久久免费看| 99久久精品免费精品国产| 久久久无码精品亚洲日韩按摩| 免费成人小视频| 91精品国产乱码| 五月婷婷另类国产| 欧美性大战xxxxx久久久| 亚洲精品高清在线| 色美美综合视频| 亚洲精品水蜜桃| 91麻豆国产香蕉久久精品| 国产精品伦一区| 99久久免费精品| 亚洲欧洲美洲综合色网| 99久久99久久免费精品蜜臀| 国产精品沙发午睡系列990531| 国产一区二区精品在线观看| 精品欧美一区二区三区精品久久| 日韩专区在线视频| 制服.丝袜.亚洲.中文.综合| 亚洲国产综合在线| 欧美卡1卡2卡| 美女视频第一区二区三区免费观看网站| 欧美日韩高清一区二区三区| 亚洲a一区二区| 日韩午夜激情免费电影| 久久国产日韩欧美精品| 日韩精品一区二区三区三区免费| 捆绑变态av一区二区三区| 欧美tickling挠脚心丨vk| 国产精品99久久久久| 国产欧美一区二区精品性| 99精品黄色片免费大全| 亚洲女厕所小便bbb| 欧美日韩亚洲丝袜制服| 视频在线观看一区二区三区| 日韩欧美精品在线视频| 国产精品综合在线视频| 中文字幕国产一区二区| 91浏览器入口在线观看| 午夜视频在线观看一区二区| 日韩视频免费观看高清完整版在线观看| 日韩专区在线视频| 久久久精品免费网站| 成人av在线一区二区| 亚洲v中文字幕| 久久一区二区三区国产精品| 91丨porny丨国产入口| 亚洲在线中文字幕| 精品少妇一区二区三区免费观看| 风流少妇一区二区| 亚洲制服丝袜一区| 久久色在线观看| 91在线看国产| 久久精品国产网站| 亚洲人成在线观看一区二区| 欧美肥妇free| 粗大黑人巨茎大战欧美成人|