📄 titlecanvas.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
import com.nokia.mid.ui.FullCanvas;
import java.io.IOException;
import java.util.Timer;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
public class TitleCanvas extends FullCanvas
implements CommandListener
{
Image titleImg[];
Image bufImg;
Image commandImg;
Image copy;
GameMain gameMain;
Graphics bufg;
Form set;
Form about;
Form contact;
Form keymap;
List menuList;
Font font;
String arrayStr[] = {
"Start Game", "Sound", "High Scores", "About", "Key Map", "Contact Us", "Exit"
};
Command backCmd;
Command okCmd;
Command cancelCmd;
short height;
short width;
short v;
short w;
boolean keyFlag;
boolean key2;
public TitleCanvas(GameMain gamemain)
{
titleImg = new Image[3];
backCmd = new Command("Back", 2, 1);
okCmd = new Command("OK", 2, 1);
cancelCmd = new Command("Cancel", 3, 1);
gameMain = gamemain;
height = (short)getHeight();
width = (short)getWidth();
bufImg = Image.createImage(width, width);
bufg = bufImg.getGraphics();
try
{
if(!gamemain.resumeFlag)
{
titleImg[0] = Image.createImage("/img/title_1.png");
titleImg[1] = Image.createImage("/img/title_2.png");
titleImg[2] = Image.createImage("/img/title_copy.png");
}
copy = Image.createImage("/img/menu/copy.png");
}
catch(IOException ioexception) { }
menuList = new List("Menu", 3);
if(gamemain.resumeFlag)
menuList.append("Continue", null);
else
menuList.append("Start Game", null);
if(gamemain.soundFlag)
menuList.append("Sound : ON", null);
else
menuList.append("Sound : OFF", null);
menuList.append("High Scores", null);
menuList.append("About", null);
menuList.append("Key Map", null);
menuList.append("Contact Us", null);
menuList.append("Exit", null);
menuList.setCommandListener(this);
}
protected void keyPressed(int i)
{
if((i == -6 || keyFlag && i == -7) && !key2)
{
keyFlag = false;
gameMain.display.setCurrent(menuList);
}
}
public void commandAction(Command command, Displayable displayable)
{
if(command == List.SELECT_COMMAND)
{
if(displayable == menuList)
switch(menuList.getSelectedIndex())
{
case 0: // '\0'
if(!gameMain.resumeFlag)
{
gameMain.gameFlag = 0;
gameMain.loading = new Loading(gameMain);
gameMain.timer.schedule(gameMain.loading, 0L, 20L);
gameMain.display.setCurrent(gameMain.titleCanvas);
gameMain.resumeFlag = false;
key2 = true;
} else
{
gameMain.display.setCurrent(gameMain.gameCanvas);
gameMain.titleCanvas = null;
gameMain.resumeFlag = false;
}
break;
case 1: // '\001'
menuList = null;
menuList = new List("Menu", 3);
if(gameMain.resumeFlag)
menuList.append("Continue", null);
else
menuList.append("Start Game", null);
if(gameMain.soundFlag)
{
gameMain.soundFlag = false;
menuList.append("Sound : OFF", null);
} else
{
gameMain.soundFlag = true;
menuList.append("Sound : ON", null);
}
menuList.append("High Scores", null);
menuList.append("About", null);
menuList.append("Key Map", null);
menuList.append("Contact Us", null);
menuList.append("Exit", null);
menuList.setCommandListener(this);
menuList.setSelectedIndex(1, true);
gameMain.display.setCurrent(gameMain.titleCanvas.menuList);
break;
case 2: // '\002'
if(gameMain.scoreBoard == null)
gameMain.scoreBoard = new ScoreBoard(gameMain);
gameMain.display.setCurrent(gameMain.scoreBoard);
break;
case 3: // '\003'
if(about == null)
{
about = new Form("About");
about.append("PhoneShot\n1.0.0\n-Introduction-\nA player has important information about a terror on important man. You should stop the terror without any civilian casualty with limited time.\n-How to play-\nOn screen, directions and numbers appear. The numbers are terrorists in total. By taking steps one by one, you should trace after the terrorists and shoot them.");
about.addCommand(backCmd);
about.setCommandListener(this);
}
gameMain.display.setCurrent(about);
break;
case 4: // '\004'
if(keymap == null)
{
about = new Form("Key Map");
about.append("Up : 2 or UP\nDown : 8 or DOWN\nLeft : 4 or LEFT\nRight : 6 or RIGHT\nShot : 5\nScan : 0\nMap ON/OFF : STAR");
about.addCommand(backCmd);
about.setCommandListener(this);
}
gameMain.display.setCurrent(about);
break;
case 5: // '\005'
if(contact == null)
{
contact = new Form("Contact us");
contact.append(copy);
contact.addCommand(backCmd);
contact.setCommandListener(this);
}
gameMain.display.setCurrent(contact);
break;
case 6: // '\006'
gameMain.midlet.destroyApp(true);
gameMain.midlet.notifyDestroyed();
break;
}
} else
if(command == backCmd)
{
about = null;
contact = null;
keymap = null;
gameMain.display.setCurrent(menuList);
}
}
public void paint(Graphics g)
{
if(gameMain.loading != null)
g.drawImage(bufImg, 0, 0, 0x10 | 0x4);
else
if(!gameMain.resumeFlag)
{
TitleCanvas _tmp = this;
TitleCanvas _tmp1 = this;
g.drawImage(titleImg[0], 64, 1, 0x10 | 0x1);
TitleCanvas _tmp2 = this;
TitleCanvas _tmp3 = this;
g.drawImage(titleImg[1], 0, 60, 0x10 | 0x4);
TitleCanvas _tmp4 = this;
TitleCanvas _tmp5 = this;
g.drawImage(titleImg[2], 0, 116, 0x10 | 0x4);
}
}
void bufPaint()
{
v++;
w++;
bufg.setColor(254, 255, 255);
bufg.fillRect(0, 0, width, height);
if(v < width / 2 && w < height / 2)
{
bufg.setClip(v, w, width - v * 2, height - w * 2);
TitleCanvas _tmp = this;
TitleCanvas _tmp1 = this;
bufg.drawImage(titleImg[0], 64, 1, 0x10 | 0x1);
TitleCanvas _tmp2 = this;
TitleCanvas _tmp3 = this;
bufg.drawImage(titleImg[1], 0, 60, 0x10 | 0x4);
TitleCanvas _tmp4 = this;
TitleCanvas _tmp5 = this;
bufg.drawImage(titleImg[2], 0, 116, 0x10 | 0x4);
} else
{
bufg.setFont(Font.getFont(0, 0, 8));
bufg.setClip(0, 0, width, height);
bufg.setColor(0, 0, 0);
bufg.drawString("Loading", width / 2, height / 2, 33);
bufg.drawString("Please Wait...", width / 2, height / 2, 17);
gameMain.loadingCount++;
}
repaint();
serviceRepaints();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -