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

📄 wien.java

📁 威恩应该是个地名吧游戏的风格黑怪异
💻 JAVA
字号:
// 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:   Wien.java

package falcofinder.Wien;

import java.io.IOException;
import java.io.PrintStream;
import java.util.Vector;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;

// Referenced classes of package falcofinder.Wien:
//            Town, Kid, AreaA, M, 
//            Utility

public class Wien extends MIDlet
    implements CommandListener
{

    private Command menuCmd;
    private Command homeCmd;
    private Command okCmd;
    private Display display;
    private Town town;
    private Image botton;
    private List menu;
    private Form form;
    private Form formkeys;
    private Form forminstructions;

    public Wien()
    {
        menuCmd = new Command("Menu", 1, 1);
        homeCmd = new Command("Home", 1, 1);
        okCmd = new Command("Ok", 1, 1);
        form = new Form("Settings");
        formkeys = new Form("Keys");
        forminstructions = new Form("Instructions");
        try
        {
            botton = Image.createImage("/falcofinder/icons/botton.png");
        }
        catch(IOException ioe)
        {
            System.out.println("icon problem");
        }
    }

    public void startApp()
    {
        display = Display.getDisplay(this);
        town = new Town(this);
        town.addCommand(menuCmd);
        town.setCommandListener(this);
        menu = new List("F's Menu ", 3);
        menu.append("Start Game", botton);
        menu.append("Credits", botton);
        menu.append("Load Game", botton);
        menu.append("Save Game", botton);
        menu.append("Keys", botton);
        menu.append("Instructions", botton);
        menu.append("Home", botton);
        menu.append("Exit", botton);
        menu.addCommand(okCmd);
        menu.setCommandListener(this);
        display.setCurrent(town);
        form.addCommand(homeCmd);
        form.setCommandListener(this);
        forminstructions.append("You are a 10 yrs old\n little girl in Wien\nA Man\nis killing\nblonde little girls,\njust like you\nMission 1\nGet a Tribute\n to Falco\n and go to\nStephansplatz.\n Be fast! \nThe Man is\nlooking for you");
        forminstructions.addCommand(menuCmd);
        forminstructions.setCommandListener(this);
        formkeys.append("2 - up\n4 - left\n6 - right\n8 - down\n5 - collect\n7 - bag");
        formkeys.addCommand(menuCmd);
        formkeys.setCommandListener(this);
    }

    public void pauseApp()
    {
    }

    public void destroyApp(boolean unconditional)
    {
        notifyDestroyed();
    }

    public void seeCredit()
    {
        town.mode = 2;
        display.setCurrent(town);
    }

    public void setPlay()
    {
        town.kid.status = 0;
        town.kid.msg = "";
        town.kid.posx = 10;
        town.kid.posy = 10;
        town.areaa.section = 0;
        town.areaa.posFlowersx = town.areaa.width - 25;
        town.areaa.posFlowersy = town.areaa.height - 28;
        town.areaa.sectionFlowers = 1;
        town.areaa.posLeadx = 29;
        town.areaa.posLeady = town.areaa.height - 32;
        town.areaa.sectionLead = 3;
        town.areaa.posBonex = town.areaa.width - 17;
        town.areaa.posBoney = town.areaa.height - 12;
        town.areaa.sectionBone = 8;
        town.areaa.posDogx = town.areaa.centrox;
        town.areaa.posDogy = town.areaa.centroy;
        town.areaa.sectionDog = 5;
        town.areaa.posBaloonx = town.areaa.width - 23;
        town.areaa.posBaloony = town.areaa.height - 38;
        town.areaa.sectionBaloon = 4;
        town.areaa.dogIsAngry = true;
        town.areaa.dogIsEating = false;
        town.areaa.dogFollowsKid = false;
        town.areaa.baloonFollowsKid = false;
        town.m.mstarttime = System.currentTimeMillis();
        town.m.mdifftime = System.currentTimeMillis() - town.m.mstarttime;
        town.m.section = 8;
        town.m.posx = -100;
        town.m.posy = -100;
        town.mode = 1;
        town.areaa.objects.removeAllElements();
        display.setCurrent(town);
    }

    public void seeInstructions()
    {
        display.setCurrent(forminstructions);
    }

    public void seeKeys()
    {
        display.setCurrent(formkeys);
    }

    private void loadGame()
    {
        StringBuffer sb = new StringBuffer();
        String string = "";
        Alert alert = new Alert("Loading Game");
        alert.setImage(botton);
        try
        {
            RecordStore rstore = RecordStore.openRecordStore("wien", true);
            int nextid = rstore.getNextRecordID();
            if(nextid == 1)
            {
                alert.setString("\nNo Games\nto load\n");
                display.setCurrent(alert);
            } else
            {
                byte data[] = rstore.getRecord(1);
                int sizedata = rstore.getRecordSize(1);
                for(int l = 0; l < sizedata; l++)
                {
                    char c = (char)data[l];
                    sb.append(c);
                }

                string = sb.toString();
                sb.setLength(0);
                alert.setString("\nLoading Game");
                display.setCurrent(alert);
                if(string.compareTo("") != 0)
                    initGame(string);
            }
        }
        catch(RecordStoreException rse)
        {
            System.out.println("RSM exception");
            alert.setString("\nProblem encountered");
        }
    }

    private void initGame(String init)
    {
        char c = "_".charAt(0);
        String param[] = Utility.split(init, c);
        town.kid.posx = Integer.parseInt("" + param[0]);
        town.kid.posy = Integer.parseInt("" + param[1]);
        town.areaa.section = Integer.parseInt(param[2]);
        town.areaa.posFlowersx = Integer.parseInt(param[3]);
        town.areaa.posFlowersy = Integer.parseInt(param[4]);
        town.areaa.sectionFlowers = Integer.parseInt(param[5]);
        town.areaa.posBonex = Integer.parseInt(param[6]);
        town.areaa.posBoney = Integer.parseInt(param[7]);
        town.areaa.sectionBone = Integer.parseInt(param[8]);
        town.areaa.posLeadx = Integer.parseInt(param[9]);
        town.areaa.posLeady = Integer.parseInt(param[10]);
        town.areaa.sectionLead = Integer.parseInt(param[11]);
        town.areaa.posBaloonx = Integer.parseInt(param[12]);
        town.areaa.posBaloony = Integer.parseInt(param[13]);
        town.areaa.sectionBaloon = Integer.parseInt(param[14]);
        town.areaa.posDogx = Integer.parseInt(param[15]);
        town.areaa.posDogy = Integer.parseInt(param[16]);
        town.areaa.sectionDog = Integer.parseInt(param[17]);
        if(param[18].compareTo("false") == 0)
            town.areaa.dogIsAngry = false;
        else
            town.areaa.dogIsAngry = true;
        if(param[19].compareTo("false") == 0)
            town.areaa.dogIsEating = false;
        else
            town.areaa.dogIsEating = true;
        if(param[20].compareTo("false") == 0)
            town.areaa.dogFollowsKid = false;
        else
            town.areaa.dogFollowsKid = true;
        if(param[21].compareTo("false") == 0)
            town.areaa.baloonFollowsKid = false;
        else
            town.areaa.baloonFollowsKid = true;
        town.m.mdifftime = Long.parseLong(param[22]);
        town.m.mstarttime = System.currentTimeMillis() - town.m.mdifftime;
        town.m.section = Integer.parseInt(param[23]);
        town.m.posx = Integer.parseInt(param[24]);
        town.m.posy = Integer.parseInt(param[25]);
        town.kid.status = Integer.parseInt(param[26]);
        town.areaa.objects.removeAllElements();
        for(int l = 0; l < param.length - 27; l++)
            town.areaa.objects.addElement("" + param[27 + l]);

        town.mode = 1;
        display.setCurrent(town);
    }

    private void saveGame()
    {
        String sb = town.kid.posx + "_" + town.kid.posy + "_" + town.areaa.section;
        sb = sb + "_" + town.areaa.posFlowersx + "_" + town.areaa.posFlowersy + "_" + town.areaa.sectionFlowers;
        sb = sb + "_" + town.areaa.posBonex + "_" + town.areaa.posBoney + "_" + town.areaa.sectionBone;
        sb = sb + "_" + town.areaa.posLeadx + "_" + town.areaa.posLeady + "_" + town.areaa.sectionLead;
        sb = sb + "_" + town.areaa.posBaloonx + "_" + town.areaa.posBaloony + "_" + town.areaa.sectionBaloon;
        sb = sb + "_" + town.areaa.posDogx + "_" + town.areaa.posDogy + "_" + town.areaa.sectionDog;
        sb = sb + "_" + town.areaa.dogIsAngry;
        sb = sb + "_" + town.areaa.dogIsEating;
        sb = sb + "_" + town.areaa.dogFollowsKid;
        sb = sb + "_" + town.areaa.baloonFollowsKid;
        sb = sb + "_" + town.m.mdifftime;
        sb = sb + "_" + town.m.section;
        sb = sb + "_" + town.m.posx;
        sb = sb + "_" + town.m.posy;
        sb = sb + "_" + town.kid.status;
        for(int i = 0; i < town.areaa.objects.size(); i++)
            sb = sb + "_" + town.areaa.objects.elementAt(i);

        byte data[] = sb.getBytes();
        Alert alert = new Alert("Saving Game");
        alert.setImage(botton);
        try
        {
            RecordStore rstore = RecordStore.openRecordStore("wien", true);
            int nextid = rstore.getNextRecordID();
            if(nextid == 1)
                rstore.addRecord(data, 0, data.length);
            else
                rstore.setRecord(1, data, 0, data.length);
            alert.setString("\nGame Saved");
        }
        catch(RecordStoreException rse)
        {
            System.out.println("RSM exception");
            alert.setString("\ne" + rse.getMessage());
        }
        display.setCurrent(alert);
    }

    public void commandAction(Command c, Displayable d)
    {
        String label = c.getLabel();
        if(label.equals("Menu"))
        {
            display.setCurrent(menu);
            return;
        }
        if(label.equals("Home"))
        {
            town.mode = 0;
            display.setCurrent(town);
            return;
        }
        if(!label.equals("Ok"));
        switch(menu.getSelectedIndex())
        {
        case 0: // '\0'
            setPlay();
            break;

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

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

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

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

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

        case 6: // '\006'
            town.mode = 0;
            display.setCurrent(town);
            break;

        case 7: // '\007'
            destroyApp(true);
            break;
        }
    }
}

⌨️ 快捷键说明

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