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

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

?? pushpuzzlecanvas.java

?? 名稱:games
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * * Copyright ? 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */package example.pushpuzzle;import java.io.*;import javax.microedition.lcdui.*;import javax.microedition.lcdui.game.*;import javax.microedition.media.*;import javax.microedition.media.control.ToneControl;import javax.microedition.midlet.*;/** * PushPuzzleCanvas displays the game board and handles key events. * The PushPuzzle game logic and algorithms are separated into Board.java. * PushPuzzleCanvas does not setup or use any Commands.  Commands for each * screen and listeners should be setup outside this class. * PushPuzzleCanvas generates a SELECT_COMMAND when the current level * is solved. Sequencing through screens is done in the PushPuzzle MIDlet. * <p> * PushPuzzleCanvas handles the reading, initialization, and sequencing * of individual puzzle screens. * <p> * PushPuzzleCanvas uses the Score class to restore and save game levels * and scores for each level. To display the scores use getScoreScreen. * It will be initialized with the current scores. * To select a new level use the getLevelScreen and gotoLevel * methods. * <p> * PushPuzzleCanvas handled key events for LEFT, RIGHT, UP, and DOWN to * move the pusher in the game board.  Pointer pressed events * are used to move the pusher to the target location (if possible). * <p> */class PushPuzzleCanvas extends GameCanvas implements Runnable {    /** Background color */    private static int groundColor = 0xff8080;    /** Pan Rate; number of milliseconds between screen updates */    private static final int PanRate = 50;    private static final int GroundColor0 = 0xffffff;    private static final int PacketColor0 = 0xff6d00;    private static final int StoreColor0 = 0xb60055;    private static final int WallColor0 = 0x006D55;    private static final int PusherColor0 = 0x6d6dff;    /** The current level */    private int level = 1;    /** The current theme index */    private int theme;    /** True if the level has been solved */    private boolean solved;    /** number of pixels per cell (updated by readscreen) */    private int cell = 1;    /** The width of the canvas */    private int width;    /** The height of the canvas */    private int height;    /** The width of the board */    private int bwidth;    /** The height of the board */    private int bheight;    /** The board containing the location of each packet, ground, walls, etc */    private Board board;    /** The score object */    private Score score;    /** The main MIDlet */    private PushPuzzle pushpuzzle;    /** The Display of this MIDlet */    private Display display;    /** The listener used to report solved events */    private CommandListener listener;    /** The form for score display */    private Form scoreForm; // form for scores    /** The TextBox to input new level numbers */    private TextBox levelText; // for input of new level    /** The index in the image of the Ground */    public final int TILE_GROUND = 1;    /** The index in the image of the Packet */    public final int TILE_PACKET = 2;    /** The index in the image of the Store */    public final int TILE_STORE = 3;    /** The index in the image of the Wall */    public final int TILE_WALL = 4;    /** The index in the image of the Pusher */    public final int TILE_PUSHER = 5;    /** Background image */    private Image themeImage;    /** Tiles forming the background */    private TiledLayer tiles;    /** The Sprite that is the pusher */    private Sprite sprite;    /** Layer manager */    private LayerManager layers;    /** Thread used for key handling and animation */    private Thread thread;    /** The target cell for runTo */    private int targetx;    /** The target cell for runTo */    private int targety;    /** The Tone player */    private Player tonePlayer;    /** The ToneController */    private ToneControl toneControl;    /** Tune to play when puzzle level is solved. */    private byte[] solvedTune = { ToneControl.VERSION, 1, 74, 8, // 1/8 note            75, 8, 73, 8 };    /** Tune to play when a packet enters a store */    private byte[] storedTune = { ToneControl.VERSION, 1, 50, 8, // 1/8 note            60, 8, 70, 8 };    /**     * Construct a new canvas     * @param pushpuzzle the main MIDlet     * @param s the score object     */    public PushPuzzleCanvas(PushPuzzle pushpuzzle, Score s) {        super(false); // Don't suppress key events        this.pushpuzzle = pushpuzzle;        display = Display.getDisplay(pushpuzzle);        score = s;        board = new Board();        layers = new LayerManager();        setupTheme();        targetx = targety = -1;        height = getHeight();        width = getWidth();    }    /**     * Read the previous level number from the score file.     * Read in the level data.     */    public void init() {        // Read the last level; if it can't be found, revert to level 0        theme = score.getTheme();        setupTheme();        level = score.getLevel();        if (!readScreen(level)) {            level = 0;            readScreen(level);        }    }    /**     * Cleanup and destroy.     */    public void destroy() {        hideNotify();    }    /**     * Figure out which set of icons to use based on the colors     */    private void initColors() {        boolean isColor = display.isColor();        int numColors = display.numColors();        if (isColor) {        } else {            if (numColors > 2) {            } else {            }        }    }    /**     * Change themes.     * Cycle to the next index and try it     */    public void changeTheme() {        theme++;        setupTheme();        score.setLevel(level, theme); // save the level and theme        setupTiles();        updateSprite(0);    }    /**     * Undo the last move if possible. Redraw the cell     * the pusher occupies after the undone move and the cells     * in the direction of the original move.     * Here so undo can be triggered by a command.     */    public void undoMove() {        int pos = board.getPusherLocation();        int dir = board.undoMove();        if (dir >= 0) {            updateTilesNear(pos, dir);            updateSprite(dir);        }        solved = board.solved();    }    /**     * Restart the current level.     */    public void restartLevel() {        readScreen(level);        solved = false;    }    /**     * Start the next level.     * @param offset of the next level     * @return true if the new level was loaded     */    public boolean nextLevel(int offset) {        updateScores(); // save best scores         if (((level + offset) >= 0) && readScreen(level + offset)) {            level += offset;            score.setLevel(level, theme);            solved = false;            return true;        }        return false;    }    /**     * Get the current level.     * @return the current level.     */    public int getLevel() {        return level;    }    /**     * Get a screen to let the user change the level.     * A simple numeric TextBox will do.     * @return the textbox used to change the level number     */    public Screen getLevelScreen() {        if (levelText == null) {            levelText =                new TextBox("Enter Level", Integer.toString(level), // default                    4, TextField.NUMERIC);        } else {            levelText.setString(Integer.toString(level));        }        return levelText;    }    /**     * Go to the chosen Level.     * @return true if the new level was loaded.     */    public boolean gotoLevel() {        if (levelText != null) {            String s = levelText.getString();            int l;            try {                l = Integer.parseInt(s);            } catch (java.lang.NumberFormatException e) {                return false;            }            updateScores();            if ((l >= 0) && readScreen(l)) {                level = l;                score.setLevel(level, theme);                solved = false;                return true;            }        }        return false;    }    /**     * Read and setup the next level.     * Opens the resource file with the name "/Screen.<lev>"     * and tells the board to read from the stream.     * <STRONG>Must be called only with the board locked.</STRONG>     * @param lev the level number to read.     * @return true if the reading of the level worked, false otherwise.     */    private boolean readScreen(int lev) {        if (lev <= 0) {            board.screen0(); // Initialize the default zero screen.        } else {            InputStream is = null;            try {                is = getClass().getResourceAsStream("/example/pushpuzzle/data/screen." + lev);                if (is != null) {                    board.read(is, lev);                    is.close();                } else {                    System.out.println("Could not find the game board for level " + lev);                    return false;                }            } catch (java.io.IOException ex) {                return false;            }        }        bwidth = board.getWidth();        bheight = board.getHeight();        setupTiles();        updateSprite(0);        return true;    }    /**     * Create the Tiled layer to represent the current board.     */    private void setupTiles() {        if (tiles != null) {            layers.remove(tiles);        }        // Figure out how many cells are needed to cover canvas.        int w = ((width + cell) - 1) / cell;        int h = ((height + cell) - 1) / cell;        tiles = new TiledLayer((w > bwidth) ? w : bwidth, (h > bheight) ? h : bheight, themeImage,                cell, cell);        /** Fill it all with background */        tiles.fillCells(0, 0, w, h, TILE_GROUND);        // Initialize the background tileset        for (int y = 0; y < bheight; y++) {            for (int x = 0; x < bwidth; x++) {                updateTile(x, y);            }        }        layers.append(tiles);    }    /**     * Update the tile at the location.     * @param x the offset of the tile to update     * @param y the offset of the tile to update     */    private void updateTile(int x, int y) {        int tile = 0;        byte v = board.get(x, y);        switch (v & ~Board.PUSHER) {        case Board.WALL:            tile = TILE_WALL;            break;        case Board.PACKET:        case Board.PACKET | Board.STORE:            tile = TILE_PACKET;            break;        case Board.STORE:            tile = TILE_STORE;            break;        case Board.GROUND:default:            tile = TILE_GROUND;        }        tiles.setCell(x, y, tile);    }    /**     * Setup Theme-0 generated to match screen     * size and board size.     */    private void setupTheme0() {        int bwidth = board.getWidth();        int bheight = board.getHeight();        int w = getWidth();        int h = getHeight(); // height of Canvas        cell = (((h - 14) / bheight) < (w / bwidth)) ? ((h - 14) / bheight) : (w / bwidth);        // Create a mutable image and initialize        themeImage = Image.createImage(cell * 5, cell);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美另类小说| 亚洲激情中文1区| 91小视频在线| 蜜臀久久久99精品久久久久久| 国产欧美一区二区在线| 欧美日韩一区二区三区不卡 | 日本视频免费一区| 欧美国产日韩亚洲一区| 欧美一区二区在线免费播放| 波多野结衣一区二区三区| 免费在线成人网| 一区二区国产视频| 国产精品久久久久一区二区三区 | 久久久久久久久久久99999| 欧美午夜精品一区二区三区| 国产91富婆露脸刺激对白| 天天操天天综合网| 中文字幕一区二区三区四区不卡| 欧美成人激情免费网| 日本精品视频一区二区三区| 成人午夜在线播放| 激情小说亚洲一区| 日本欧美一区二区三区| 亚洲国产精品久久不卡毛片| 亚洲人被黑人高潮完整版| 国产午夜精品久久久久久久 | 日本中文字幕一区二区有限公司| 亚洲精品免费一二三区| 国产精品美女久久久久久| 日韩精品一区国产麻豆| 欧美丰满少妇xxxxx高潮对白| 色婷婷一区二区| 91美女视频网站| 不卡电影一区二区三区| 成人动漫一区二区在线| 国产高清不卡二三区| 激情文学综合丁香| 国产制服丝袜一区| 国模冰冰炮一区二区| 另类综合日韩欧美亚洲| 国产伦理精品不卡| 国产999精品久久| 国产欧美日韩视频一区二区| 亚洲精品日韩一| 激情五月婷婷综合网| 久久影音资源网| 国产一区欧美二区| 久久精品人人爽人人爽| 大胆亚洲人体视频| 日韩码欧中文字| 在线观看日韩毛片| 免费高清成人在线| 久久久久久久久久久黄色| 成人va在线观看| 亚洲永久免费视频| 日韩欧美一区在线| 国产精品18久久久久久久久久久久 | 波多野结衣欧美| 最近中文字幕一区二区三区| 色综合久久中文综合久久97| 婷婷国产v国产偷v亚洲高清| 日韩精品最新网址| 成人av电影在线网| 亚洲福利视频一区二区| 日韩一区二区三区在线| 国产毛片精品国产一区二区三区| 国产精品久久99| 欧美日韩国产a| 国产东北露脸精品视频| 一区二区三区四区蜜桃| 91精品国产综合久久福利软件 | 日本系列欧美系列| 欧美国产精品劲爆| 欧美精品一二三四| 国产成人自拍网| 亚洲五月六月丁香激情| 久久久国际精品| 欧美日韩一级视频| 成人三级在线视频| 三级在线观看一区二区| 国产日韩v精品一区二区| 欧美亚洲动漫精品| 高潮精品一区videoshd| 秋霞av亚洲一区二区三| 日韩码欧中文字| 精品1区2区在线观看| 欧美中文字幕一区二区三区亚洲| 国产精一区二区三区| 亚洲香蕉伊在人在线观| 国产精品美女久久久久久久久久久| 91精品啪在线观看国产60岁| 91啪亚洲精品| 高清国产一区二区| 免费成人在线视频观看| 亚洲一二三专区| 国产精品美女久久久久久2018| 欧美一激情一区二区三区| 在线日韩一区二区| 北岛玲一区二区三区四区 | 亚洲国产精品视频| 亚洲日本一区二区| 国产精品二区一区二区aⅴ污介绍| 日韩欧美国产不卡| 5月丁香婷婷综合| 欧美最新大片在线看| 91美女精品福利| zzijzzij亚洲日本少妇熟睡| 国产电影精品久久禁18| 精品系列免费在线观看| 日韩av中文在线观看| 丝袜美腿亚洲色图| 天天av天天翘天天综合网| 亚洲激情成人在线| 亚洲免费观看在线视频| 成人欧美一区二区三区白人| 国产精品视频第一区| 国产精品视频一二三区| 欧美激情一区二区三区全黄| 国产调教视频一区| 中文字幕精品三区| 综合久久综合久久| 亚洲色图色小说| 亚洲女人的天堂| 亚洲成av人片在线| 亚洲gay无套男同| 首页国产欧美日韩丝袜| 日本强好片久久久久久aaa| 免费精品视频在线| 国产一区二区三区免费播放| 国产自产2019最新不卡| 成人性生交大片免费看中文网站| 成人福利视频网站| 99久久免费精品高清特色大片| 97se亚洲国产综合自在线| 在线视频欧美精品| 91精品福利在线一区二区三区| 91精品国产综合久久精品| 精品国产一区二区三区忘忧草| 国产亚洲制服色| 中文字幕在线不卡一区二区三区 | 中文字幕欧美国产| 日韩理论片中文av| 亚洲国产日韩一区二区| 婷婷久久综合九色国产成人| 精品一区二区三区不卡| 国产精品2024| 欧美性色aⅴ视频一区日韩精品| 欧美一区三区二区| 亚洲国产高清在线观看视频| 亚洲男同性视频| 久久精品国产**网站演员| 国产成人免费9x9x人网站视频| 91浏览器打开| 日韩精品一区二区三区在线观看| 国产欧美日韩三级| 亚洲123区在线观看| 国产99久久久精品| 欧美精品电影在线播放| 亚洲国产高清在线观看视频| 香蕉成人啪国产精品视频综合网| 激情小说亚洲一区| 一本久道久久综合中文字幕| 91精品国产欧美一区二区| 国产精品欧美一级免费| 日韩成人av影视| 色婷婷综合中文久久一本| 日韩一本二本av| 一二三区精品视频| 国产在线看一区| 欧美日韩精品一区视频| 日本一区二区久久| 青青草原综合久久大伊人精品 | 91精品国产综合久久久久久久久久| 久久综合久久综合久久综合| 洋洋成人永久网站入口| 国产高清一区日本| 7777精品伊人久久久大香线蕉的| 国产精品三级视频| 久久99久久久久| 欧美人伦禁忌dvd放荡欲情| 国产精品麻豆久久久| 经典三级在线一区| 7777精品伊人久久久大香线蕉最新版 | 亚洲成人av在线电影| 国产成人免费高清| 久久女同互慰一区二区三区| 蜜臀av性久久久久av蜜臀妖精| 欧美日韩久久不卡| 亚洲一二三级电影| 一本色道久久综合亚洲精品按摩| 国产欧美综合在线| 国产伦精一区二区三区| 精品国产一区二区国模嫣然| 日本视频中文字幕一区二区三区| 在线观看日韩国产| 亚洲一区精品在线| 99久久99久久精品免费观看| 国产精品国产三级国产专播品爱网| 国产麻豆9l精品三级站| 欧美精品一区二区三区高清aⅴ |