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

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

?? resourcemanager.java

?? 還記得兒時在游戲機上玩坦克大戰(zhàn)嗎?如今這種經典游戲不在游戲機上玩了
?? JAVA
字號:
//------------------------------------------------------------------------------
//                         COPYRIGHT 2007 GUIDEBEE
//                           ALL RIGHTS RESERVED.
//                     GUIDEBEE CONFIDENTIAL PROPRIETARY
///////////////////////////////////// REVISIONS ////////////////////////////////
// Date       Name                 Tracking #         Description
// ---------  -------------------  ----------         --------------------------
// 15JAN2008  James Shen                 	      Initial Creation
////////////////////////////////////////////////////////////////////////////////
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//The Software shall be used for Good, not Evil.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
//Any questions, feel free to drop me a mail at james.shen@guidebee.biz.
//--------------------------------- PACKAGE ------------------------------------
package com.pstreets.game.battlecity;

//--------------------------------- IMPORTS ------------------------------------
import java.io.*;
import java.util.*;
import javax.microedition.media.*;
import javax.microedition.lcdui.*;

//[------------------------------ MAIN CLASS ----------------------------------]
////////////////////////////////////////////////////////////////////////////////
//--------------------------------- REVISIONS ----------------------------------
// Date       Name                 Tracking #         Description
// --------   -------------------  -------------      --------------------------
// 15JAN2008  James Shen                 	      Initial Creation
////////////////////////////////////////////////////////////////////////////////
/**
 * Resource Manager.A Singleton class used to mananger images and wav/midi 
 * resources.
 * <p>
 * <hr><b>&copy; Copyright 2008 Guidebee, Inc. All Rights Reserved.</b>
 * @version     1.00, 15/01/08
 * @author      Guidebee, Inc.
 */
public class ResourceManager {
    
    /**
     * the maximum game level.
     */
    public static final int MAX_GAME_LEVEL=50;
    /**
     * game level index, for simplicity ,the game  use chinese character as
     * the battle field setting.
     */
    public static int[] gameLevels=new int[MAX_GAME_LEVEL];
    
    /**
     * The width/height of each tile.
     */
    public static final int TILE_WIDTH=12;
    
    /**
     * Bonus images.
     */
    public static final int BONUS=0;
    
    /**
     * Explode images.
     */
    public static final int EXPLODE=1;
    
    /**
     * Bullet images.
     */
    public static final int BULLET=2;
    
    /**
     * Player tank images.
     */
    public static final int PLAYER=3;
    
    /**
     * Enemy tank images.
     */
    public static final int ENEMY=4;
    
    /**
     * Splash screen
     */
    public static final int SPLASH=10;
    
    /**
     * Score screen
     */
    public static final int SCORE_SCREEN=11;
    
    /**
     * First player tanks.
     */
    public static final int IP=12;
    
    /**
     * Level 
     */
    public static final int FLAG=13;
    
    /**
     * enemy tanks icon in score bar.
     */
    public static final int ENEMY_ICON=14;
    
    /**
     * white numbers.
     */
    public static final int NUMBER_WHITE=15;
    
    /**
     * red numbers.
     */
    public static final int NUMBER_RED=16;
    
    /**
     * Big game over image
     */
    public static final int GAME_OVER_BIG=17;
    
    /**
     * small game over image
     */
    public static final int GAME_OVER_SMALL=18;
    
    /**
     * small numbers for scores.
     */
    public static final int SCORE=19;
    
    /**
     * game pause
     */
    public static final int PAUSE=20;
    
    /**
     * numbers in black.
     */
    public static final int NUMBER_BLACK=21;
    
    /**
     * Stage image
     */
    public static final int STAGE=22;
    
    /**
     * turn on sound
     */
    public static final int TURN_SOUND=23;
    
    /**
     * game help
     */
    public static final int GAME_HELP=27;
    
    /**
     * Guidebee logo
     */
    public static final int GUIDEBEE_LOGO=28;
    
    /**
     * playing sound ?
     */
    public static boolean isPlayingSound=false;
    
    /**
     * Score board sound.
     */
    public static final int SCORE_SOUND=1;
    
    /**
     * Open game sound
     */
    public static final int OPEN_SOUND=2;
    
    /**
     * Game over sound
     */
    public static final int GAMEOVER_SOUND=0;
    
    /**
     * Explode sound.
     */
    public static final int EXPLODE_SOUND=4;
    
    /**
     * Shooting sound index.
     */
    public static final int SHOOT_SOUND=3;
    
    /**
     * current visiable screen.
     */
    public static Displayable currentScreen=null;
    
    /**
     * the display object.
     */
    public static Display theDisplay=null;
    
    //here using static object to avoid creating screen object each time. 
    /**
     * the start screen object.
     */
    public static StartScreen startScreen=null;
    
    /**
     * the splash screen object.
     */
    public static SplashScreen splashScreen=null;
    
    /**
     * the game scene object.
     */
    public static GameScene gameScene=null;
    
    /**
     * the score board screen object.
     */
    public static ScoreScreen scoreScreen=null;
    
    /**
     * the game over screen.
     */
    public static GameoverScreen gameoverScreen=null;
    
    /**
     * the stage screen.
     */
    public static StageScreen stageScreen=null;
    
    /**
     * current game level.
     */
    public static int gameLevel=1;
    
    /**
     * the highest score.
     */
    public static int highScore=20000;
    
    /**
     * Singleton instance
     */
    private static ResourceManager instance=new ResourceManager();
    
    /**
     * image array.
     */
    private static Image[]imageResources=new Image[29];
    
    /**
     * tile image
     */
    private static Image tileImage=null;
    
    /**
     * sound data
     */
    private static byte[][]soundResouces=new byte[5][];
    
    /**
     * Sound player object.
     */
    private static Player player=null;
    
    
    /**
     * load image and sound resouces
     */
    static{
        try{
            int imageIndex=0;
            for(int i=1;i<=5;i++){
                String fileName="/img" +i;
                InputStream is =instance.getClass().getResourceAsStream(fileName);
                DataInputStream dis=new DataInputStream(is);
                while(dis.available()>0){
                    int pngLength=dis.readInt();
                    byte []buffer=new byte[pngLength];
                    dis.read(buffer);
                    imageResources[imageIndex++]=Image.createImage(buffer,
                            0,pngLength);
                }
                dis.close();
                is.close();
             }
            imageResources[GUIDEBEE_LOGO]=Image.createImage(instance.getClass().
                    getResourceAsStream("/guidebee.png"));
            
            tileImage=Image.createImage(72,TILE_WIDTH/2);
            Graphics g=tileImage.getGraphics();
            int imgWidth=0;
            for(int i=5;i<10;i++){
                g.drawImage(imageResources[i],imgWidth,0,0);
                imgWidth+=imageResources[i].getWidth();
            }
            for(int i=5;i<10;i++){
               imageResources[i]=null; 
            }
            System.gc();
            for(int i=1;i<=5;i++){
                String fileName="/snd" +i;
                InputStream is =instance.getClass().getResourceAsStream(fileName);
                int sndLength=is.available();
                soundResouces[i-1]=new byte[sndLength];
                is.read(soundResouces[i-1]);
                is.close();
            } 
            System.gc();
            
        }catch(IOException e){
            System.out.println("Error reading resources");
        }
        //initialize the game index
        Random rnd=new Random();
        for(int i=0;i<MAX_GAME_LEVEL;i++){
           gameLevels[i]=Math.abs(rnd.nextInt()) % 6840;  
        }
        //guidebee soft.
        gameLevels[1]=3384;
        gameLevels[2]=1810;
        gameLevels[3]=821;
        gameLevels[4]=2428;
        gameLevels[5]=1317;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 17JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * set an new screen.
     */
    public static void setCurrentScreen(Displayable newScreen){
        currentScreen=newScreen;
        theDisplay.setCurrent(currentScreen);
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 17JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Get the tile image.
     * @return the battle field tile image.
     */
    public Image getTileImage(){
        return tileImage;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 17JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Get image resource.
     * @param index the image resource index.
     * @return the image.
     */
    public Image getImage(int index){
        return imageResources[index];
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 17JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Play sound.
     * @param type the sound type.
     */
    public static void playSound(int type){
        
        ByteArrayInputStream inputstream;
        String soundType="audio/midi";
        if(type>2) {
            soundType="audio/x-wav";
            return;
        }
        try{
            inputstream=new ByteArrayInputStream(soundResouces[type]);
            if(player!=null){
                player.close();
            }
            player = Manager.createPlayer(inputstream, soundType);
            player.start();
        } catch(Exception e){
            System.out.println("No wav");
        }
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 15JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * Get an unique instance of resource manager.
     * @return an instance of resource manager.
     */
    public static  ResourceManager getInstance(){
        return instance;
    }
    
    ////////////////////////////////////////////////////////////////////////////
    //--------------------------------- REVISIONS ------------------------------
    // Date       Name                 Tracking #         Description
    // ---------  -------------------  -------------      ----------------------
    // 15JAN2008  James Shen                 	          Initial Creation 
    ////////////////////////////////////////////////////////////////////////////
    /**
     * private constructor to avoid to be instnaced directly.
     */
    private ResourceManager(){
        
    }
    
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品免费在线播放| 久久色.com| 婷婷中文字幕综合| 日韩三级av在线播放| 国产九九视频一区二区三区| 国产精品久久久久aaaa| 色哟哟亚洲精品| 日本不卡一区二区| 中日韩av电影| 在线成人高清不卡| 国产美女在线观看一区| 久久免费电影网| av中文一区二区三区| 亚洲人成网站在线| 欧美熟乱第一页| 日本欧美一区二区三区| 久久久久久久久岛国免费| 日本丰满少妇一区二区三区| 麻豆精品久久久| 亚洲综合偷拍欧美一区色| 国产亚洲美州欧州综合国| 欧日韩精品视频| 极品美女销魂一区二区三区| 日韩伦理免费电影| 日韩精品综合一本久道在线视频| 不卡免费追剧大全电视剧网站| 日韩电影网1区2区| 国产欧美日韩另类一区| 欧美军同video69gay| 91麻豆文化传媒在线观看| 国产一区二区三区视频在线播放| 亚洲成av人片在线| 亚洲精品写真福利| 久久一区二区三区国产精品| 91麻豆.com| 国产精品 日产精品 欧美精品| 一区二区在线观看av| 国产欧美日韩在线视频| 日韩一区二区精品葵司在线| 91丝袜国产在线播放| 日韩一区精品字幕| 国产精品福利影院| 国产欧美日韩在线看| 精品成人在线观看| 欧美精品在线一区二区三区| 一本一道久久a久久精品| 国产精品99久| 久久99精品一区二区三区| 香蕉久久夜色精品国产使用方法 | 一区在线观看视频| 久久五月婷婷丁香社区| 日韩网站在线看片你懂的| 4438成人网| 欧美在线观看视频一区二区| 97se亚洲国产综合在线| 91片在线免费观看| 91黄色小视频| 欧美电视剧免费全集观看| 欧美xxxx在线观看| 精品美女被调教视频大全网站| 日韩一级高清毛片| 国产婷婷一区二区| 成人欧美一区二区三区小说| 一区二区三区丝袜| 亚洲女人小视频在线观看| 国产精品国产三级国产有无不卡| 国产精品视频在线看| 玉足女爽爽91| 美女视频免费一区| 成人在线综合网| 在线一区二区三区| 欧美成人女星排名| 国产欧美精品一区二区三区四区| 国产精品伦一区二区三级视频| 国产欧美一区二区精品忘忧草| 国产精品欧美精品| 中文字幕亚洲不卡| 亚洲一区在线视频| 久久国产精品99久久人人澡| 99精品欧美一区二区三区小说 | 亚洲视频在线一区观看| 三级在线观看一区二区| 成人午夜免费视频| 欧美高清视频一二三区| 久久青草欧美一区二区三区| av不卡在线观看| 欧美无乱码久久久免费午夜一区| 精品久久国产老人久久综合| 国产精品久久久久影院亚瑟| 日韩高清中文字幕一区| 不卡的av中国片| 91精品在线观看入口| 亚洲色图丝袜美腿| 麻豆精品一区二区综合av| 91九色02白丝porn| 国产精品看片你懂得| 狠狠色丁香久久婷婷综合丁香| 色综合视频一区二区三区高清| 日韩欧美一区在线观看| 亚洲国产精品一区二区久久 | 欧美第一区第二区| 午夜精品久久久久久久久久久| 色综合久久综合网欧美综合网| 久久久久久久久久看片| 蜜臀精品久久久久久蜜臀| 欧美午夜不卡在线观看免费| 亚洲欧美激情小说另类| 春色校园综合激情亚洲| 久久午夜电影网| 黄网站免费久久| 欧美男女性生活在线直播观看| 一区二区视频在线看| 91在线视频播放地址| 亚洲图片欧美一区| 欧美精品日日鲁夜夜添| 日韩1区2区3区| 日韩欧美国产一区二区三区 | 中文字幕国产一区二区| 国产一区二三区好的| 久久婷婷国产综合精品青草 | 日韩欧美高清dvd碟片| 久久国产精品72免费观看| 欧美第一区第二区| 国产精品18久久久久久久久久久久| 久久亚洲综合色| 国产成人亚洲综合a∨婷婷图片| 国产情人综合久久777777| 成人精品一区二区三区中文字幕 | 日本不卡免费在线视频| 精品日韩99亚洲| 国产成人精品一区二区三区四区 | 一本一道波多野结衣一区二区| 亚洲精品久久久蜜桃| 综合av第一页| 欧美日本一区二区在线观看| 日本一不卡视频| 久久精品亚洲精品国产欧美kt∨| 91麻豆免费看| 精品一区二区三区视频在线观看| 国产精品久久久久久久久果冻传媒 | 欧美最猛黑人xxxxx猛交| 久久av中文字幕片| 一区二区高清免费观看影视大全| 欧美成人video| av在线这里只有精品| 日韩高清中文字幕一区| 中文字幕欧美国产| 欧美色中文字幕| 成人免费黄色在线| 麻豆成人91精品二区三区| 99久久99久久精品免费观看| 日本中文字幕不卡| 一区在线中文字幕| 久久香蕉国产线看观看99| 91视频.com| 成人黄色国产精品网站大全在线免费观看| 亚洲自拍偷拍图区| 国产精品欧美一区喷水| 日韩一区二区在线播放| 欧美午夜电影一区| 色综合天天视频在线观看| 久久97超碰色| 欧美日韩免费在线视频| 岛国一区二区在线观看| 久久99久久99| 久久99国产精品尤物| 日韩电影在线观看网站| 亚洲在线观看免费| 一区二区三区在线观看网站| 国产精品乱码妇女bbbb| 国产亚洲欧美中文| 欧美α欧美αv大片| 日韩精品一区二区三区中文不卡 | 亚洲欧美一区二区三区极速播放| 欧美国产丝袜视频| 中文字幕亚洲欧美在线不卡| 欧美激情综合在线| 国产婷婷色一区二区三区四区| 精品国产第一区二区三区观看体验 | 久久色在线观看| 亚洲欧洲日韩一区二区三区| 欧美精选一区二区| 在线观看中文字幕不卡| 欧美在线不卡一区| 欧美精品丝袜中出| 亚洲一区二区不卡免费| 亚洲免费在线电影| 亚洲成人激情社区| 国模套图日韩精品一区二区| 国产精品18久久久久久久久| av电影在线观看一区| 欧美日韩一区 二区 三区 久久精品| 欧美日韩一区二区在线观看| 日韩亚洲欧美在线| 久久精品亚洲一区二区三区浴池| 亚洲视频在线观看三级| 日韩激情视频网站| 成人黄色av电影| 制服丝袜亚洲播放| 国产精品白丝在线|