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

📄 main.java

📁 传说中的小蜜蜂游戏,回忆下小时候 WTK编译可运行,内有图
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// 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 
// Source File Name:   Main.java

import com.nokia.mid.sound.Sound;
import com.nokia.mid.sound.SoundListener;
import com.nokia.mid.ui.FullCanvas;
import java.io.DataInputStream;
import javax.microedition.lcdui.*;

public class Main extends FullCanvas
    implements Runnable, SoundListener
{

    private static Inv inv;
    public static Game game;
    public static Image abs[];
    private static int i;
    public static int b[] = new int[8];
    private static int selnum = 1;
    public static int selst = 24;
    public static int selex = 33;
    public static int selso = 36;
    public static long l[] = new long[4];
    private static long bT = 0x3938700L;
    public static Sound sD;
    private static final byte SHOT[] = {
        2, 74, 58, 85, -51, -95, -67, -67, -48, 4, 
        0, 29, 62, -60, 26, 65, -70, 17, -94, -56, 
        -48, -83, 18, 106, 8, 57, 66, -76, 0
    };
    public static int states[] = new int[10];
    public static boolean play;
    public static boolean F_ga = true;
    public static int gaM;
    private static boolean T_flg;
    public static int gOx = 90;
    private static boolean stop;
    private static boolean UpdateFlg;
    public static boolean About;
    public Thread mth;
    public Thread GameThre;
    public Thread GameThre2;
    public Thread GameThre3;
    public boolean pause;
    public static long stopTime = 0L;
    public static long releaseTime = 0L;
    public static int disp_cnt;

    public Main(Inv inv1)
    {
        mth = null;
        GameThre = null;
        GameThre2 = null;
        GameThre3 = null;
        inv = inv1;
        b[3] = getHeight();
        b[4] = getWidth();
        game = new Game(this, b[4], b[3]);
        try
        {
            sD = new Sound(SHOT, 1);
            sD.setSoundListener(this);
        }
        catch(Exception exception) { }
        init(0);
    }

    public void run()
    {
        do
        {
            sleep(20);
            update();
            repaint();
        } while(true);
    }

    public static void sleep(int j)
    {
        try
        {
            Thread.sleep(j);
        }
        catch(InterruptedException interruptedexception) { }
    }

    public void soundStateChanged(Sound sound, int j)
    {
    }

    private void update()
    {
        switch(states[0])
        {
        case 1: // '\001'
            if(Game.nokLeft == 0 && states[0] != 7)
            {
                disp_cnt++;
                if(Game.rdisp_flg && disp_cnt > 180)
                {
                    init(7);
                    Game.bonus_flg = false;
                    disp_cnt = 0;
                    Game.timer_cnt2 = 0;
                }
            }
            if(play)
            {
                if(!Game.bonus_flg)
                {
                    Game.timer();
                } else
                {
                    disp_cnt++;
                    if(disp_cnt > 200)
                    {
                        disp_cnt = 201;
                        Game.timer();
                    }
                }
                if(gaM == 1 && play)
                {
                    if(!Game.bonus_flg && Game.nokLeft != 0)
                    {
                        l[0] = System.currentTimeMillis() - Game.old_time;
                        l[1] = System.currentTimeMillis() - Game.old_time1;
                    } else
                    if(disp_cnt > 200)
                        l[3] = System.currentTimeMillis() - Game.old_time;
                    if(l[0] > 59999L)
                        Game.old_time = System.currentTimeMillis();
                }
            }
            break;
        }
    }

    public void paint(Graphics g)
    {
        int j = 1000;
        int k = 10;
        g.setColor(0);
        g.fillRect(0, 0, b[4], b[3]);
        g.setFont(Font.getFont(0, 0, 8));
        g.setColor(0xfefefe);
        switch(states[0])
        {
        case 4: // '\004'
        case 6: // '\006'
        default:
            break;

        case 0: // '\0'
            if(!T_flg)
            {
                b[5]++;
                g.drawImage(abs[9], (b[4] - abs[9].getWidth()) / 2, (b[3] - abs[9].getHeight()) / 2, 0);
                if(b[5]++ > 100)
                {
                    T_flg = true;
                    b[5] = 0;
                }
                break;
            }
            g.drawImage(abs[0], 2, 4, 0);
            g.drawImage(abs[83], 29, 88, 0);
            if(!About)
            {
                g.drawImage(abs[1], 25, 54, 0);
                for(i = 0; i < 4; i++)
                {
                    g.drawString("" + (Game.hi_score / j) % 10, 79 + i * 6, 54, 0);
                    g.drawString("" + (Game.score / j) % 10, 79 + i * 6, 65, 0);
                    j /= 10;
                }

                g.drawImage(abs[2], 25, 65, 0);
                g.drawImage(abs[3], b[4] - abs[3].getWidth(), b[3] - abs[3].getHeight(), 0);
                g.drawImage(abs[7], 0, b[3] - abs[7].getHeight(), 0);
            } else
            {
                g.drawString("Version 1.3", 38, 59, 0);
                g.drawString("", 38, 75, 0);
                g.drawImage(abs[44], b[4] - abs[44].getWidth(), b[3] - abs[44].getHeight(), 0);
            }
            break;

        case 1: // '\001'
            game.paint(g);
            break;

        case 2: // '\002'
            g.drawImage(abs[40], 32, 8, 0);
            states(g);
            g.drawImage(abs[41], 28, 25, 0);
            g.drawImage(abs[42], 28, 42, 0);
            g.drawImage(abs[43], 0, b[3] - abs[43].getHeight(), 0);
            g.drawImage(abs[44], b[4] - abs[44].getWidth(), b[3] - abs[44].getHeight(), 0);
            break;

        case 3: // '\003'
            g.drawImage(abs[45], 32, 8, 0);
            g.drawImage(abs[8], 22, 10, 0);
            g.drawImage(abs[8], 96, 10, 0);
            g.drawImage(abs[46], 28, 25, 0);
            g.drawImage(abs[47], 28, 38, 0);
            g.drawImage(abs[48], 28, 51, 0);
            g.drawImage(abs[49], 28, 64, 0);
            g.drawImage(abs[43], 0, b[3] - abs[43].getHeight(), 0);
            g.drawImage(abs[44], b[4] - abs[44].getWidth(), b[3] - abs[44].getHeight(), 0);
            break;

        case 5: // '\005'
            g.drawImage(abs[18], 37, 8, 0);
            states(g);
            g.drawImage(abs[4], 0, b[3] - abs[4].getHeight(), 0);
            g.drawImage(abs[44], b[4] - abs[44].getWidth(), b[3] - abs[44].getHeight(), 0);
            g.drawImage(abs[selst + 4], 24, 25, 0);
            g.drawImage(abs[selex + 2], 24, 38, 0);
            g.drawImage(abs[selso + 2], 24, 51, 0);
            if(selnum == 1)
            {
                g.drawImage(abs[selst], 24, 25, 0);
                break;
            }
            if(selnum == 2)
            {
                g.drawImage(abs[selex], 24, 38, 0);
                break;
            }
            if(selnum == 3)
                g.drawImage(abs[selso], 24, 51, 0);
            break;

        case 7: // '\007'
            g.drawImage(abs[77 + Game.stage], 32, 8, 0);
            g.drawImage(abs[43], 0, b[3] - abs[43].getHeight(), 0);
            if(Game.sT[Game.stage] <= Game.bTi[Game.stage])
            {
                if(Game.sT1[Game.stage] <= Game.bTi1[Game.stage])
                {
                    Game.bTi[Game.stage] = Game.sT[Game.stage];
                    Game.bTi1[Game.stage] = Game.sT1[Game.stage];
                }
            } else
            if(Game.sT[Game.stage] > Game.bTi[Game.stage] && Game.sT1[Game.stage] < Game.bTi1[Game.stage])
            {
                Game.bTi[Game.stage] = Game.sT[Game.stage];
                Game.bTi1[Game.stage] = Game.sT1[Game.stage];
            }
            states(g);
            g.drawImage(abs[22], 10, 25, 0);
            g.drawImage(abs[50], 10, 42, 0);
            for(i = 0; i < 2; i++)
            {
                g.drawString("" + (Game.bTi1[Game.stage] / 60000L / (long)k) % 10L, 70 + i * 6, 25, 0);
                g.drawString("" + (Game.bTi[Game.stage] / 1000L / (long)k) % 10L, 88 + i * 6, 25, 0);
                g.drawString("" + (Game.bTi[Game.stage] / 10L / (long)k) % 10L, 106 + i * 6, 25, 0);
                g.drawString("" + (Game.sT1[Game.stage] / 60000L / (long)k) % 10L, 70 + i * 6, 42, 0);
                g.drawString("" + (Game.sT[Game.stage] / 1000L / (long)k) % 10L, 88 + i * 6, 42, 0);
                g.drawString("" + (Game.sT[Game.stage] / 10L / (long)k) % 10L, 106 + i * 6, 42, 0);
                g.drawImage(abs[21], 82 + i * 18, 25, 0);
                g.drawImage(abs[21], 82 + i * 18, 42, 0);
                k /= 10;
            }

            game.saveData();
            break;

        case 8: // '\b'
            g.drawImage(abs[82], 24, 8, 0);
            if(UpdateFlg)
            {
                disp_cnt++;
                if(disp_cnt > 100)
                {
                    bT = l[2];
                    disp_cnt = 0;
                    UpdateFlg = false;
                }
            }
            if(stop)
            {
                g.drawImage(abs[61], 14, 10, 0);
                g.drawImage(abs[61], 104, 10, 0);
            } else
            {
                g.drawImage(abs[62], 14, 10, 0);
                g.drawImage(abs[62], 104, 10, 0);
            }
            stop = !stop;
            g.drawImage(abs[22], 10, 25, 0);
            g.drawImage(abs[23], 10, 42, 0);
            l[2] = Game.sT1[0] + Game.sT1[1] + Game.sT1[2] + Game.sT1[3] + Game.sT1[4];
            if(l[2] <= bT)
                UpdateFlg = true;
            for(i = 0; i < 2; i++)
            {
                g.drawString("" + (bT / 60000L / (long)k) % 10L, 70 + i * 6, 25, 0);
                g.drawString("" + ((bT % 60000L) / 1000L / (long)k) % 10L, 88 + i * 6, 25, 0);
                g.drawString("" + (bT / 10L / (long)k) % 10L, 106 + i * 6, 25, 0);
                g.drawString("" + (l[2] / 60000L / (long)k) % 10L, 70 + i * 6, 42, 0);
                g.drawString("" + ((l[2] % 60000L) / 1000L / (long)k) % 10L, 88 + i * 6, 42, 0);
                g.drawString("" + (l[2] / 10L / (long)k) % 10L, 106 + i * 6, 42, 0);
                g.drawImage(abs[21], 82 + i * 18, 25, 0);
                g.drawImage(abs[21], 82 + i * 18, 42, 0);
                k /= 10;
            }

            g.drawImage(abs[3], b[4] - abs[3].getWidth(), b[3] - abs[3].getHeight(), 0);
            game.saveData();
            break;

        case 9: // '\t'
            g.drawImage(abs[1], 25, 25, 0);
            game.saveData();
            for(i = 0; i < 4; i++)
            {
                g.drawString("" + (Game.hi_score / j) % 10, 94 + i * 6, 25, 0);
                g.drawString("" + (Game.score / j) % 10, 94 + i * 6, 38, 0);
                j /= 10;
            }

            g.drawImage(abs[2], 25, 38, 0);
            g.drawImage(abs[6], gOx, 8, 0);
            if(stop)
            {
                g.drawImage(abs[61 + Game.inv_type * 2], gOx - 11, 10, 0);
                g.drawImage(abs[61 + Game.inv_type * 2], gOx + 65, 10, 0);
            } else
            {
                g.drawImage(abs[62 + Game.inv_type * 2], gOx - 11, 10, 0);
                g.drawImage(abs[62 + Game.inv_type * 2], gOx + 65, 10, 0);
            }
            stop = !stop;
            if(gOx > 32)
                gOx--;
            g.drawImage(abs[5], 0, b[3] - abs[5].getHeight(), 0);
            g.drawImage(abs[3], b[4] - abs[3].getWidth(), b[3] - abs[3].getHeight(), 0);
            break;
        }
    }

    public void keyPressed(int j)
    {
        int k = 0;
        int i1 = j;
        try
        {
            k = getGameAction(i1);
        }
        catch(Exception exception) { }
        if(i1 == 42)
            if(selso == 37)
                selso = 36;
            else
                selso = 37;
        switch(states[0])
        {
        case 4: // '\004'
        case 6: // '\006'
        default:
            break;

        case 0: // '\0'
            if(!T_flg)
                break;
            if(i1 == -6)

⌨️ 快捷键说明

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