📄 worms.java
字号:
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
public class Worms extends MIDlet
implements Runnable
{
static Worms instance;
private Thread thread;
public static Display WormsDisplay;
private Game game;
private Menu menu;
private Splash splash;
static short loadTimes=0;
static short runTimes=1;
protected static int KEY_LEFT[] = {
52, 2, -3
};
protected static int KEY_RIGHT[] = {
54, 5, -4
};
protected static int KEY_UP[] = {
50, 1, -1
};
protected static int KEY_DOWN[] = {
56, 6, -2
};
protected static int KEY_ENTER[] = {
20, 53, 8, -5
};
protected static int KEY_LEFT_SOFTKEY[] = {
21
};
protected static int KEY_RIGHT_SOFTKEY[] = {
22
};
public static long pauseStartTime;
public static long pauseDeltaTime;
public static long vibratorStartTime = System.currentTimeMillis();
public static boolean inPause = false;
public static boolean checkKey(int i, int ai[])
{
for(int j = 0; j < ai.length; j++)
if(ai[j] == i)
return true;
return false;
}
public static long getTime()
{
return System.currentTimeMillis() - pauseDeltaTime;
}
public Worms()
{
instance = this;
thread = new Thread(this);
thread.start();
}
public void startApp()
{
if(!inPause)
{
if(!RMS.load())
{
RMS.put("worms.setup.sound", 1);
//RMS.put("worms.setup.vibration", 1);
RMS.save();
}
Menu.optionFlags[0] = false;
if(RMS.getAsInteger("worms.setup.sound") == 1)
Menu.optionFlags[0] = true;
/*Menu.optionFlags[1] = false;
if(RMS.getAsInteger("worms.setup.vibration") == 1)
Menu.optionFlags[1] = true;*/
} else
{
inPause = false;
Game.paused = false;
Splash.paused = false;
}
}
public void run()
{
WormsDisplay = Display.getDisplay(this);
Game.sound = new Sound();
splash = new Splash();
splash.run();
splash = null;
System.gc();
FontRender.init();
menu = new Menu();
game = new Game();
do
{
if (runTimes == 0) {
System.out.println("====runTimes==worms====0==");
Landscape.currentLandscapeIndex = 0;
menu.humanVsHuman = true;
game.reset(menu.humanVsHuman);
game.run();
runTimes++;
//Game.press = true;
} else {
System.out.println("====runTimes===worms===1==");
menu.run();
//Landscape.currentLandscapeIndex = 0;
if (runTimes != 0) {
if (loadTimes == 0) {
game.reset(menu.humanVsHuman);
}
Game.press = true;
game.run();
}
}
} while(true);
}
public void pauseApp()
{
inPause = true;
Game.paused = true;
Splash.paused = true;
}
public void destroyApp(boolean flag)
{
notifyDestroyed();
instance = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -