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

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

?? blitzmidlet.java

?? 一個關于沉船的J2ME小游戲
?? JAVA
字號:
/* This file was created by Nokia Developer's Suite for J2ME(TM) */

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import java.io.DataOutputStream;
import java.io.DataInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;

public class BlitzMIDlet extends MIDlet
{
	private final Dictionary dictionary;
	private final MainMenu mainMenu;
	private final GameEffects gameEffects;

	private GameManager gameManager = null;
	private SettingsScreen settingsScreen = null;

	private int	hiScore = 0;
	private int hiLevel = 1;


	public BlitzMIDlet()
	{
		boolean bCont;
		ByteArrayInputStream gameBais;
		int iDummy;

        	dictionary =
            	new Dictionary(System.getProperty("microedition.locale"),
                           		System.getProperty("microedition.encoding"));

        	gameEffects = makeGameEffects();
		bCont = Settings.getContinue();
		try
		{
			gameBais	= Settings.getArrayValue(Settings.GM_MAIN_DATA);
			DataInputStream inputStream = new DataInputStream(gameBais);
			hiLevel	= inputStream.readInt();
			hiScore	= inputStream.readInt();
		}
		catch (Exception e)
		{
			throw new IllegalArgumentException("Error in mainMenuNewGame:try setGameData(2)");
		}

        	mainMenu = new MainMenu(this, dictionary, gameEffects, bCont);
		
	}


	protected void startApp(  ) throws MIDletStateChangeException
	{
	        Displayable current = Display.getDisplay(this).getCurrent();

	        if (current == null)
        	{
	            // Use a splash screen, the first time we are called.
			// The main menu screen will be shown after the splash.
			// First show the company splash screen
	            SplashScreen splashScreen = new SplashScreen(this, mainMenu);
	            Display.getDisplay(this).setCurrent(splashScreen);
        	    	splashScreen.start(); // disappear after a fixed time
	        }
        	else
	        {
        	  	Display.getDisplay(this).setCurrent(current);
                	if ((gameManager != null) && (current == gameManager.getCanvas()))
	          	{
        	    		gameManager.resume();
	          	}
        	}
	}

	protected void pauseApp(  )
	{
	}

	protected void destroyApp( boolean p1 ) throws MIDletStateChangeException
	{
		storeGame();
	}

	// SplashScreen callback
	void splashScreenDone(Displayable next)
	{
      	Display.getDisplay(this).setCurrent(next);
	}

	//**********************//
	// GameManager callback //
	//**********************//
	void gameManagerMainMenu(boolean isGameOver, int currentHiScore)
    	{
		ByteArrayOutputStream gameBaos = new ByteArrayOutputStream();

        	// If the game is over, remove the
        	// 'Continue' command from the MainMenu.
        	if (isGameOver)
        	{
			Settings.setContinue(false);
            	mainMenu.deleteContinue();
			try
			{
				gameBaos = gameManager.getGameData();
				Settings.setValue(Settings.GM_MAIN_DATA, gameBaos);
			}
			catch(Exception e)
			{
				// We can not do anything to recover from this error,
				// let the game proceed without using saved settings.
				throw new IllegalArgumentException("Error in gameManagerMainMenu:try setValue (1)");
			}
			hiScore = currentHiScore;
        	}
        	else
        	{
			Settings.setContinue(true);
            	// highlight 'Continue' in the main menu
            	mainMenu.selectContinue();
        	}

        	Display.getDisplay(this).setCurrent(mainMenu);
    	}


	//********************//
    	// MainMenu callbacks //
	//********************//
	void mainMenuContinue()
    	{
		if (gameManager != null)
		    	Display.getDisplay(this).setCurrent(gameManager.getCanvas());
		else
		{
			mainMenuNewGame(true);
		}
    	}


	void mainMenuNewGame(boolean getData)
    	{
        	// gameManager uses the canvas for repaints,
        	// determining canvas width, height, etc.

		// Create a new game manager if one does not exist
		if (gameManager == null)
		{
	        	Canvas closeableCanvas = makeCloseableCanvas();
     		  	gameManager = new GameManager(this, dictionary,
           			                          gameEffects, closeableCanvas);

	        	// The canvas delegates drawing of the game and handling of
     		  	// keyPressed, keyReleased or 'closePressed' events to gameManager.
     			((SettableDelegate)closeableCanvas).setDelegate(gameManager);
		}
		else gameManager.init();

		// If a saved game has been continued hen we need to upload the stored data
		if (getData)
		{
			try
			{
				ByteArrayInputStream gameBais  = Settings.getArrayValue(Settings.GM_MAIN_DATA);
				ByteArrayInputStream planeBais = Settings.getArrayValue(Settings.GM_PLANE_DATA);
				ByteArrayInputStream bombBais  = Settings.getArrayValue(Settings.GM_BOMB_DATA);
				ByteArrayInputStream buildingBais = Settings.getArrayValue(Settings.GM_BUILD_DATA);
				gameManager.setGameData(gameBais);
				gameManager.setPlaneData(planeBais);
				gameManager.setBombData(bombBais);
				gameManager.setBuildingData(buildingBais);
			}
			catch (Exception e)
			{
				throw new IllegalArgumentException("Error in mainMenuNewGame:try setGameData(1)");
			}
		}
		else
		{
			// Just set the HiScore & HiLevel
			try
			{
				ByteArrayInputStream gameBais  = Settings.getArrayValue(Settings.GM_MAIN_DATA);
				gameManager.setGameHi(gameBais);
			}
			catch (Exception e)
			{
				throw new IllegalArgumentException("Error in mainMenuNewGame:try setGameData(2)");
			}
		}
        	gameManager.start(getData);

     	  	// Set the display to be the game manager's canvas.
	    	Display.getDisplay(this).setCurrent(gameManager.getCanvas());

        	// After the game manager's canvas is displayed and
     	  	// the game is running, the 'Continue' option will be
     		// needed from the main menu.
     		mainMenu.addContinue();
    	}


    	void mainMenuSettings()
    	{
        if (settingsScreen == null)
        {
            settingsScreen = new SettingsScreen(this, dictionary, mainMenu);
        }
        Display.getDisplay(this).setCurrent(settingsScreen);
    	}


    	void mainMenuInstructions()
    	{
        String title = dictionary.getString(Dictionary.LABEL_INSTRUCTIONS);
        String back  = dictionary.getString(Dictionary.LABEL_BACK);
        String text = dictionary.getString(Dictionary.TEXT_INSTRUCTIONS);
        TextScreen screen = new TextScreen(this, title, text, back);
        Display.getDisplay(this).setCurrent(screen);
    	}


    	void mainMenuHiScore()
    	{
	  StringBuffer buff = new StringBuffer("");
	  buff.append(hiScore);
        String score	= new String(buff);
        String title	= dictionary.getString(Dictionary.LABEL_HISCORE);
	  String back	= dictionary.getString(Dictionary.LABEL_BACK);
        TextScreen aboutScreen = new TextScreen(this, title, score, back);
        Display.getDisplay(this).setCurrent(aboutScreen);
    	}


    	void mainMenuExit()
    	{
        	// destroyApp(false);
		storeGame();
        	notifyDestroyed();
    	}

    // SettingEditor callbacks

    void settingEditorSave(String name, boolean isOn)
    {
        // update game setting and settings screen
        if (name.equals(dictionary.getString(Dictionary.LABEL_VIBRATION)))
        {
            Settings.setUseVibration(isOn);
            settingsScreen.setUseVibration(isOn);
        }
        else if (name.equals(dictionary.getString(Dictionary.LABEL_SOUND)))
        {
            Settings.setUseSound(isOn);
            settingsScreen.setUseSound(isOn);
        }

        Alert confirm = new Alert(null,
            (name + " " + settingsScreen.onOffString(isOn)),
            null, AlertType.INFO); // no title
        confirm.setTimeout(4000); // show Alert for 4 seconds

        Display.getDisplay(this).setCurrent(confirm, settingsScreen);
    }


    void settingEditorBack()
    {
        Display.getDisplay(this).setCurrent(settingsScreen);
    }


    // SettingsScreen callbacks

    void settingsScreenBack(Displayable last)
    {
        settingsScreen = null; // It can be garbage collected now.

        if ((gameManager != null) && (last == gameManager.getCanvas()))
        {
            gameManager.resume();
        }
        Display.getDisplay(this).setCurrent(last);
    }


    void settingsScreenEdit(String name, boolean isOn)
    {
        Display.getDisplay(this).setCurrent(
            new SettingEditor(this, dictionary, name, isOn));
    }


    	// TextScreen callbacks (i.e. About + Instructions)
    	void textScreenClosed()
    	{
        	Display.getDisplay(this).setCurrent(mainMenu);
    	}

	// Factory-like methods
    	//
    	// The Nokia vendor-specific APIs FullCanvas, Sound, and DeviceControl
    	// are used if available. If not, use an alternative based on
    	// the capabilities of standard MIDP instead.
    	private GameEffects makeGameEffects()
    	{
        	try
        	{
            	Class.forName("com.nokia.mid.sound.Sound");
            	Class.forName("com.nokia.mid.ui.DeviceControl");
			Class.forName("com.nokia.mid.ui.DirectUtils");

            	// If no exception was thrown, use the vendor-specific APIs.
            	Class clas = Class.forName("NokiaGameEffects");
            	return (GameEffects) clas.newInstance();
        	}
        	catch (Exception e)
        	{
        	    // The vendor-specific APIs are not available,
            	// so use the 'stub' GameEffects instead.
            	return new GameEffects();
        	}
    	}

    	private Canvas makeCloseableCanvas()
    	{
        	try
        	{
            	Class.forName("com.nokia.mid.ui.FullCanvas");

            	// If no exception was thrown, use a 'closeable Canvas'
            	// based on the vendor-specific FullCanvas class.
            	Class clas = Class.forName("NokiaCloseableCanvas");
            	return (Canvas) clas.newInstance();
        	}
        	catch (Exception e)
        	{
            	// If the vendor-specific FullCanvas API isn't available,
            	// use the default CloseableCanvas (derived from Canvas).
            	String closeLabel = dictionary.getString(dictionary.LABEL_BACK);
            	return new CloseableCanvas(closeLabel);
        	}
    	}

	void storeGame()
	{
		ByteArrayOutputStream gameBaos = new ByteArrayOutputStream();
		ByteArrayOutputStream planeBaos = new ByteArrayOutputStream();
		ByteArrayOutputStream bombBaos = new ByteArrayOutputStream();
		ByteArrayOutputStream buildingBaos = new ByteArrayOutputStream();

        	if (gameManager != null)
        	{
			// Set the continue flag depending on the game status
			if (gameManager.getStatus() == 3 || gameManager.getStatus() == 6)
				// Game was over so kill the continue flag
				Settings.setContinue(false);
			else
				// A game was in progress so save the continue flag
				Settings.setContinue(true);

			try
			{
				gameBaos = gameManager.getGameData();
				Settings.setValue(Settings.GM_MAIN_DATA, gameBaos);
			}
			catch(Exception e)
			{
				// We can not do anything to recover from this error,
				// let the game proceed without using saved settings.
				throw new IllegalArgumentException("Error in DestroyApp:try setValue (1)");
			}
			try
			{
				planeBaos = gameManager.getPlaneData();
				Settings.setValue(Settings.GM_PLANE_DATA, planeBaos);
			}
			catch(Exception e)
			{
				// We can not do anything to recover from this error,
				// let the game proceed without using saved settings.
				throw new IllegalArgumentException("Error in DestroyApp:try setValue (2)");
			}
			try
			{
				bombBaos = gameManager.getBombData();
				Settings.setValue(Settings.GM_BOMB_DATA, bombBaos);
			}
			catch(Exception e)
			{
				// We can not do anything to recover from this error,
				// let the game proceed without using saved settings.
				throw new IllegalArgumentException("Error in DestroyApp:try setValue (3)");
			}
			try
			{
				buildingBaos = gameManager.getBuildingData();
				Settings.setValue(Settings.GM_BUILD_DATA, buildingBaos);
			}
			catch(Exception e)
			{
				// We can not do anything to recover from this error,
				// let the game proceed without using saved settings.
				throw new IllegalArgumentException("Error in DestroyApp:try setValue (3)");
			}
			gameManager.stop();
        	}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合九色综合97婷婷| 亚洲精品国产一区二区三区四区在线| 精品国产一区二区亚洲人成毛片 | 美女性感视频久久| 国产.精品.日韩.另类.中文.在线.播放| av一区二区三区在线| 欧美一级在线免费| 亚洲国产wwwccc36天堂| 成人视屏免费看| 精品国产区一区| 视频一区视频二区中文| 日本精品视频一区二区| 久久精品日产第一区二区三区高清版 | 国产精品欧美综合在线| 男人的天堂久久精品| 欧美性色黄大片| 亚洲视频你懂的| 成人av在线一区二区三区| 日韩欧美美女一区二区三区| 午夜电影久久久| 欧美午夜精品久久久| 亚洲色图清纯唯美| av中文字幕亚洲| 国产三级久久久| 国产一区二区三区免费观看| 日韩欧美国产三级| 奇米一区二区三区av| 欧美日韩国产电影| 午夜视黄欧洲亚洲| 91 com成人网| 日韩电影免费一区| 欧美精品乱码久久久久久| 亚洲第四色夜色| 欧美日韩日本视频| 日日嗨av一区二区三区四区| 欧美军同video69gay| 亚洲国产人成综合网站| 欧美亚洲动漫另类| 亚洲成av人片在线观看| 欧美日韩日日骚| 麻豆91精品视频| 久久无码av三级| 国产成人午夜99999| 欧美高清在线一区二区| 成人黄色小视频在线观看| 中文字幕一区av| 色94色欧美sute亚洲线路一久| 亚洲精品成人精品456| 欧洲激情一区二区| 亚洲午夜电影在线| 精品国产成人在线影院| 国产mv日韩mv欧美| 一区二区三区四区视频精品免费 | 亚洲 欧美综合在线网络| 欧美高清性hdvideosex| 久久99精品视频| 国产精品三级电影| 欧美日韩免费观看一区三区| 免费黄网站欧美| 国产精品理伦片| 欧美日韩视频不卡| 国产精品一区二区在线观看网站| 国产精品午夜在线观看| 欧美日韩亚洲综合在线| 国产黄色91视频| 亚洲一区二区av电影| 日韩免费一区二区三区在线播放| 成人黄色国产精品网站大全在线免费观看 | 香蕉久久一区二区不卡无毒影院 | 亚洲美女淫视频| 日韩限制级电影在线观看| 国产999精品久久| 亚洲一区二区精品久久av| 久久久综合视频| 91在线观看高清| 日本vs亚洲vs韩国一区三区| 国产精品免费av| 日韩欧美你懂的| 欧美日韩三级一区| 91丨九色丨黑人外教| 看片网站欧美日韩| 一级精品视频在线观看宜春院| 欧美精品一区二区三区高清aⅴ| 91免费看片在线观看| 九九**精品视频免费播放| 亚洲人成在线播放网站岛国 | 欧美在线制服丝袜| 国产精品123区| 日本视频一区二区| 一卡二卡三卡日韩欧美| 国产精品久久夜| 久久久久久久久岛国免费| 欧美日韩日日摸| 日本韩国一区二区三区视频| 国产乱码字幕精品高清av| 日日夜夜精品免费视频| 中文字幕一区在线观看视频| 精品国产精品网麻豆系列| 制服丝袜激情欧洲亚洲| 91精品办公室少妇高潮对白| 成人一道本在线| 国产高清在线精品| 美女视频一区在线观看| 天堂一区二区在线免费观看| 一区二区三区中文免费| 18成人在线观看| 国产精品国产自产拍高清av| 国产午夜精品理论片a级大结局| 日韩一级完整毛片| 51久久夜色精品国产麻豆| 欧美裸体bbwbbwbbw| 欧美三级韩国三级日本一级| 欧美午夜精品一区二区三区| 欧美综合久久久| 欧美亚州韩日在线看免费版国语版| 色欧美乱欧美15图片| 99久久精品免费看国产 | 亚洲精选一二三| 成人免费小视频| 亚洲影院久久精品| 亚洲第一成年网| 青青草97国产精品免费观看 | 久久久99精品久久| 久久久久久9999| 国产欧美日韩久久| 中文字幕国产精品一区二区| 国产精品久久久久婷婷二区次| 中文字幕一区二区日韩精品绯色| 国产精品污网站| 综合久久综合久久| 亚洲国产日日夜夜| 蜜桃一区二区三区四区| 九九国产精品视频| 不卡在线视频中文字幕| 色婷婷国产精品| 91精品国产综合久久国产大片| 日韩免费视频线观看| 国产校园另类小说区| 亚洲品质自拍视频| 日韩精品欧美成人高清一区二区| 久久狠狠亚洲综合| 9人人澡人人爽人人精品| 在线观看视频一区二区| 精品噜噜噜噜久久久久久久久试看| 久久先锋影音av鲁色资源网| 中文字幕亚洲视频| 日日骚欧美日韩| 成人黄色国产精品网站大全在线免费观看 | 在线综合视频播放| 久久亚洲综合色| 亚洲另类中文字| 激情av综合网| 色网综合在线观看| 精品日韩欧美一区二区| 综合久久久久久| 免费看欧美美女黄的网站| 91亚洲资源网| 精品理论电影在线观看| 亚洲制服欧美中文字幕中文字幕| 麻豆国产欧美日韩综合精品二区| 成人涩涩免费视频| 91精品国模一区二区三区| 国产精品进线69影院| 久久超碰97人人做人人爱| 91成人免费在线| 久久精品无码一区二区三区| 午夜国产精品影院在线观看| 成人不卡免费av| 日韩精品一区二区三区在线观看| 亚洲欧美激情在线| 国产一区二区三区国产| 欧美精品成人一区二区三区四区| 国产嫩草影院久久久久| 青草av.久久免费一区| 欧美午夜不卡视频| 欧美国产禁国产网站cc| 免费观看91视频大全| 在线观看日韩精品| 中文字幕av一区二区三区高| 欧美96一区二区免费视频| 欧美亚洲一区二区在线观看| 国产精品久久免费看| 国产大陆a不卡| 久久综合色一综合色88| 亚洲一区二区三区三| 色综合视频在线观看| 国产日本一区二区| 黄页网站大全一区二区| 日韩美女一区二区三区| 日韩成人一区二区三区在线观看| 91传媒视频在线播放| 亚洲欧美日韩国产综合在线| 成人免费高清视频| 国产三级欧美三级| 成人免费视频网站在线观看| 国产嫩草影院久久久久| 国产99精品国产| 18欧美亚洲精品| 色乱码一区二区三区88| 亚洲午夜av在线|