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

📄 startscreens.java

📁 j2me游戏都市骑士的代码,是一款横版格斗的游戏.可以学习参考.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                String s = GameScore.getHighScoreName(j);
                int k = GameScore.getHighScore(j);
                int l = 14 + Font.getFont(0, 0, 8).stringWidth("10. ");
                g.drawString((j + 1) + ".", 14, i + 17 * j, 0x10 | 4);
                g.drawString(s, l, i + 17 * j, 0x10 | 4);
                g.drawString("" + k, WIDTH - l, i + 17 * j, 0x10 | 8);
            }

        }
        catch(Exception exception)
        {
            System.out.println("sas " + exception);
        }
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, 176, 69);
        g.fillRect(0, HEIGHT - 34, WIDTH, 50);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 63, 157, 122, 10, 10);
        g.setColor(255, 0, 0);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Press Joystick"), WIDTH / 2, HEIGHT - 36, 0x10 | 1);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 204, 0);
        g.fillRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(200, 182, 236);
        g.drawRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(0, 0, 0);
        g.drawString(Translate("High Scores"), WIDTH / 2, 43, 0x10 | 1);
    }

    public void showGameOptionsMenu(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 65, 157, 130, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 204, 0);
        g.fillRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(200, 182, 236);
        g.drawRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(0, 0, 0);
        g.drawString(Translate("Game Options"), WIDTH / 2, 43, 0x10 | 1);
        String s = "";
        String s1 = "";
        if(Gc.game.isSoundOn)
            s = "On";
        else
            s = "Off";
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.drawString(Translate("Sound") + " " + Translate(s), WIDTH / 2, 70, 0x10 | 1);
        g.drawString(Translate("Language"), WIDTH / 2, 90, 0x10 | 1);
        g.drawString(Translate("Key Setup"), WIDTH / 2, 110, 0x10 | 1);
        g.drawString(Translate("Main Menu"), WIDTH / 2, 130, 0x10 | 1);
        switch(selRectPos)
        {
        case 0: // '\0'
            g.drawRoundRect(40, 69, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Sound") + " " + Translate(s), WIDTH / 2, 70, 0x10 | 1);
            break;

        case 1: // '\001'
            g.drawRoundRect(40, 89, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Language"), WIDTH / 2, 90, 0x10 | 1);
            break;

        case 2: // '\002'
            g.drawRoundRect(40, 109, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Key Setup"), WIDTH / 2, 110, 0x10 | 1);
            break;

        case 3: // '\003'
            g.drawRoundRect(40, 129, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Main Menu"), WIDTH / 2, 130, 0x10 | 1);
            break;
        }
    }

    public void gameOver(Graphics g)
    {
        g.fillRect(0, 0, WIDTH, HEIGHT);
    }

    public void showLevels(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 45, 157, 150, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 204, 0);
        g.fillRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(200, 182, 236);
        g.drawRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(0, 0, 0);
        g.drawString(Translate("Level"), WIDTH / 2, 43, 0x10 | 1);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.drawString(Translate("Level Easy"), WIDTH / 2, 70, 0x10 | 1);
        g.drawString(Translate("Level Medium"), WIDTH / 2, 90, 0x10 | 1);
        g.drawString(Translate("Level Hard"), WIDTH / 2, 110, 0x10 | 1);
        switch(selRectPos)
        {
        case 0: // '\0'
            g.drawRoundRect(40, 69, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Level Easy"), WIDTH / 2, 70, 0x10 | 1);
            break;

        case 1: // '\001'
            g.drawRoundRect(40, 89, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Level Medium"), WIDTH / 2, 90, 0x10 | 1);
            break;

        case 2: // '\002'
            g.drawRoundRect(40, 109, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Level Hard"), WIDTH / 2, 110, 0x10 | 1);
            break;
        }
    }

    public void showSound(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 65, 157, 130, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 204, 0);
        g.fillRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(200, 182, 236);
        g.drawRoundRect(0, 42, WIDTH, 17, 20, 20);
        g.setColor(0, 0, 0);
        g.drawString(Translate("Sound"), WIDTH / 2, 43, 0x10 | 1);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.drawString(Translate("Sound On"), WIDTH / 2, 90, 0x10 | 1);
        g.drawString(Translate("Sound Off"), WIDTH / 2, 110, 0x10 | 1);
        switch(selRectPos)
        {
        case 0: // '\0'
            g.drawRoundRect(40, 89, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Sound On"), WIDTH / 2, 90, 0x10 | 1);
            break;

        case 1: // '\001'
            g.drawRoundRect(40, 109, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Sound Off"), WIDTH / 2, 110, 0x10 | 1);
            break;
        }
    }

    public void showLang(Graphics g)
    {
        try
        {
            g.setColor(66, 69, 66);
            g.fillRect(0, 0, WIDTH, HEIGHT);
            g.setColor(207, 12, 0);
            g.drawRoundRect(10, 65, 157, 135, 10, 10);
            g.setFont(Font.getFont(0, 0, 8));
            g.setColor(255, 204, 0);
            g.fillRoundRect(0, 42, WIDTH, 17, 20, 20);
            g.setColor(200, 182, 236);
            g.drawRoundRect(0, 42, WIDTH, 17, 20, 20);
            g.setColor(0, 0, 0);
            g.drawString(Translate("Language"), WIDTH / 2, 43, 0x10 | 1);
            g.setFont(Font.getFont(0, 0, 8));
            g.setColor(255, 253, 232);
            int i = 77;
            for(byte byte0 = 0; byte0 < numLangs; byte0++)
            {
                g.drawString(LangLabel[byte0].substring(0, LangLabel[byte0].indexOf(',')), WIDTH / 2, i, 0x10 | 1);
                i += 20;
            }

            g.drawRoundRect(40, 76 + 20 * selRectPos, 100, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(LangLabel[selRectPos].substring(0, LangLabel[selRectPos].indexOf(',')), WIDTH / 2, 77 + 20 * selRectPos, 0x10 | 1);
        }
        catch(Exception exception)
        {
            System.out.println("Lang Menu " + exception);
        }
    }

    public void showKeyboard(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 45, 157, 153, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Enter Name"), 53, 51, 0x10 | 4);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.setColor(255, 255, 255);
        g.fillRect(20, 70, 136, 17);
        g.setColor(0, 0, 0);
        g.drawString(KeyBoard.name, 21, 70, 0x10 | 4);
        g.drawImage(keyB, 6, 100, 4 | 0x10);
        g.setColor(255, 0, 0);
        g.drawRect(KeyBoard.posX, KeyBoard.posY, 13, 13);
        g.drawRect(KeyBoard.posX - 1, KeyBoard.posY - 1, 15, 15);
    }

    public void showMessage(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 45, 157, HEIGHT - 40 - 45, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.drawString(Translate("Sorry! there is no Game"), 24, 63, 0x10 | 4);
        g.drawString(Translate("saved which can be"), 24, 81, 0x10 | 4);
        g.drawString(Translate("resumed") + ".", 24, 99, 0x10 | 4);
        g.setColor(255, 0, 0);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Press Joystick"), WIDTH / 2, HEIGHT - 36, 0x10 | 1);
    }

    public void showKeySetup(Graphics g)
    {
        int i = 0;
        try
        {
            g.setColor(66, 69, 66);
            g.fillRect(0, 0, WIDTH, HEIGHT);
            g.setFont(Font.getFont(0, 0, 8));
            g.setColor(255, 253, 232);
            g.drawString(Translate("Left") + ": " + Gc.getDescription(Gc.keyLeft), 14, scrlY + 10 + 17 * (count + 0), 0x10 | 4);
            g.drawString(Translate("Right") + ": " + Gc.getDescription(Gc.keyRight), 14, scrlY + 10 + 17 * (count + 1), 0x10 | 4);
            g.drawString(Translate("Fire") + ": " + Gc.getDescription(Gc.keyFire), 14, scrlY + 10 + 17 * (count + 2), 0x10 | 4);
            g.drawString(Translate("Up") + ": " + Gc.getDescription(Gc.keyUp), 14, scrlY + 10 + 17 * (count + 3), 0x10 | 4);
            g.drawString(Translate("Down") + ": " + Gc.getDescription(Gc.keyDown), 14, scrlY + 10 + 17 * (count + 4), 0x10 | 4);
            g.drawString(Translate("Weapon") + ": " + Gc.getDescription(Gc.keyWeapon), 14, scrlY + 10 + 17 * (count + 5), 0x10 | 4);
            g.drawString(Translate("Kick") + ": " + Gc.getDescription(Gc.keyKick), 14, scrlY + 10 + 17 * (count + 6), 0x10 | 4);
            g.drawString(Translate("Block") + ": " + Gc.getDescription(Gc.keyBlock), 14, scrlY + 10 + 17 * (count + 7), 0x10 | 4);
            g.drawString(Translate("Game Options"), 14, scrlY + 10 + 17 * (count + 8), 0x10 | 4);
            g.setColor(66, 69, 66);
            g.fillRect(0, 181, WIDTH, 60);
            g.setFont(Font.getFont(0, 0, 8));
            switch(selRectPos)
            {
            default:
                break;

            case 0: // '\0'
                g.setColor(255, 233, 0);
                g.drawString(Translate("Left") + ": " + Gc.getDescription(Gc.keyLeft), 14, scrlY + 10 + 17 * (count + 0), 0x10 | 4);
                if(showMessage)
                {
                    g.setColor(255, 233, 0);
                    g.setFont(Font.getFont(0, 0, 8));
                    g.drawString(Translate("Press key for") + " " + Translate("Left"), 88, 182, 1 | 0x10);
                }
                break;

            case 1: // '\001'
                g.setColor(255, 233, 0);
                g.drawString(Translate("Right") + ": " + Gc.getDescription(Gc.keyRight), 14, scrlY + 10 + 17 * (count + 1), 0x10 | 4);
                if(showMessage)
                {
                    g.setColor(255, 233, 0);
                    g.setFont(Font.getFont(0, 0, 8));
                    g.drawString(Translate("Press key for") + " " + Translate("Right"), 88, 182, 1 | 0x10);
                }
                break;

            case 2: // '\002'
                g.setColor(255, 233, 0);
                g.drawString(Translate("Fire") + ": " + Gc.getDescription(Gc.keyFire), 14, scrlY + 10 + 17 * (count + 2), 0x10 | 4);
                if(showMessage)
                {
                    g.setColor(255, 233, 0);
                    g.setFont(Font.getFont(0, 0, 8));
                    g.drawString(Translate("Press key for") + " " + Translate("Fire"), 88, 182, 1 | 0x10);
                }
                break;

            case 3: // '\003'
                g.setColor(255, 233, 0);
                g.drawString(Translate("Up") + ": " + Gc.getDescription(Gc.keyUp), 14, scrlY + 10 + 17 * (count + 3), 0x10 | 4);
                if(showMessage)
                {
                    g.setColor(255, 233, 0);
                    g.setFont(Font.getFont(0, 0, 8));

⌨️ 快捷键说明

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