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

📄 maincanvas.java

📁 机器人大战MetalEN
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    }

    public final void paint(Graphics g)
    {
        offGfx = g;
    }

    public final void start()
    {
        if(thread == null)
        {
            display.setCurrent(this);
            thread = new Thread(this);
            thread.start();
        }
    }

    public final synchronized void run()
    {
        do
        {
            MainCanvas _tmp = this;
            Thread.yield();
            update();
            long l;
            for(l = System.currentTimeMillis(); l - Mill < 120L; l = System.currentTimeMillis())
            {
                MainCanvas _tmp1 = this;
                Thread.yield();
            }

            Mill = l;
            repaint();
            serviceRepaints();
        } while(true);
    }

    public final void keyPressedEvent(int i)
    {
        if(i - 35 >= 0 && i - 57 <= 0)
        {
            ik |= 1 << i - 35;
            RK |= 1 << i - 35;
        } else
        if(i < 0 && i >= -10)
        {
            ik |= 1 << -i;
            RK |= 1 << -i;
        }
    }

    public final void keyReleasedEvent(int i)
    {
        if(i - 35 >= 0 && i - 57 <= 0)
            RK &= ~(1 << i - 35);
        else
        if(i < 0 && i >= -10)
            RK &= ~(1 << -i);
    }

    public void update()
    {
        if(Game_MainChapter == 8)
            ChapterGame();
        else
            try
            {
                switch(Game_MainChapter)
                {
                case 8: // '\b'
                case 15: // '\017'
                default:
                    break;

                case 0: // '\0'
                    ChapterLogo();
                    break;

                case 19: // '\023'
                    ChapterStoryInit();
                    break;

                case 20: // '\024'
                    ChapterStory();
                    break;

                case 1: // '\001'
                    ChapterInit();
                    break;

                case 17: // '\021'
                    ChapterLoadFix();
                    break;

                case 2: // '\002'
                    ChapterTitle();
                    break;

                case 3: // '\003'
                    ChapterSelectInit();
                    break;

                case 4: // '\004'
                    ChapterSelect();
                    break;

                case 18: // '\022'
                    ChapterLoadImageInit();
                    break;

                case 16: // '\020'
                    ChapterLoadImage();
                    break;

                case 5: // '\005'
                    ChapterTargetInit();
                    break;

                case 6: // '\006'
                    ChapterTarget();
                    break;

                case 7: // '\007'
                    ChapterGameInit();
                    break;

                case 9: // '\t'
                    ChapterStageClearInit();
                    break;

                case 10: // '\n'
                    ChapterStageClear();
                    break;

                case 11: // '\013'
                    ChapterGameOverInit();
                    break;

                case 12: // '\f'
                    ChapterGameOver();
                    break;

                case 13: // '\r'
                    ChapterAllClearInit();
                    break;

                case 14: // '\016'
                    ChapterAllClear();
                    break;

                case 21: // '\025'
                    Chap_MenuInit();
                    break;

                case 22: // '\026'
                    Chap_Menu();
                    break;

                case 23: // '\027'
                    try
                    {
                        app.destroyApp(false);
                    }
                    catch(Exception exception) { }
                    break;
                }
            }
            catch(Exception exception1) { }
    }

    public void ChapterLogo()
    {
        offGfx.setColor(128, 128, 128);
        offGfx.fillRect(0, 0, Draw_FullWidth, Draw_FullHeight);
        SoftKeyName(4);
        Game_MainChapter = 17;
    }

    public void ChapterLoadFix()
    {
        if(Game_MainTimer - 28 >= 0)
        {
            Game_MainTimer = 0;
            Game_SubTimer = 0;
        }
        switch(Game_MainTimer)
        {
        default:
            break;

        case 0: // '\0'
            LoadMyImage();
            Game_SubTimer++;
            if(Point >= 999)
            {
                Game_MainTimer++;
                Point = 0;
            }
            break;

        case 1: // '\001'
            LoadMapChipImage();
            Game_SubTimer++;
            if(Point >= 999)
            {
                Game_MainTimer++;
                Point = 0;
            }
            break;

        case 2: // '\002'
            LoadEtcImage();
            Game_SubTimer++;
            if(Point >= 999)
            {
                Game_MainChapter = 1;
                Point = 0;
                Game_MainTimer = 0;
            }
            break;
        }
        FillRect(0, 0, 0);
        offGfx.setClip(Draw_Zero_X, Draw_Zero_Y, 112, 112);
        PieChartDraw(Game_SubTimer, 38);
    }

    public void ChapterStoryInit()
    {
        Game_MainTimer = 0;
        Game_SubTimer = 0;
        ik = 0;
        SoftKeyName(6);
        FillRect(0, 0, 0);
        Game_MainFlag &= 0xfffffffe;
        Game_MainFlag &= 0xfffffffd;
        Game_MainChapter = 20;
    }

    public void ChapterStory()
    {
        if((Game_MainFlag & 0x1) == 0 && (ik & 0x40440) != 0)
        {
            Game_SubChapter = 3;
            ik = 0;
            Game_MainFlag |= 0x1;
            Game_MainFlag |= 0x2;
        }
        if(Game_MainTimer - 248 >= 0)
        {
            Game_SubChapter = 3;
            ik = 0;
            Game_MainFlag |= 0x1;
            Game_MainFlag |= 0x2;
        }
        Game_MainTimer++;
        Game_SubTimer = WipeOutMain(Game_SubTimer);
        offGfx.setClip(Draw_Zero_X, Draw_Zero_Y, 112, 112);
        FillRect(0, 0, 0);
        int i = Game_MainTimer << 1;
        offGfx.setColor(128, 255, 255);
        DrawString("03.07.2307:", 0, 112 - i);
        offGfx.setColor(255, 255, 255);
        DrawString("3rd Orbital", 0, 128 - i);
        DrawString("Elevator,", 0, 144 - i);
        offGfx.setColor(255, 0, 255);
        DrawString("Yggdrasil,is", 0, 160 - i);
        offGfx.setColor(255, 64, 64);
        DrawString("out of control", 0, 176 - i);
        offGfx.setColor(128, 255, 255);
        DrawString("04.07.2307:", 0, 208 - i);
        offGfx.setColor(255, 255, 255);
        DrawString("Crisis Team ", 0, 224 - i);
        DrawString("dispatched by", 0, 240 - i);
        DrawString("administration", 0, 256 - i);
        offGfx.setColor(128, 255, 255);
        DrawString("05.07.2307:", 0, 288 - i);
        offGfx.setColor(255, 255, 255);
        DrawString("All contact", 0, 304 - i);
        offGfx.setColor(255, 64, 64);
        DrawString("with Crisis", 0, 320 - i);
        DrawString("Team is lost", 0, 336 - i);
        offGfx.setColor(128, 255, 255);
        DrawString("07.07.2307:", 0, 368 - i);
        offGfx.setColor(255, 255, 255);
        DrawString("Administration", 0, 384 - i);
        DrawString("decides to", 0, 400 - i);
        DrawString("activate", 0, 416 - i);
        DrawString("project M.A.", 0, 432 - i);
        offGfx.setColor(128, 255, 255);
        DrawString("08.07.2307:", 0, 464 - i);
        offGfx.setColor(255, 255, 255);
        DrawString("Investigation", 0, 480 - i);
        DrawString("by M.A. begins", 0, 496 - i);
        WipeOutDraw(Game_SubTimer);
    }

    public void ChapterInit()
    {
        Game_MainChapter = 0;
        Game_SubChapter = 0;
        Game_MainTimer = 0;
        Game_SubTimer = 0;
        Game_Stage = 0;
        ik = 0;
        FillRect(0, 0, 0);
        Game_MainFlag &= 0xfffffffe;
        Game_MainFlag &= 0xfffffffd;
        Img_Enemy = null;
        Img_EnemyShot = null;
        Img_Exp = null;
        Img_Title = null;
        try
        {
            Img_Title = Image.createImage("/T.png");
        }
        catch(Exception exception) { }
        SoftKeyName(5);
        Game_MainChapter = 2;
    }

    public void ChapterTitle()
    {
        TitleKeyIO();
        TitleMain();
        TitleDraw();
    }

    public void TitleKeyIO()
    {
        int i = ik;
        ik = 0;
        if((Game_MainFlag & 0x1) == 0)
        {
            if((i & 0x40440) != 0)
            {
                nOld_Chapter = Game_MainChapter;
                Game_SubChapter = 21;
                Game_MainFlag |= 0x1;
                Game_MainFlag |= 0x2;
                return;
            }
            if((i & 0x80) != 0)
            {
                Game_MainFlag |= 0x1;
                Game_MainChapter = 23;
            }
        }
    }

    public void TitleMain()
    {
        Game_MainTimer++;
        if(Game_MainTimer - 1024 >= 0)
            Game_MainTimer = 32;
        Game_SubTimer = WipeOutMain(Game_SubTimer);
    }

    public void TitleDraw()
    {
        FillRect(0, 0, 0);
        offGfx.setClip(Draw_Zero_X, Draw_Zero_Y, 112, 112);
        offGfx.drawImage(Img_Title, Draw_Zero_X, 11 + Draw_Zero_Y, 0);
        offGfx.setColor(0, 200, 32);
        offGfx.drawLine(Draw_Zero_X, 94 + (Game_MainTimer >> 1 & 0x7) + Draw_Zero_Y, 112 + Draw_Zero_X, 94 + (Game_MainTimer >> 1 & 0x7) + Draw_Zero_Y);
        if(Game_MainTimer - 14 < 0)
        {
            offGfx.setColor(0, 0, 0);
            offGfx.fillRect(Draw_Zero_X, Draw_Zero_Y, 56 - (Game_MainTimer << 2), 112);
            offGfx.fillRect(56 + (Game_MainTimer << 2) + Draw_Zero_X, Draw_Zero_Y, 56 - (Game_MainTimer << 2), 112);
        }
        WipeOutDraw(Game_SubTimer);
    }

    public void Chap_MenuInit()
    {
        nCursor[0] = 0;
        nCursor[1] = 0;
        nMenu[0] = 0;
        nMenu[1] = 0;
        nMenuCount = 0;
        if(nOld_Chapter == 2)
            SoftKeyName(0);
        else
            SoftKeyName(3);
        Game_MainChapter = 22;
    }

    public void Chap_Menu()
    {
        int ai[] = {
            0, 1, 0, 2, 3
        };
        byte abyte0[][] = {
            {
                19, 22, 23, 22, 22
            }, {
                1, 22, 23, 22, 22
            }
        };
        byte abyte1[][] = {
            {
                22, 22, 22, 22
            }, {
                (byte)nOld_Chapter, 22, 22, 22
            }
        };
        String as[][] = {
            {
                "New Game", "Help", "Exit", "About", "Option"
            }, {
                "Title", "Help", "Exit", "About", "Option"
            }
        };
        String as1[] = {
            "Off", "On"
        };
        String as2[][] = {

⌨️ 快捷键说明

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