⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamecanvas.java

📁 K750手机游戏泡泡龙源代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                }

                GameCanvas _tmp6 = this;
                Bobble.sAID();
                pS = 1;
            }
            if(kF)
                if(kY == 52 && mV > 0)
                    mV--;
                else
                if(kY == 54 && mV < 42)
                    mV++;
            if(pS > 0)
            {
                drawBobbles(ofSg2, 0);
                repaint();
                serviceRepaints();
            }
            if(bAnim >= 10)
            {
                resumeFlag = true;
                if(upB)
                {
                    bobP = 3;
                    if(bAnim >= 30)
                        bAnim = 0;
                    else
                        bAnim++;
                } else
                if(byte0 == 1)
                {
                    byte0 = 2;
                    bobP = 2;
                    bAnim = 0;
                } else
                if(byte0 == 2)
                {
                    if(bAnim >= 30)
                    {
                        byte0 = 0;
                        bAnim = 0;
                    } else
                    {
                        bobP = 2;
                        bAnim++;
                    }
                } else
                {
                    byte0 = 1;
                    bobP = 1;
                    bAnim = 0;
                }
            } else
            {
                bAnim++;
                if(byte0 == 2)
                    bobP = 2;
            }
        }
        if(tgS == 1)
        {
            pS = -1;
            if(!dF)
            {
                for(int j1 = 8; j1 >= 0; j1--)
                {
                    try
                    {
                        Thread.sleep(10L);
                    }
                    catch(Exception exception3) { }
                    drawBobbles(ofSg2, j1);
                    if(j1 == 0)
                        drawGameOver(ofSg2);
                    repaint();
                    serviceRepaints();
                }

            }
            pS = -2;
        }
    }

    protected void keyPressed(int i)
    {
        int j = 0;
        int k = i;
        try
        {
            j = getGameAction(k);
        }
        catch(Exception exception) { }
        if(tgS == 0)
        {
            if(k == -6)
            {
                bgS = 0;
                tgS = 2;
                indeX = 0;
                repaint();
            } else
            if(k == -7)
                owM.exitApp();
            else
            if(k == 49 || j == 8)
            {
                init(mH, sE);
                tgS = 1;
                repaint();
                if(sD[0] != null && !sE)
                {
                    if(sD[0].getState() == 0)
                        sD[0].stop();
                    sD[0].play(1);
                }
            }
        } else
        if(tgS == 2)
        {
            if(k == -7)
            {
                if(indeX == 2)
                    indeX = 0;
                else
                    tgS = bgS;
                if(tgS == 1)
                {
                    pauseFlag = false;
                    resumeFlag = true;
                }
                repaint();
                serviceRepaints();
            } else
            if(k == -2)
            {
                if(indeX == 0)
                    indeX = 1;
                repaint();
            } else
            if(k == -1)
            {
                if(indeX == 1)
                    indeX = 0;
                repaint();
            } else
            if(j == 8)
                if(indeX == 0)
                {
                    sE = !sE;
                    setGConf(mH, sE);
                    saveData();
                    repaint();
                } else
                if(indeX == 1)
                {
                    indeX = 2;
                    Display.getDisplay(owM).setCurrent(hForm);
                }
        } else
        if(tgS == 1)
        {
            if(pS == -2)
            {
                if(k == -6)
                    retryPlease();
            } else
            if(k == -6)
            {
                bgS = 1;
                tgS = 2;
                pauseFlag = true;
                indeX = 0;
                repaint();
            }
            if(k == 50 || k == -1)
            {
                if(gF)
                    synchronized(this)
                    {
                        upA = true;
                    }
            } else
            if(k == -3 || k == -4)
            {
                if(gF)
                    if(k == -3 && mV > 0)
                        mV--;
                    else
                    if(k == -4 && mV < 42)
                        mV++;
            } else
            if(k == 52 || k == 54)
            {
                if(gF && !kF)
                {
                    kY = k;
                    kF = true;
                }
            } else
            if(k == 53 || j == 8)
            {
                if(gF && pS == 1)
                {
                    System.gc();
                    kF = false;
                    synchronized(this)
                    {
                        pS = 2;
                    }
                    GameCanvas _tmp = this;
                    Bobble.mD = mV;
                    sC++;
                    if(sD[2] != null && !sE)
                    {
                        if(sD[2].getState() == 0)
                            sD[2].stop();
                        sD[2].play(1);
                    }
                }
            } else
            if(k == -7)
            {
                setGConf(mH, sE);
                saveData();
                if(pS == -2)
                {
                    initTitle();
                    tgS = 0;
                    repaint();
                } else
                {
                    dF = true;
                    gF = false;
                    while(pS != -2) 
                        try
                        {
                            Thread.sleep(10L);
                        }
                        catch(Exception exception1) { }
                    initTitle();
                    tgS = 0;
                    repaint();
                }
            }
        }
    }

    protected void keyReleased(int i)
    {
        int j = 0;
        int k = i;
        try
        {
            j = getGameAction(k);
        }
        catch(Exception exception) { }
        if(k == 52 || k == 54)
            kF = false;
    }

    protected void keyRepeated(int i)
    {
        int j = 0;
        int k = i;
        try
        {
            j = getGameAction(k);
        }
        catch(Exception exception) { }
    }

    public void resumeMe()
    {
    }

    public void retryPlease()
    {
        init(mH, sE);
        repaint();
    }

    public void resumePlease()
    {
        if(tgS == 1)
        {
            resumeFlag = true;
            if(pS < 0)
            {
                drawBobbles(ofSg2, 0);
                drawGameOver(ofSg2);
            }
            repaint();
            serviceRepaints();
        } else
        {
            repaint();
        }
    }

    public void setGConf(int i, boolean flag)
    {
        mH = i;
        sE = flag;
    }

    public void saveData()
    {
        if(rStore == null)
            return;
        ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
        DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
        try
        {
            dataoutputstream.writeInt(mH);
            dataoutputstream.writeBoolean(sE);
        }
        catch(IOException ioexception) { }
        byte abyte0[] = bytearrayoutputstream.toByteArray();
        try
        {
            rStore.setRecord(1, abyte0, 0, abyte0.length);
        }
        catch(RecordStoreException recordstoreexception) { }
    }

    private void loadData()
    {
        if(rStore == null)
            return;
        Object obj = null;
        try
        {
            if(rStore.getNumRecords() == 0)
            {
                ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
                DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream);
                try
                {
                    dataoutputstream.writeInt(0);
                    dataoutputstream.writeBoolean(false);
                }
                catch(IOException ioexception) { }
                byte abyte0[] = bytearrayoutputstream.toByteArray();
                rStore.addRecord(abyte0, 0, abyte0.length);
            } else
            {
                byte abyte1[] = rStore.getRecord(1);
                if(abyte1 != null)
                {
                    ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(abyte1);
                    DataInputStream datainputstream = new DataInputStream(bytearrayinputstream);
                    mH = datainputstream.readInt();
                    sE = datainputstream.readBoolean();
                } else
                {
                    mH = 0;
                    sE = false;
                }
            }
        }
        catch(Exception exception) { }
    }

    public void commandAction(Command command, Displayable displayable)
    {
        if(command == cBack && displayable == hForm)
        {
            indeX = 0;
            resumeFlag = true;
            Display.getDisplay(owM).setCurrent(this);
            repaint();
        }
    }

    protected void hideNotify()
    {
        pauseFlag = true;
    }

    protected void showNotify()
    {
        pauseFlag = false;
        resumePlease();
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -