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

📄 yosamabin_n60.java

📁 一款可以运行在模拟器上的j2me的飞机游戏代码,可以在此原型上能够自由开发自己的代码.
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 

import com.nokia.mid.sound.Sound;
import com.nokia.mid.ui.*;
import java.io.*;
import java.util.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.midlet.MIDlet;

public class YosamaBin_N60 extends MIDlet
{
    class FieldMover extends TimerTask
    {

        public void run()
        {
            if(YosamaBin_N60.a == 20)
                obj.scroll();
            else
            if(YosamaBin_N60.a == 11)
                subPts.scroll();
            else
            if(YosamaBin_N60.a == 12)
                shwScr.scroll();
            else
                intro.scroll1();
        }

        FieldMover()
        {
        }
    }

    class ShowScore extends Form
        implements CommandListener
    {

        private String score[][];
        private String str;
        private Command cmBack;
        private Alert altErr;
        int cnt;
        HttpConnection c;
        public static final int TOP = 10;
        public static final int ROW = 10;
        public static final int COL = 2;

        public void scroll()
        {
            if(cnt == 1)
            {
                append("Please wait while retrieving online scores...");
                getScore();
            }
            if(cnt > 0)
                cnt++;
        }

        public void getScore()
        {
            try{
            score = null;
            score = new String[11][2];
            str = "";
            String s = "http://203.199.107.129/wapsite/ShowScore.asp?game=YosamaBin&series=60&top=10";
            c = (HttpConnection)Connector.open(s);
            InputStream inputstream = c.openInputStream();
            String s1 = c.getType();
            int j = (int)c.getLength();
            int l = c.getResponseCode();
            int i1;
            if(j > 0)
            {
                byte abyte0[] = new byte[j];
                int j1 = inputstream.read(abyte0);
                for(int k1 = 0; k1 < abyte0.length; k1++)
                    str = str + (char)abyte0[k1];

            } else
            {
                while((i1 = inputstream.read()) != -1) 
                    str = str + (char)i1;
            }
            formatScore();
            if(c != null)
                try
                {
                    c.close();
                }
                catch(Exception exception2) { }
            //break MISSING_BLOCK_LABEL_333;
            }catch(Exception exception)
            {
                
            }
            //exception;
            YosamaBin_N60.a = 2;
            display.setCurrent(altErr);
            display.setCurrent(intro);
            for(; size() > 0; delete(size() - 1));
            //exception.printStackTrace();
            if(c != null)
                try
                {
                    c.close();
                }
                catch(Exception exception3) { }
            //break MISSING_BLOCK_LABEL_333;
            //Exception exception1;
            //exception1;
            if(c != null)
                try
                {
                    c.close();
                }
                catch(Exception exception4) { }
            //throw exception1;
        }

        private void formatScore()
        {
            try
            {
                delete(0);
                int j = 0;
                int l = 0;
                score[j][l] = "";
                for(int i1 = 0; i1 < str.length(); i1++)
                    if(str.charAt(i1) == '~' && str.charAt(i1 + 1) == '~')
                    {
                        if(l == 1)
                        {
                            j++;
                            l = 0;
                        } else
                        {
                            l++;
                        }
                        score[j][l] = "";
                        i1++;
                    } else
                    {
                        score[j][l] = score[j][l] + str.charAt(i1);
                    }

                try
                {
                    for(; size() > 0; delete(size() - 1));
                }
                catch(Exception exception1) { }
                append("Top 10 scores\n");
                for(int j1 = 0; j1 < 10; j1++)
                    if(score[j1][0].length() != 0 || score[j1][0] != "null")
                        append("" + (j1 + 1) + ". " + score[j1][0] + " - " + score[j1][1] + "\n");

                cnt = 0;
            }
            catch(Exception exception) { }
            addCommand(cmBack);
        }

        public void commandAction(Command command, Displayable displayable)
        {
            if(command == cmBack)
            {
                try
                {
                    shwScr.c.close();
                }
                catch(Exception exception) { }
                YosamaBin_N60.a = 2;
                display.setCurrent(intro);
                for(; size() > 0; delete(size() - 1));
                removeCommand(cmBack);
            }
        }

        ShowScore()
        {
            super("Hall of fame");
            cmBack = new Command("Back", 2, 1);
            altErr = new Alert("Connection Error");
            altErr.setString("Couldn't retrieve data from the server.");
            altErr.setType(AlertType.ERROR);
            altErr.setTimeout(1000);
            setCommandListener(this);
        }
    }

    class SubmitPoints extends Form
        implements CommandListener
    {

        private Command cmCancel;
        private Command cmOK;
        private Command cmTry;
        private TextField txtName;
        private String strName;
        private int points;
        private int checkSub;
        public int cnt;
        HttpConnection conn;

        public void scroll()
        {
            if(cnt > 0)
                cnt++;
        }

        public void subPoints()
        {
            try
            {
                String s = "http://203.199.107.129/wapsite/SubmitScore.asp?game=YosamaBin&name=" + strName.replace(' ', '_') + "&score=" + points + "&series=60";
                conn = (HttpConnection)Connector.open(s);
                long l = conn.getLength();
                for(; size() > 0; delete(size() - 1));
                removeCommand(cmOK);
                removeCommand(cmTry);
                YosamaBin_N60.a = 2;
                display.setCurrent(intro);
            }
            catch(Exception exception)
            {
                exception.printStackTrace();
                removeCommand(cmOK);
                addCommand(cmTry);
                for(; size() >= 1; delete(size() - 1));
                checkSub = 0;
                append("Connection Failed\n");
            }
        }

        public void commandAction(Command command, Displayable displayable)
        {
            if(command == cmCancel)
            {
                for(; size() > 0; delete(size() - 1));
                removeCommand(cmOK);
                removeCommand(cmTry);
                if(subPts.conn != null)
                    try
                    {
                        subPts.conn.close();
                    }
                    catch(Exception exception) { }
                YosamaBin_N60.a = 2;
                display.setCurrent(intro);
                checkSub = 0;
            } else
            if(command == cmOK)
            {
                checkSub++;
                if(checkSub == 1)
                {
                    cnt = 1;
                    subPoints();
                    append("Submiting your score please wait...");
                }
            } else
            if(command == cmTry)
            {
                checkSub++;
                if(checkSub == 1)
                {
                    cnt = 1;
                    for(; size() > 1; delete(size() - 1));
                    append("Submiting your score please wait...");
                }
            }
        }

        public void setData(int j, String s)
        {
            points = j;
            cnt = 0;
            checkSub = 0;
            strName = new String(s);
            append("Name " + s + "\nScore " + j + "\n");
            addCommand(cmOK);
        }

        public int getData()
        {
            return points;
        }

        SubmitPoints()
        {
            super("Submit Points");
            conn = null;
            cmOK = new Command("OK", 1, 1);
            cmTry = new Command("Try Again", 1, 1);
            cmCancel = new Command("Cancel", 3, 1);
            addCommand(cmCancel);
            setCommandListener(this);
        }
    }

    class Entername extends Form
        implements CommandListener
    {

        private Command cmCancel;
        private Command cmOK;

        public void commandAction(Command command, Displayable displayable)
        {
            if(command == cmOK)
            {
                if(name.getString().length() != 0)
                {
                    name1 = name.getString();
                    scr[5] = YosamaBin_N60.score;
                    str[5] = name1;
                    Sorting();
                    store = str[0] + "@" + scr[0] + "/" + str[1] + "*" + scr[1] + "~" + str[2] + "^" + scr[2] + "(" + str[3] + ")" + scr[3] + "!" + str[4] + "#" + scr[4] + "%" + str[5] + "&" + scr[5];
                    SaveGame.saveGame(store);
                    System.out.println("store " + store);
                    YosamaBin_N60.gamePaint = 0;
                    if(yes)
                    {
                        YosamaBin_N60.a = 11;
                        subPts = new SubmitPoints();
                        subPts.setData(YosamaBin_N60.score, name1);
                        display.setCurrent(subPts);
                    } else
                    {
                        YosamaBin_N60.a = 2;
                        display.setCurrent(intro);
                    }
                }
            } else
            if(command == cmCancel)
            {
                YosamaBin_N60.a = 2;
                display.setCurrent(intro);
            }
        }

        Entername()
        {
            super("Enter Your Name");
            cmOK = new Command("OK", 1, 1);
            cmCancel = new Command("Cancel", 3, 1);
            name = new TextField("Your name:", "", 7, 0);
            addCommand(cmOK);
            addCommand(cmCancel);
            append(name);
            setCommandListener(this);
        }
    }

    public class GameCanvas extends FullCanvas
    {

        public void paint(Graphics g)

⌨️ 快捷键说明

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