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

📄 startscreens.java

📁 j2me游戏都市骑士的代码,是一款横版格斗的游戏.可以学习参考.
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 2005-11-26 11:37:47
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 

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

class startScreens
{

    public startScreens(GameCanvas gamecanvas)
    {
        scrlY = 53;
        count = 0;
        numLangs = 1;
        Directory = new String[320];
        showMessage = false;
        Gc = gamecanvas;
        WIDTH = 176;
        HEIGHT = 220;
        try
        {
            LangLabel = new String[8];
            readLangLabels();
        }
        catch(Exception exception)
        {
            System.out.println("got" + exception);
        }
        try
        {
            logo = Image.createImage("/logo.png");
        }
        catch(Exception exception1)
        {
            System.out.println("error in startScreens" + exception1);
        }
        try
        {
            dblogo = Image.createImage("/dblogo.png");
        }
        catch(Exception exception2)
        {
            dblogo = null;
        }
    }

    public void readLangLabels()
    {
        int i = 0;
        try
        {
            Class class1 = getClass();
            InputStream inputstream = class1.getResourceAsStream("/languages.txt");
            String s = "";
            for(byte abyte0[] = new byte[1]; inputstream.read(abyte0) != -1;)
                if((new String(abyte0)).equals("~"))
                {
                    LangLabel[i] = s;
                    s = "";
                    i++;
                    numLangs = (byte)i;
                } else
                {
                    s = s + new String(abyte0);
                }

            inputstream.close();
        }
        catch(IOException ioexception)
        {
            ioexception.printStackTrace();
            System.out.println("hererer" + ioexception);
        }
    }

    public void showLoader(Graphics g)
    {
        g.setColor(255, 255, 255);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(255, 0, 0);
        g.setColor(255, 255, 255);
        g.fillRect(28, 170, 120, 10);
        g.setColor(229, 101, 0);
        g.fillRect(28, 170, (120 / Gc.totalgameData) * Gc.loadCtr, 10);
        if(dblogo != null)
            g.drawImage(dblogo, 22, 90, 4 | 0x10);
        else
            g.drawImage(logo, 22, 90, 4 | 0x10);
        g.setColor(252, 255, 0);
        g.drawRect(28, 170, 120, 10);
        g.setColor(0, 0, 255);
        g.drawRect(27, 169, 122, 12);
    }

    public void showLoader(Graphics g, int i)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, 176, 220);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 60, 157, 125, 10, 10);
        g.setColor(255, 255, 255);
        g.fillRect(28, 150, 120, 10);
        g.setColor(255, 204, 51);
        g.fillRect(28, 150, (120 / i) * Gc.loadCtr1, 10);
        g.setColor(252, 255, 0);
        g.drawRect(28, 150, 120, 10);
        g.setColor(0, 0, 255);
        g.drawRect(27, 149, 122, 12);
    }

    public void showSplashScr(Graphics g)
    {
        g.setColor(255, 255, 255);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.drawImage(logo, 22, 90, 4 | 0x10);
    }

    public void showTitle(Graphics g)
    {
        try
        {
            g.setColor(231, 156, 74);
            g.fillRect(0, 0, WIDTH, HEIGHT);
            g.drawImage(title, WIDTH / 2, HEIGHT / 2, 1 | 2);
            g.setColor(255, 255, 255);
            g.setFont(Font.getFont(0, 0, 8));
            g.drawString(Translate("Press Joystick"), WIDTH / 2, 6, 1 | 0x10);
        }
        catch(Exception exception)
        {
            System.out.println(" wedfwemnb " + exception);
        }
    }

    public void showMenu(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setColor(255, 204, 0);
        g.fillRoundRect(0, 40, WIDTH, 17, 20, 20);
        g.setColor(200, 182, 236);
        g.drawRoundRect(0, 40, WIDTH, 17, 20, 20);
        g.setColor(0, 0, 0);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Main Menu"), WIDTH / 2, 41, 0x10 | 1);
        g.setColor(207, 12, 0);
        g.drawRoundRect(10, 60, 157, 138, 10, 10);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        g.drawString(Translate("New Game"), WIDTH / 2, 65, 0x10 | 1);
        g.drawString(Translate("Resume Game"), WIDTH / 2, 83, 0x10 | 1);
        g.drawString(Translate("Help"), WIDTH / 2, 101, 0x10 | 1);
        g.drawString(Translate("High Scores"), WIDTH / 2, 119, 0x10 | 1);
        g.drawString(Translate("Game Options"), WIDTH / 2, 137, 0x10 | 1);
        g.drawString(Translate("About"), WIDTH / 2, 155, 0x10 | 1);
        g.drawString(Translate("Quit"), WIDTH / 2, 173, 0x10 | 1);
        switch(selRectPos)
        {
        case 0: // '\0'
            g.drawRoundRect(25, 64, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("New Game"), WIDTH / 2, 65, 0x10 | 1);
            break;

        case 1: // '\001'
            g.drawRoundRect(25, 82, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Resume Game"), WIDTH / 2, 83, 0x10 | 1);
            break;

        case 2: // '\002'
            g.drawRoundRect(25, 100, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Help"), WIDTH / 2, 101, 0x10 | 1);
            break;

        case 3: // '\003'
            g.drawRoundRect(25, 118, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("High Scores"), WIDTH / 2, 119, 0x10 | 1);
            break;

        case 4: // '\004'
            g.drawRoundRect(25, 136, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Game Options"), WIDTH / 2, 137, 0x10 | 1);
            break;

        case 5: // '\005'
            g.drawRoundRect(25, 154, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("About"), WIDTH / 2, 155, 0x10 | 1);
            break;

        case 6: // '\006'
            g.drawRoundRect(25, 172, 135, 18, 9, 9);
            g.setColor(255, 233, 0);
            g.drawString(Translate("Quit"), WIDTH / 2, 173, 0x10 | 1);
            break;
        }
    }

    public void showAbout(Graphics g)
    {
        if(helpTextarr == null)
        {
            helpTextarr = new String[30];
            readHelp(lang);
        }
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        int i = Font.getFont(0, 0, 8).getHeight();
        byte byte0 = 12;
        int j = 0;
        for(int k = 0; k < helpTextarr.length; k++)
        {
            if(helpTextarr[k] == null)
                break;
            g.drawString(helpTextarr[k], byte0, (scrlY + i * j) - 5, 0x10 | 4);
            j++;
        }

        g.setColor(217, 217, 217);
        g.fillRect(170, 65, 2, 163);
        g.setColor(255, 0, 0);
        g.fillRect(170, 45 + (53 - scrlY) + 9, 2, 8);
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, 66);
        g.fillRect(0, 167, WIDTH, 60);
        g.setColor(255, 0, 0);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Press Joystick"), WIDTH / 2, HEIGHT - 36, 0x10 | 1);
        g.setColor(207, 12, 0);
        g.drawRoundRect(8, 45, 159, 127, 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("Help"), WIDTH / 2, 43, 0x10 | 1);
    }

    public void showCredits(Graphics g)
    {
        if(abutTextarr == null)
        {
            abutTextarr = new String[30];
            readAbut(lang);
        }
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 253, 232);
        int i = Font.getFont(0, 0, 8).getHeight();
        byte byte0 = 20;
        int j = 0;
        for(int k = 0; k < abutTextarr.length; k++)
        {
            if(abutTextarr[k] == null)
                break;
            g.drawString(abutTextarr[k], byte0, scrlY + i * j, 0x10 | 4);
            j++;
        }

        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, 65);
        g.setColor(255, 0, 0);
        g.setFont(Font.getFont(0, 0, 8));
        g.drawString(Translate("Press Joystick"), WIDTH / 2, HEIGHT - 36, 0x10 | 1);
        g.setColor(207, 12, 0);
        g.drawRoundRect(9, 60, 157, 117, 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("About"), WIDTH / 2, 43, 0x10 | 1);
    }

    public void showTopScores(Graphics g)
    {
        g.setColor(66, 69, 66);
        g.fillRect(0, 0, WIDTH, HEIGHT);
        byte byte0 = 10;
        byte byte1 = 17;
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(255, 255, 255);
        int i = scrlY + 15;
        try
        {
            for(int j = 0; j < 10; j++)
            {

⌨️ 快捷键说明

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