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

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

?? gamemanager.java

?? J2ME MIDP_Example_Applications
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
// Copyright 2003 Nokia Corporation.
//
// THIS SOURCE CODE IS PROVIDED 'AS IS', WITH NO WARRANTIES WHATSOEVER,
// EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS
// FOR ANY PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE
// OR TRADE PRACTICE, RELATING TO THE SOURCE CODE OR ANY WARRANTY OTHERWISE
// ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE AND WITH NO
// OBLIGATION OF NOKIA TO PROVIDE THE LICENSEE WITH ANY MAINTENANCE OR
// SUPPORT. FURTHERMORE, NOKIA MAKES NO WARRANTY THAT EXERCISE OF THE
// RIGHTS GRANTED HEREUNDER DOES NOT INFRINGE OR MAY NOT CAUSE INFRINGEMENT
// OF ANY PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OWNED OR CONTROLLED
// BY THIRD PARTIES
//
// Furthermore, information provided in this source code is preliminary,
// and may be changed substantially prior to final release. Nokia Corporation
// retains the right to make changes to this source code at
// any time, without notice. This source code is provided for informational
// purposes only.
//
// Nokia and Nokia Connecting People are registered trademarks of Nokia
// Corporation.
// Java and all Java-based marks are trademarks or registered trademarks of
// Sun Microsystems, Inc.
// Other product and company names mentioned herein may be trademarks or
// trade names of their respective owners.
//
// A non-exclusive, non-transferable, worldwide, limited license is hereby
// granted to the Licensee to download, print, reproduce and modify the
// source code. The licensee has the right to market, sell, distribute and
// make available the source code in original or modified form only when
// incorporated into the programs developed by the Licensee. No other
// license, express or implied, by estoppel or otherwise, to any other
// intellectual property rights is granted herein.


import java.util.Vector;
import javax.microedition.lcdui.*;


// GameManager is used by CloseableCanvas or NokiaCloseableCanvas.
// (BlockGameMIDlet creates a CloseableCanvas or NokiaCloseableCanvas
// depending on the capabilities of the MIDP device where the MIDlet
// was downloaded.)
//
// This GameManager tries to be as portable as possible. It doesn't
// use any drawing feature of the Nokia UI API's FullCanvas that an
// ordinary MIDP Canvas API doesn't support, other than the basic
// 'full canvas' property of FullCanvas.

class GameManager
    implements Runnable
{
    // When either side gets GAME_OVER_SCORE points, the game ends.
    final static int GAME_OVER_SCORE = 100;
    final static int MILLIS_PER_TICK = 250; // msec
    final static int MAX_CHANNELS = 8; // 8 channels of blocks
    final static int MAX_BLOCK_HEIGHT = 10; // 10 pixels
    final static int MAX_PLAYER_LIVES = 5; // 5 lives

    private final static int MAX_PIXELS = 200;
    private final static Font GAME_FONT =
        Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);

    private final int gameWidth;
    private final int gameHeight;
    private final BlockGameMIDlet midlet;
    private final Dictionary dict;
    private final Canvas canvas;
    private final Vector blocks = new Vector();
    private final Base base;
    private final DoublyLinkedList bullets = new DoublyLinkedList();
    private final GameEffects gameEffects;
    private final boolean useLimitedFiringRate;

    private volatile Thread animationThread = null;
    // hasBeenShown could be set by Canvas.showNotify()
    private boolean hasBeenShown = false;
    private volatile boolean isPaused = false;
    private boolean isGameOver = false;
    private int gameOverTicks = 0;
    private int baseScore = 0;
    private int blocksScore = 0;

    // The text labels for the player's score and the base's 'lives count',
    // take up a bit too much screen space on small displays. As the label
    // text itself is rather static, we only show the label text for
    // 'showLabelTicks' (7.5 seconds). Similarly, the base's 'lives count'
    // also changes slowly.
    private int showLabelTicks = (7500 / GameManager.MILLIS_PER_TICK);


    GameManager(BlockGameMIDlet midlet, Dictionary dict,
        GameEffects gameEffects, Canvas canvas)
    {
        this.midlet = midlet;
        this.dict = dict;
        this.canvas = canvas;
        this.gameEffects = gameEffects;

        useLimitedFiringRate = midlet.useLimitedFiringRate();

        // Limit the maximum size of the game to be 200 x 200 pixels.
        // This is for better game play on MIDP devices with a larger
        // resolution. (For example on devices which are very much wider
        // than long, it otherwise takes too long for the blocks to fly from
        // right to left, and for the bullets to fly from left to right.)
        gameWidth  = (canvas.getWidth() < MAX_PIXELS) ?
                     canvas.getWidth() : MAX_PIXELS;
        gameHeight = (canvas.getHeight() < MAX_PIXELS) ?
                     canvas.getHeight() : MAX_PIXELS;


        // A block is a square that is 'dimension' pixels high
        // and 'dimension' pixels wide. The dimension of a block
        // is one of the basic properties which affects how the game
        // looks. (Note: the base's size also depends on this parameter
        // as we'd like the base and blocks to be about the same size.)
        //
        // The screen height is divided into 'MAX_CHANNELS' or less channels.
        // The blocks fly left down the channels. The following figure
        // helps to illustrate:
        //   --------------------------------------------
        //      yOffset |                       ^
        //              +---+  ^                | channelHeight
        //              +   +  | blockHeight    |
        //              +---+  v                |
        //                                      v
        //   ----------------------------------------------
        // There is one block per channel.

        int numChannels = MAX_CHANNELS;

        if (gameHeight < gameWidth)
        {
            numChannels = (gameHeight * numChannels) / gameWidth;
        }

        int channelHeight = gameHeight / numChannels;
        // Set the blockHeight to be 70 % of channelHeight
        // to leave some space between blocks.
        int blockHeight = ((70 * channelHeight) / 100);
        int yOffset = (channelHeight - blockHeight) / 2;

        if ((numChannels < MAX_CHANNELS) &&
            (blockHeight < MAX_BLOCK_HEIGHT))
        {
            // For smaller screens, the blockHeight (dimension) should
            // be at least some minimum pixel size, otherwise the blocks
            // and base feel too small.

            // channel height equals block height
            blockHeight = MAX_BLOCK_HEIGHT;
            numChannels = gameHeight / blockHeight;
            yOffset = 0;
        }
        Block.setDimension(blockHeight); // set dimension for all Blocks


        // Picking a dx value that is independent of gameWidth + blockWidth
        // and that works well for a variety of screen sizes is a bit tricky,
        // because for the smallest device screen widths the game uses
        // a minimum pixel size (which may also reduce the number
        // of channels) rather than a constant ratio of blockWidth to
        // gameWidth for all screen sizes. Also, on taller screens
        // the user may have to spend more time moving up and down
        // than on shorter screens (e.g. if there are 8 channels of blocks
        // rather than 6 channels on a smaller device). This is result of not
        // making the game scale proportional to the height and width of
        // the screen, for all possible screen sizes.
        //
        // The block speed should not be either annoyingly fast or slow
        // on a range of real devices.

        int dx;

        if (numChannels < MAX_CHANNELS)
        {
            dx = -(gameWidth / (3 * Block.getDimension()));
        }
        else
        {
            dx = -(gameWidth / (4 * Block.getDimension()));
        }
        if (dx == 0)
        {
            dx = -1;
        }

        for (int channel = 0; channel < numChannels; channel++)
        {
            Block block = new Block(this, 0, gameWidth,
                (yOffset + (channel * channelHeight)), dx);

            blocks.addElement(block);
        }

        int playerLives = MAX_PLAYER_LIVES;

        base = new Base(this, useLimitedFiringRate, playerLives, 0, 0,
                        gameWidth, gameHeight);
    }


    boolean isGameOver()
    {
        return isGameOver;
    }


    private boolean baseIsWinning()
    {
        return ((base.getLives() > 0) && (baseScore >= blocksScore));
    }


    private void tick()
    {
        if (isGameOver)
        {
            // 1) The game is over.

            // When the game is over, wait 30 seconds before stopping the
            // animation thread. This gives the draw method a chance to wait
            // a few seconds before displaying a message that prompts the user
            // to press a softkey to return to the MainMenu. It also gives the
            // 'game over' tune some time to play.)
            if (gameOverTicks < (30000 / MILLIS_PER_TICK))
            {
                gameOverTicks++;

                // When the game is over, wait 1 second before playing
                // the game over music
                if (gameEffects.hasSoundCapability() &&
                    (gameOverTicks == (1000 / MILLIS_PER_TICK)))
                {
                    boolean hasPlayerWon = (baseScore >= blocksScore);

                    gameEffects.playGameOverMusic(hasPlayerWon);
                }
            }
            else
            {
                // 30 seconds has passed, stop the animation thread, etc.
                stop();
            }
        }
        else if ((base.getLives() == 0) || (baseScore >= GAME_OVER_SCORE) ||
            (blocksScore >= GAME_OVER_SCORE))
        {
            // 2) Detect and set the 'game over' state.

            // Setting isGameOver to 'true' causes the 'if (isGameOver)'
            // block of code above, to be executed on subsequent ticks.

            isGameOver = true;
            gameOverTicks = 0;
        }
        else
        {
            // 3) The game is still playing.

            // showLabelTicks is used by the draw method to print
            // longer or shorter text messages indicating the current score,
            // lives, etc. When the game first starts, longer versions
            // (with explanatory labels) are printed. When the tick
            // counts reach zero, shorter versions are printed
            // (so more of the screen is visible during playing of the game).
            if (showLabelTicks > 0)
            {
                showLabelTicks--;
            }

            // Base tick
            base.tick();


            // Bullets' ticks
            Bullet b = (Bullet) (bullets.getFirst());
            Bullet prev = null;

            while (b != null)
            {
                b.tick();
                prev = b;
                b = (Bullet) (bullets.getNext(b));
                if (!prev.isActive())
                {
                    bullets.remove(prev);
                }
            }

            // Blocks' ticks
            for (int ix = 0; ix < blocks.size(); ix++)
            {
                Block block = (Block) blocks.elementAt(ix);

                block.tick();

                // Check for bullet collisions
                b = (Bullet) (bullets.getFirst());
                while (b != null)
                {
                    if (block.isCollision(b))
                    {
                        if (block.doBulletCollision())
                        {
                            // true: the block exploded in the collision

                            baseScore += block.getPoints();
                            block.updateStrength(); // stronger next life
                            gameEffects.playBlockExplosion();
                        }
                        b.doExplode();
                    }
                    b = (Bullet) (bullets.getNext(b));
                }

                // Check for base collisions
                if (block.isCollision(base))
                {
                    int lives = base.getLives();

                    if (!base.isColliding())
                    {
                        // If the base is not already colliding with
                        // another block and is colliding with this block,
                        // then handle the base collision:
                        //   - inform base of collision
                        //   - get new 'base lives' count
                        //   - use GameEffects for explode noise + vibrate
                        base.doCollision();
                        gameEffects.playBaseExplosion();
                        gameEffects.vibrate();
                    }

                    // Handle block collision:
                    //   Blocks get more points for hitting the base,
                    //   than vice versa. Blocks get extra points
                    //   for completely destroying base (no lives left).
                    baseScore += block.getPoints();
                    if (lives == 0)
                    {
                        blocksScore += 20;
                    }
                    else
                    {
                        blocksScore += (2 * block.getPoints());
                    }
                    block.doExplode();
                    block.updateStrength(); // A stronger next life
                }
            }
        }
    }


    // Canvas methods

    public void paint(Graphics g)
    {
        if (isGameOver)
        {
            // Print an appropriate 'game over' message.

            int color;
            String winnerText;

            if (baseIsWinning())
            {
                color = Base.COLOR;
                winnerText = dict.getString(Dictionary.TEXT_GAME_YOU_WON);
            }
            else
            {
                color = Block.COLOR;
                winnerText = dict.getString(Dictionary.TEXT_GAME_YOU_LOST);
            }


            String lastText = null; // last line's default message

            if (gameOverTicks < (4000 / MILLIS_PER_TICK))
            {
                if (base.getLives() == 0)
                {
                    lastText =
                        dict.getString(Dictionary.TEXT_GAME_BASE_DESTROYED);
                }
            }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品gif动图一区| 国模冰冰炮一区二区| 精品亚洲成a人| 精品制服美女丁香| 制服丝袜亚洲精品中文字幕| 色综合久久久久网| 亚洲成人免费看| 欧美浪妇xxxx高跟鞋交| 琪琪一区二区三区| 久久综合色天天久久综合图片| 国产在线精品免费| 亚洲欧美日韩综合aⅴ视频| 欧美私模裸体表演在线观看| 麻豆精品一区二区三区| 日韩毛片高清在线播放| 欧美一级夜夜爽| 国产成人综合亚洲91猫咪| 裸体在线国模精品偷拍| 91在线国内视频| 日韩中文字幕亚洲一区二区va在线| www.欧美亚洲| 2021国产精品久久精品| 亚洲激情av在线| 亚洲激情一二三区| 国产精品一区专区| 精品免费国产一区二区三区四区| 亚洲午夜影视影院在线观看| 一本久道久久综合中文字幕| 亚洲国产成人私人影院tom| 老司机午夜精品| 精品人在线二区三区| 欧美色爱综合网| 成人综合在线观看| 国产91精品一区二区麻豆亚洲| 日韩高清一区在线| 亚洲欧美另类久久久精品2019| 欧美福利视频导航| 精品久久久网站| 国产亚洲自拍一区| 成人激情午夜影院| 亚洲制服欧美中文字幕中文字幕| 成人免费视频视频在线观看免费 | 成人妖精视频yjsp地址| 福利一区二区在线观看| 91色porny| 99久久国产综合精品麻豆| 免费人成黄页网站在线一区二区| 国产精品日日摸夜夜摸av| 欧美视频中文字幕| 欧美一区二区三区免费| 欧美一区二区视频在线观看2022 | 亚洲尤物视频在线| 国产**成人网毛片九色| 亚洲小说春色综合另类电影| 一区二区三区四区不卡在线| 亚洲在线中文字幕| jlzzjlzz欧美大全| 亚洲女厕所小便bbb| 国产视频在线观看一区二区三区 | 欧美丰满嫩嫩电影| 国产成人精品免费网站| 极品美女销魂一区二区三区免费| 91蜜桃免费观看视频| 国产sm精品调教视频网站| 成人免费视频网站在线观看| 欧美理论电影在线| 国产欧美精品在线观看| 亚洲永久免费视频| 国产在线精品免费| 99免费精品在线观看| 亚洲最色的网站| 日韩一区二区电影在线| 成人中文字幕电影| 石原莉奈在线亚洲二区| 欧美r级电影在线观看| 国产精品网站一区| 精品91自产拍在线观看一区| 亚洲欧洲在线观看av| 精品国产乱码久久久久久牛牛 | 夜夜嗨av一区二区三区| 欧美日韩第一区日日骚| 三级亚洲高清视频| 亚洲成人动漫在线免费观看| 亚洲欧美电影院| 亚洲精品日日夜夜| 亚洲一区av在线| 亚洲一区二区三区在线播放| 国产99一区视频免费| 精品一区二区三区在线观看国产| 日本成人在线网站| 国内不卡的二区三区中文字幕| 国产美女娇喘av呻吟久久| 成人一级黄色片| 色综合中文字幕国产| av一区二区三区四区| 91免费版pro下载短视频| 91美女片黄在线观看| 欧美中文字幕一区| 欧美一区二区在线观看| 久久久国产精品不卡| 国产精品大尺度| 亚洲综合图片区| 日本欧洲一区二区| 国产91丝袜在线播放| 91年精品国产| 欧美精品在线观看播放| 久久夜色精品一区| 中文字幕一区二区三区在线不卡 | 日韩精品成人一区二区三区| 久久国产人妖系列| 成人永久免费视频| 国产无一区二区| 精品在线一区二区三区| 国产老妇另类xxxxx| 成人综合激情网| 在线观看日韩电影| 日韩视频中午一区| 国产精品欧美一区喷水| 亚洲国产欧美日韩另类综合 | 精品视频1区2区3区| 亚洲男同性视频| 日韩综合小视频| 国产·精品毛片| 在线精品视频免费观看| 欧美日韩一卡二卡| 国产精品视频看| 日韩av中文字幕一区二区三区| 国产成人精品免费在线| 成人激情午夜影院| 欧美日韩国产小视频在线观看| 日韩亚洲欧美在线| 自拍偷拍亚洲欧美日韩| 首页综合国产亚洲丝袜| 97久久超碰精品国产| 久久久久久久久伊人| 免费在线观看视频一区| 不卡电影免费在线播放一区| 国产精品乱人伦一区二区| 男女男精品视频| 亚洲欧洲精品成人久久奇米网| 亚洲女人小视频在线观看| 欧美一区二区三区在线视频| 在线精品视频免费观看| 欧美大片一区二区| 久久欧美中文字幕| 婷婷久久综合九色国产成人| 成人一道本在线| 精品三级在线观看| 亚洲444eee在线观看| 99久久国产综合精品女不卡| 国产色婷婷亚洲99精品小说| 亚洲chinese男男1069| 91蜜桃在线观看| 亚洲国产成人午夜在线一区| 国内一区二区在线| 日韩一区二区在线看| 欧美变态凌虐bdsm| 麻豆国产精品一区二区三区| 91精品国产福利在线观看| 美女一区二区三区在线观看| 制服丝袜成人动漫| 日本美女一区二区三区视频| 日韩一区二区三区四区五区六区| 午夜精品久久久久影视| 91蜜桃网址入口| 蜜芽一区二区三区| 午夜久久久影院| 国产精品久久久99| 国产精品蜜臀av| 六月婷婷色综合| 欧美电影在线免费观看| 欧美性做爰猛烈叫床潮| 精品欧美久久久| 国产日韩欧美一区二区三区乱码 | 麻豆免费精品视频| 91精品国产品国语在线不卡| 56国语精品自产拍在线观看| 捆绑调教一区二区三区| 欧美变态口味重另类| 免费看欧美女人艹b| 国产精品成人网| 精品久久国产字幕高潮| 91行情网站电视在线观看高清版| 捆绑变态av一区二区三区| 国产午夜精品一区二区三区四区| 婷婷成人综合网| 日韩欧美色综合网站| 91福利社在线观看| 国产精品99久久久久久久女警| 国产亚洲一区二区三区四区| 91精品国产综合久久久久久漫画| 日韩电影一区二区三区四区| 久久免费看少妇高潮| 91精品综合久久久久久| 精品视频一区三区九区| 91蜜桃网址入口| 在线观看日韩毛片| 欧美人动与zoxxxx乱| 欧美日韩你懂的| 在线观看欧美黄色|