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

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

?? gamescreen.java

?? J2ME MIDP_Example_Applications
?? JAVA
?? 第 1 頁 / 共 2 頁
字號(hào):
// Copyright 2002 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.


package example.fruitmachine;

import javax.microedition.lcdui.*;
import java.io.IOException;


class GameScreen
    extends Canvas
    implements CommandListener, Runnable, HttpPosterListener
{
    private final FruitMachineMIDlet midlet;
    private final HttpPoster httpPoster;
    private final Account account;
    private final Display display;
    
    private final Command changeBetCommand;
    private final Command buyCreditCommand;
    private final Command spinCommand;
    private final Command quitCommand;

    private static final int BAR = 0;
    private static final int BELL = 1;
    private static final int ORANGE = 2;
    private static final int LEMON = 3;
    private static final int PLUM = 4;
    private static final int CHERRY = 5;

    private Image[] images = new Image[6];
    private final Image holdImage;
    private Image[] holdButtonImages = new Image[3];
    private static final int wheelValues[] =
    {
        BAR, ORANGE, LEMON, PLUM, CHERRY,
        BELL, ORANGE, LEMON, PLUM, CHERRY,
        BELL, ORANGE, LEMON, PLUM, CHERRY,
        BELL, ORANGE, LEMON, PLUM, CHERRY
    };
    private static final int NUM_WHEELS = 3;
    private static final int VALUES_PER_WHEEL = wheelValues.length;

    private boolean hold[] = new boolean[NUM_WHEELS];  // initially false
    private int wheelPosition[] = new int[NUM_WHEELS];
    private int fasterTicks[] = new int[NUM_WHEELS];
    private int slowerTicks[] = new int[NUM_WHEELS];
    private int spindownTicks[] = new int[NUM_WHEELS];
    private static final int spinSpeed[] = {8, 9, 7}; // pixels/tick:full speed
    private static final int TICK_TIME_MILLIS = 100;
    private static final int SPINDOWN_STEP = 4;  // ticks at each slower speed

    // if not a new spin, can't increase bet AND hold, so have to
    // record previous bet
    private boolean newSpin = true;
    private int previousBet;

    private static final int IMAGE_SPACING = 2;  // between wheels on screen
    private static final int BORDER_SPACING = 2;   // between wheels & border
    private static final int BORDER_THICKNESS = 2;  // thickness of box
    private static final int HOLD_SPACING = 2;  // between box & hold icons
    private int imageWidth;
    private int imageHeight;
    private int wheelHeight;

    // state of animation thread
    private volatile boolean aborting = false;   // set true to exit animation
    private volatile boolean spinning = false;
    private boolean spinningFreely = false;
    private final Thread animationThread;

    // state of UI
    private volatile boolean readyForInput = true;
    private boolean quitting = false;

    // if we're animating the slowing down of the wheels because the server
    // has told us whether it was a win or loss, we save the information here
    private boolean wasWin;
    private int winAmount;
    private int updatedCredit;


    GameScreen(FruitMachineMIDlet midlet,
               HttpPoster httpPoster,
               Account account,
               Display display,
               Image barImage,
               Image bellImage,
               Image orangeImage,
               Image lemonImage,
               Image plumImage,
               Image cherryImage,
               Image holdImage,
               Image hold1Image,
               Image hold2Image,
               Image hold3Image)
    {
        this.midlet = midlet;
        this.httpPoster = httpPoster;
        this.account = account;
        this.display = display;

        images[BAR] = barImage;
        images[BELL] = bellImage;
        images[ORANGE] = orangeImage;
        images[LEMON] = lemonImage;
        images[PLUM] = plumImage;
        images[CHERRY] = cherryImage;
        this.holdImage = holdImage;
        holdButtonImages[0] = hold1Image;
        holdButtonImages[1] = hold2Image;
        holdButtonImages[2] = hold3Image;

        imageWidth = barImage.getWidth();    // assume all same size !
        imageHeight = barImage.getHeight();
        wheelHeight = wheelValues.length * imageHeight;

        changeBetCommand = new Command("Change Bet", Command.SCREEN, 3);
        addCommand(changeBetCommand);
        buyCreditCommand = new Command("Buy Credit", Command.SCREEN, 3);
        addCommand(buyCreditCommand);
        spinCommand = new Command("Spin", Command.SCREEN, 1);
        addCommand(spinCommand);
        // don't make this Command.QUIT, since we don't want it winning over
        // "Spin" !
        quitCommand = new Command("Quit", Command.SCREEN, 4);
        addCommand(quitCommand);

        setInvalidEndPositions();

        setCommandListener(this);

        animationThread = new Thread(this);
        animationThread.start();   // initially just waits for a notification
    }


    // this method is used by our animation thread
    public void run()
    {
        while (!aborting)
        {
            while (!spinning && !aborting)
            {
                try
                {
                    synchronized (this)
                    {
                        wait();
                    }
                }
                catch (InterruptedException e)
                {
                }
            }
            if (!aborting)
            {
                // we're animating; spin one step and sleep a while
                spin();
                repaint(0, 0, getWidth(), getHeight());
                try
                {
                    Thread.currentThread().sleep(TICK_TIME_MILLIS);
                }
                catch (InterruptedException e)
                {
                }
            }
        }
    }


    private void spin()
    {
        boolean endOfSpin = true;
        // this should not happen at the same time as the updates of
        // these values by other means
        synchronized (wheelPosition)
        {
            for (int i = 0; i < NUM_WHEELS; ++i)
            {
                if (! hold[i])
                {
                    if (spinningFreely)
                    {
                        endOfSpin = false;
                        stepWheel(i, spinSpeed[i]);
                    }
                    else if (fasterTicks[i] > 0)
                    {
                        endOfSpin = false;
                        stepWheel(i, spinSpeed[i]);
                        fasterTicks[i]--;
                    }
                    else if (slowerTicks[i] > 0)
                    {
                        endOfSpin = false;
                        stepWheel(i, spinSpeed[i] - 1);
                        slowerTicks[i]--;
                    }
                    else if (spindownTicks[i] > 0)
                    {
                        endOfSpin = false;
                        stepWheel(i,
                                  (spindownTicks[i] + SPINDOWN_STEP - 1) /
                                                               SPINDOWN_STEP);
                        spindownTicks[i]--;
                    }
                }
            }
        }
        if (endOfSpin)
        {
            spinning = false;
            account.setCredit(updatedCredit);
            if (wasWin)
            {
                clearHolds();
                newSpin = true;
                WinScreen.showWin(winAmount);
            }
            else
            {
                newSpin = false;
                previousBet = account.getCurrentBet();
            }
            readyForInput = true;
        }
    }


    private void stepWheel(int i, int step)
    {
        wheelPosition[i] = (wheelPosition[i] + step) % wheelHeight;
    }


    // for tidying up only
    public void abort()
    {
        aborting = true;
        synchronized (this)
        {
            notify();    // wake up our animation thread and kill it
        }
    }
    
    
    // called by the UI thread
    public void paint(Graphics g)
    {
        int width = getWidth();
        int height = getHeight();
        g.setClip(0, 0, width, height);

        // fill background with black
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, width, height);

        // draw a box in yellow
        int wheelBoxWidth = imageWidth * NUM_WHEELS +
                            IMAGE_SPACING * (NUM_WHEELS - 1);
        int maxWheelBoxHeight = height - BORDER_SPACING * 2
                                   - BORDER_THICKNESS * 2
                                   - HOLD_SPACING - holdImage.getHeight() - 2;
        int wheelBoxHeight = imageHeight * 2;
        if (wheelBoxHeight > maxWheelBoxHeight)
        {
            wheelBoxHeight = maxWheelBoxHeight;  // might have to shrink it
        }
        int borderBoxWidth = wheelBoxWidth +
                            BORDER_SPACING * 2 +
                            BORDER_THICKNESS * 2;
        int borderBoxHeight = wheelBoxHeight +
                             BORDER_SPACING * 2 +
                             BORDER_THICKNESS * 2;
        int rectLeft = (width - borderBoxWidth) / 2;
        int rectTop = (height  - borderBoxHeight
                        - HOLD_SPACING - holdImage.getHeight()) / 2;
        g.setColor(255, 255, 0);
        for (int i = 0; i < BORDER_THICKNESS; ++i)
        {
            g.drawRect(rectLeft + i,
                       rectTop + i,
                       borderBoxWidth - 2 * i - 1,
                       borderBoxHeight - 2 * i - 1);
        }

        // draw hold signs if in use
        int holdTop = rectTop + borderBoxHeight + HOLD_SPACING;
        int holdLeft = rectLeft + BORDER_THICKNESS + BORDER_SPACING;
        g.setColor(255, 255, 255);
        for (int i = 0; i < NUM_WHEELS; ++ i)
        {
            int signLeft = holdLeft + i * (imageWidth + IMAGE_SPACING);
            if (hold[i])
            {
                g.drawImage(holdImage,
                            signLeft,
                            holdTop,
                            Graphics.TOP | Graphics.LEFT);
            }
            else
            {
                g.drawImage(holdButtonImages[i],
                            signLeft,
                            holdTop,
                            Graphics.TOP | Graphics.LEFT);
            }
        }

        // draw wheels
        int wheelBoxLeft = rectLeft + BORDER_THICKNESS + BORDER_SPACING;
        int wheelBoxTop = rectTop + BORDER_THICKNESS + BORDER_SPACING;
        int wheelImageTop = wheelBoxTop - (imageHeight - wheelBoxHeight/2);
        g.setClip(wheelBoxLeft, wheelBoxTop, wheelBoxWidth, wheelBoxHeight);
        for (int i = 0; i < NUM_WHEELS; ++i)
        {
            int centrePosition = wheelPosition[i] + imageHeight / 2;
            int wheelLeft = wheelBoxLeft + i * (imageWidth + IMAGE_SPACING);
            int centreImageNumber =
                (centrePosition / imageHeight) % VALUES_PER_WHEEL;
            int centreImageTopOffset = wheelImageTop +
                                             centrePosition % imageHeight;
            g.drawImage(images[wheelValues[centreImageNumber]],
                        wheelLeft,
                        centreImageTopOffset,
                        Graphics.TOP | Graphics.LEFT);
            int topImageNumber = (centreImageNumber + 1) %
                                                  wheelValues.length;
            int topImageTopOffset = centreImageTopOffset - imageHeight;
            g.drawImage(images[wheelValues[topImageNumber]],
                        wheelLeft,
                        topImageTopOffset,
                        Graphics.TOP | Graphics.LEFT);
            int bottomImageNumber = 
                (centreImageNumber + wheelValues.length - 1) %
                                                  wheelValues.length;
            int bottomImageTopOffset = centreImageTopOffset + imageHeight;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亚洲综合一区在线观看| 制服.丝袜.亚洲.中文.综合| 国产成人精品www牛牛影视| 国产高清无密码一区二区三区| 国产成人av电影在线播放| 国产999精品久久| 色婷婷av一区| 欧美精品久久天天躁| 久久一日本道色综合| 国产精品国产三级国产aⅴ中文 | 99精品久久99久久久久| 国产精品网曝门| 亚洲激情图片一区| 国产一区二区三区电影在线观看| 在线亚洲免费视频| 欧美一卡2卡三卡4卡5免费| 日韩欧美国产一区二区三区| 久久久久久久久久久久久夜| 亚洲美女区一区| 同产精品九九九| 国产一区二区h| 欧美亚洲尤物久久| 日韩av午夜在线观看| 欧美日韩国产首页| 精品成人私密视频| 亚洲精品高清在线观看| 麻豆精品视频在线观看免费| 99视频热这里只有精品免费| 91精品国产手机| 日韩一区中文字幕| 久久电影网电视剧免费观看| 91免费看片在线观看| 欧美成人乱码一区二区三区| 亚洲精品福利视频网站| 国产一区二区三区电影在线观看| 日本精品免费观看高清观看| 久久久www免费人成精品| 亚洲天堂网中文字| 波多野结衣在线aⅴ中文字幕不卡| 精品福利一区二区三区| 亚洲一区二区三区四区五区中文| 国内精品在线播放| 欧美精品在欧美一区二区少妇| 91精品国产综合久久精品app | 精品精品欲导航| 亚洲资源中文字幕| 91色porny| 国产精品网站一区| 成人av动漫网站| 欧美一级夜夜爽| 亚洲成人av中文| av在线不卡网| 日韩一区在线免费观看| 日韩欧美电影一区| 午夜国产精品一区| 91福利小视频| 中文字幕欧美一区| 高清国产一区二区| 久久免费视频一区| 精品亚洲欧美一区| 日韩免费高清视频| 日本成人中文字幕| 在线不卡一区二区| 同产精品九九九| 欧美精品免费视频| 五月激情六月综合| 精品视频在线免费看| 一区二区三区精品在线| 色综合一个色综合| 亚洲日本在线观看| 色综合天天视频在线观看 | 久久精品国产成人一区二区三区| 欧美三级日韩三级国产三级| 亚洲制服丝袜一区| 欧美视频自拍偷拍| 亚洲成av人片一区二区梦乃| 欧美视频日韩视频在线观看| 亚洲一区二区欧美激情| 欧美色网站导航| 婷婷久久综合九色国产成人| 欧美喷潮久久久xxxxx| 亚洲国产一区视频| 3d成人h动漫网站入口| 日本不卡一区二区| 欧美tickling挠脚心丨vk| 韩国成人精品a∨在线观看| 久久日一线二线三线suv| 国产精品一卡二| 国产精品国产三级国产三级人妇| 国产福利一区二区三区| 日本色综合中文字幕| 中文字幕在线不卡一区| 欧美岛国在线观看| 色拍拍在线精品视频8848| 国内精品国产成人| 欧美一区二区视频在线观看 | 精品成人佐山爱一区二区| av高清不卡在线| 国产一区 二区 三区一级| 婷婷中文字幕一区三区| 美洲天堂一区二卡三卡四卡视频| 日韩欧美在线1卡| 国产成人亚洲综合a∨婷婷| 国产精品久久久久久户外露出 | 制服丝袜亚洲网站| 国内久久婷婷综合| 亚洲日本在线a| 91精品国产高清一区二区三区蜜臀| 久久99精品久久只有精品| 久久精品视频在线免费观看 | 一区二区三区四区不卡视频| 欧美日韩精品一区二区天天拍小说| 日本欧美一区二区| 国产午夜一区二区三区| 一本色道久久综合亚洲91| 日日嗨av一区二区三区四区| 2020国产精品久久精品美国| 不卡一区在线观看| 日韩精品电影在线| 中文字幕成人av| 欧美日精品一区视频| 捆绑调教美女网站视频一区| 国产精品乱人伦| 7777精品伊人久久久大香线蕉| 国产传媒日韩欧美成人| 亚洲图片欧美一区| 国产调教视频一区| 欧美一二三区在线观看| 久久综合狠狠综合久久综合88| av电影一区二区| 青娱乐精品视频| 亚洲日本欧美天堂| 亚洲精品在线免费观看视频| 色妞www精品视频| 国产在线观看一区二区| 亚洲最大的成人av| 国产网站一区二区| 欧美一级高清片在线观看| 99国产一区二区三精品乱码| 麻豆免费看一区二区三区| 亚洲天堂成人网| 久久无码av三级| 欧美一区二区三区免费大片| 亚洲精品一区二区三区99| 久久99精品一区二区三区三区| bt7086福利一区国产| 日韩欧美视频在线 | 欧美日韩成人一区| 精品福利在线导航| 亚洲超碰精品一区二区| 国产福利精品一区| 欧美日韩在线播| 欧美激情一区二区三区四区| 美女在线视频一区| 97se亚洲国产综合自在线| 久久机这里只有精品| 亚洲午夜激情网站| 欧美国产日韩一二三区| 日韩欧美一区在线| 在线观看日韩一区| 99国产精品一区| 国产99久久久国产精品潘金网站| 七七婷婷婷婷精品国产| 亚洲国产精品久久久久秋霞影院| 国产精品家庭影院| 久久久精品欧美丰满| 欧美变态凌虐bdsm| 欧美群妇大交群中文字幕| 日本福利一区二区| 色综合天天综合网天天看片| 成人禁用看黄a在线| 国产成人精品午夜视频免费| 精品制服美女久久| 久久99国产精品久久| 美女精品自拍一二三四| 日本中文字幕一区二区视频| 日韩精品高清不卡| 久久综合久久综合九色| 欧美视频一区二区三区四区 | 99精品欧美一区| 国产激情一区二区三区四区| 国内成人免费视频| 日本高清不卡在线观看| 色综合天天综合网天天看片| 91丝袜高跟美女视频| 成人午夜碰碰视频| 国产成+人+日韩+欧美+亚洲| 岛国精品一区二区| av动漫一区二区| 色综合久久中文综合久久97| 91在线观看高清| 在线免费观看视频一区| 欧美日韩一区三区| 一区二区三区欧美日韩| 久久中文字幕电影| 日韩精品电影在线观看| 奇米在线7777在线精品| 久久草av在线| 国产精品一区二区久久精品爱涩 | 日韩亚洲欧美成人一区|