📄 gameoverform.java
字号:
package GameTest;
import java.io.IOException;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
public class GameOverForm extends Form implements CommandListener {
Image alertImage = null;
public GameOverForm(String c) {
super("Game Over");
String message = "";
if (FirstGame.score > 100) {
message = "\n" + "You did a good job! Congratulation!";
} else if (FirstGame.score > 50) {
message = "\n good";
} else {
message = "\n 加油,继续努力!";
}
String alertMessage = FirstGame.userName + "\n" + "Your Score "
+ FirstGame.score + "\n" + "You have killed "
+ FirstGame.killEnemyNum + " enemies!" + "\n"
+ "But, you lose " + FirstGame.loseNum + " enemies!" + "\n"
+ message;
try {
alertImage = Image.createImage("/res/" + "gameover.png");
} catch (IOException e) {
e.printStackTrace();
}
addCommand(new Command("EXIT", Command.EXIT, 0));
append(alertImage);
append(alertMessage);
this.setCommandListener(this);
}
public void commandAction(Command c, Displayable arg1) {
Navigator.flow(c.getLabel());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -