亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
久久精品国产99国产| 亚洲免费成人av| 精品国产百合女同互慰| 欧美大度的电影原声| 日韩精品最新网址| 久久久久久免费| 中文字幕不卡的av| 欧美国产日韩a欧美在线观看| 国产欧美一区二区在线| 国产精品每日更新| 亚洲一区二区在线观看视频| 性欧美疯狂xxxxbbbb| 久久综合综合久久综合| 国产大陆精品国产| 91亚洲资源网| 欧美一区二区在线免费播放 | 精品久久一区二区| 日韩美女久久久| 蜜臀精品久久久久久蜜臀| 成人av手机在线观看| 欧美一区二区日韩一区二区| 久久久久久久久伊人| 亚洲大片免费看| 成人美女视频在线观看| 欧美一二三四区在线| 一区二区三区四区精品在线视频| 久久疯狂做爰流白浆xx| 在线观看国产日韩| 亚洲欧洲日本在线| 高清在线不卡av| 日韩一区二区三免费高清| 亚洲精品免费电影| 成人免费三级在线| 国产偷国产偷亚洲高清人白洁 | 欧美一级日韩不卡播放免费| 亚洲三级免费观看| 色综合久久久网| 中文字幕亚洲一区二区va在线| 秋霞午夜av一区二区三区| 欧美日韩高清一区二区三区| 中文字幕一区二区三区乱码在线| 国产大陆精品国产| 国产日韩欧美在线一区| 国产99久久久久久免费看农村| 欧美大片在线观看一区二区| 日韩国产欧美三级| 91精品国产福利在线观看| 亚洲h动漫在线| 日韩午夜小视频| 国产一区二区三区av电影 | 国产一区二区网址| 久久久久久影视| 99国产精品久久久久久久久久| 亚洲电影欧美电影有声小说| 91视频观看视频| 青青青爽久久午夜综合久久午夜| 4438x亚洲最大成人网| 老汉av免费一区二区三区| 欧美大片一区二区| 成人黄色网址在线观看| 亚洲一区二区三区激情| 欧美大片在线观看一区| 91麻豆产精品久久久久久| 婷婷成人综合网| 中文字幕av一区二区三区免费看| 在线视频一区二区免费| 久久99蜜桃精品| 亚洲成人中文在线| 欧美激情一区在线观看| 欧美精品 国产精品| 成人精品电影在线观看| 成人丝袜18视频在线观看| 美女视频免费一区| 亚洲色图.com| 亚洲欧美视频在线观看| 国产天堂亚洲国产碰碰| 日韩欧美在线123| 欧美丝袜丝nylons| 一本到不卡免费一区二区| 国产一区二区伦理| 国产美女精品人人做人人爽| 蜜臀av性久久久久蜜臀aⅴ | 色综合天天视频在线观看| 丁香婷婷综合五月| 成人免费看的视频| av亚洲精华国产精华| 99久久国产免费看| 色综合色综合色综合色综合色综合 | 亚洲一区二区在线免费观看视频 | 成人国产在线观看| 国产成人av电影免费在线观看| 久久精品久久综合| 国产精品18久久久久久久久久久久| 久久国产精品第一页| 日韩亚洲欧美一区二区三区| 欧美日韩第一区日日骚| 婷婷国产v国产偷v亚洲高清| 国产农村妇女毛片精品久久麻豆| 精品久久久久久无| 亚洲综合网站在线观看| 中文字幕免费一区| 91精品国产色综合久久不卡电影 | 久久精品国产亚洲一区二区三区| 日韩欧美一二三区| 99精品视频中文字幕| 日韩av在线发布| 亚洲一区二区三区四区在线| 91.麻豆视频| 懂色av一区二区三区免费观看| 亚洲香肠在线观看| 亚洲综合免费观看高清在线观看| 精品国产一区二区亚洲人成毛片 | 麻豆精品视频在线| 亚洲一区二区三区四区在线观看| 国产亚洲精久久久久久| 日韩视频国产视频| 欧美日韩国产一区二区三区地区| 国产精品99久久久久久久女警 | 国产精品欧美久久久久无广告| 欧美一区二区福利在线| 欧美日韩在线免费视频| 在线看不卡av| 在线免费不卡电影| 日韩欧美一区在线观看| 久久这里只有精品首页| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 国产精品一区二区在线观看不卡 | 久久91精品国产91久久小草| 蜜臀va亚洲va欧美va天堂| 亚洲国产中文字幕在线视频综合| 亚洲美女区一区| 天天亚洲美女在线视频| 久久国产生活片100| 国产成人在线免费| 欧美日韩在线电影| 久久综合色综合88| 亚洲精品水蜜桃| 国产激情一区二区三区| 欧美日韩一区二区三区四区五区| 欧美一三区三区四区免费在线看 | 国产精品久久久久久一区二区三区| 国产精品成人在线观看| 日本午夜精品视频在线观看| 高清成人在线观看| 91精品视频网| 一区二区三区不卡在线观看 | 成人av网址在线观看| 欧美精品日韩精品| 亚洲精品欧美二区三区中文字幕| 日本不卡一区二区三区高清视频| av激情综合网| 欧美激情一区二区三区在线| 日韩福利电影在线| 91成人在线精品| 亚洲欧洲韩国日本视频| 国产黑丝在线一区二区三区| 欧美一二三区精品| 日日骚欧美日韩| 在线播放中文字幕一区| 亚洲一级不卡视频| 欧美日韩中文国产| 国产成人在线电影| 一区二区三区国产精华| 一本到不卡精品视频在线观看| 337p日本欧洲亚洲大胆色噜噜| 国产三级欧美三级日产三级99| 亚洲三级在线播放| av综合在线播放| 日韩一区中文字幕| 国产成人午夜电影网| 色噜噜狠狠色综合欧洲selulu| 日韩欧美在线不卡| 国产夫妻精品视频| 亚洲丝袜另类动漫二区| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 国产在线精品免费av| 国产日韩欧美电影| 在线免费精品视频| 日本在线不卡视频一二三区| 久久久夜色精品亚洲| 日韩电影在线免费| 亚洲自拍偷拍图区| 国产成人精品免费视频网站| 亚洲欧美在线高清| 一本大道久久a久久精品综合| 国产日韩欧美在线一区| 97se亚洲国产综合自在线| 亚洲一卡二卡三卡四卡| 久久这里只有精品视频网| 欧美亚洲综合一区| 国产成人亚洲综合a∨婷婷图片| 亚洲激情综合网| 国产精品网站在线播放| 欧美一级日韩免费不卡| 日本精品视频一区二区| 国产99久久久久| 福利一区二区在线| 国产精品一卡二| 国产一区二区三区免费| 国产自产v一区二区三区c|