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

📄 splash.java

📁 扫雷...不用介绍了吧. 压缩包里面有截图直接在WTK里面使用
💻 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:   Splash.java

package com.innograte.j2me.games.minefield;

import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.*;

// Referenced classes of package com.innograte.j2me.games.minefield:
//            MinefieldMidlet, HighScore

public class Splash extends Canvas
    implements CommandListener
{
    class Animator extends TimerTask
    {

        int timeElapsed;

        public void run()
        {
            timeElapsed += 50;
            switch(status)
            {
            default:
                break;

            case 1: // '\001'
                if(timeElapsed > 1500)
                {
                    status = 2;
                    paint();
                } else
                {
                    paint();
                }
                break;

            case 3: // '\003'
                if(fadingOffsetX >= canvasWidth / 2)
                {
                    timer.cancel();
                    bombsMidlet.startMineCanvas();
                } else
                {
                    fadingOffsetX += canvasWidth / 15;
                    fadingOffsetY += canvasHeight / 15;
                    paint();
                }
                break;
            }
        }

        Animator()
        {
            timeElapsed = 0;
        }
    }


    public static final byte LOGO = 1;
    public static final byte SPLASH = 2;
    public static final byte FADING = 3;
    byte status;
    short canvasHeight;
    short canvasWidth;
    public Command startGameCommand;
    public Command difficultyCommand;
    public Command highScoreCommand;
    public Command helpCommand;
    public Command aboutCommand;
    public Command quitCommand;
    private Command backCommand;
    MinefieldMidlet bombsMidlet;
    Animator splashAnimator;
    Timer timer;
    Image logoImage;
    Image splashImage;
    Image splashBuffer;
    Graphics splashBufferGraphics;
    short fadingOffsetX;
    short fadingOffsetY;
    List difficultyList;

    public Splash(MinefieldMidlet bombsmidlet, byte aStatus)
    {
        startGameCommand = new Command("Start Game", 1, 1);
        difficultyCommand = new Command("Difficulty Level", 1, 2);
        highScoreCommand = new Command("High Scores", 1, 3);
        helpCommand = new Command("Help", 1, 4);
        aboutCommand = new Command("About", 1, 5);
        quitCommand = new Command("Quit", 6, 9);
        backCommand = new Command("Back", 2, 1);
        fadingOffsetX = 0;
        fadingOffsetY = 0;
        difficultyList = new List("Difficulty Level", 3, MinefieldMidlet.DIFFICULTY_STRINGS, null);
        bombsMidlet = bombsmidlet;
        status = aStatus;
        try
        {
            canvasHeight = (short)getHeight();
            canvasWidth = (short)getWidth();
            logoImage = Image.createImage("/images/logo.png");
            splashImage = Image.createImage("/images/splash.png");
            splashBuffer = Image.createImage(canvasWidth, canvasHeight);
            splashBufferGraphics = splashBuffer.getGraphics();
            setCommandListener(this);
            addCommand(startGameCommand);
            addCommand(difficultyCommand);
            addCommand(highScoreCommand);
            addCommand(helpCommand);
            addCommand(aboutCommand);
            addCommand(quitCommand);
            timer = new Timer();
            timer.schedule(new Animator(), 50L, 50L);
            paint();
        }
        catch(Exception exception)
        {
            exception.printStackTrace();
        }
    }

    public void commandAction(Command command, Displayable displayable)
    {
        if(command == startGameCommand)
            status = 3;
        else
        if(command == difficultyCommand)
        {
            difficultyList.setSelectedIndex(bombsMidlet.difficultyLevel, true);
            difficultyList.setCommandListener(this);
            Display.getDisplay(bombsMidlet).setCurrent(difficultyList);
        } else
        if(command == List.SELECT_COMMAND)
        {
            bombsMidlet.difficultyLevel = difficultyList.getSelectedIndex();
            Display.getDisplay(bombsMidlet).setCurrent(this);
            status = 3;
        } else
        if(command == quitCommand)
        {
            timer.cancel();
            MinefieldMidlet.quit();
        } else
        if(command == highScoreCommand)
            bombsMidlet.highScore.displayHighScore(this);
        else
        if(command == helpCommand)
        {
            Form form = new Form("Help");
            form.append("Try to uncover the location of all the mines as fast as possible without setting one off. Use the arrow keys to move the pointer and the left function key to uncover the square. Use the number 9 key to flag squares and 7 to clear all close to flag.");
            form.addCommand(backCommand);
            form.setCommandListener(this);
            Display.getDisplay(bombsMidlet).setCurrent(form);
        } else
        if(command == aboutCommand)
        {
            Form form1 = new Form("About");
            form1.append(String.valueOf(String.valueOf((new StringBuffer("Minefield version ")).append(MinefieldMidlet.VERSION).append(" by Patrik Ekstr\366m, Innograte AB 2002."))));
            form1.addCommand(backCommand);
            form1.setCommandListener(this);
            Display.getDisplay(bombsMidlet).setCurrent(form1);
        } else
        if(command == backCommand)
            Display.getDisplay(bombsMidlet).setCurrent(this);
    }

    public void paint()
    {
        switch(status)
        {
        default:
            break;

        case 2: // '\002'
            splashBufferGraphics.setColor(255, 255, 255);
            splashBufferGraphics.fillRect(0, 0, canvasWidth, canvasHeight);
            splashBufferGraphics.drawImage(splashImage, canvasWidth / 2, canvasHeight / 2, 3);
            break;

        case 3: // '\003'
            splashBufferGraphics.setColor(255, 255, 255);
            splashBufferGraphics.fillRect(0, 0, canvasWidth, canvasHeight);
            if(fadingOffsetX < canvasWidth / 2 && fadingOffsetY < canvasHeight / 2)
            {
                splashBufferGraphics.setClip(fadingOffsetX, fadingOffsetY, canvasWidth - fadingOffsetX * 2, canvasHeight - fadingOffsetY * 2);
                splashBufferGraphics.drawImage(splashImage, 0, 0, 20);
            }
            break;

        case 1: // '\001'
            splashBufferGraphics.setColor(255, 255, 255);
            splashBufferGraphics.fillRect(0, 0, canvasWidth, canvasHeight);
            splashBufferGraphics.drawImage(logoImage, canvasWidth / 2, canvasHeight / 2, 3);
            break;
        }
        repaint();
    }

    public void paint(Graphics g)
    {
        g.drawImage(splashBuffer, 0, 0, 20);
    }

//    static 
//    {
//        LOGO = 1;
//        SPLASH = 2;
//        FADING = 3;
//    }
}

⌨️ 快捷键说明

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