import java.io.*;
import java.util.*;
import com.nokia.mid.ui.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
//import com.nokia.mid.sound.Sound;
//import javax.microedition.media.control.VolumeControl;
import com.nokia.mid.ui.*;
import java.util.*;
import javax.microedition.media.*;
public class numencanva
extends FullCanvas {
// protected final int N3650 = 1;
protected final int N7650 = 0;
// protected final int platform
// = ("nokia3650".equals(System.getProperty("microedition.platform").
// toLowerCase())) ? N3650 : N7650;
//****************************************************************************
//角色左右方向
//****************************************************************************
private final int DIRECT_LEFT = -1;
private final int DIRECT_RIGH = 1;
private final int DIRECT_OVER = 2;
private final int DIRECT_DOWN = 3;
private final int DIRECT_LEFTOVER = 4;
private final int DIRECT_LEFTDOWN = 5;
private final int DIRECT_RIGHOVER = 6;
private final int DIRECT_RIGHDOWN = 7;
//****************************************************************************
//资源索引
//****************************************************************************
private final int FACE_MENUCOVER = 0;
private final int FACE_MENUTITLE = 1; //主菜单中央标题文字
private final int FACE_FONT_MIDDLE = 2; //数字字体-中等大小
private final int FACE_FONT_GREATE = 3; //数字字体-最大
private final int FACE_GAME_OVER = 4; //游戏任务失败的画面
private final int FACE_TOU1 = 5;
private final int FACE_TOU2 = 6;
private final int FACE_ANIMASLOT = 7; //上面的头什么的
private final int FACE_ANIMASLOT1 = 8; //上面的头2什么的
private final int FACE_ANIMASLOT2 = 9; //血条
private final int FACE_ANIMASLOT3 = 10; //血
private final int FACE_KKX = 11; //卡卡西
private final int FACE_KUAN = 12; //对话筐
private final int FACE_ANIMASLOT4 = 13; //生命
// private final int FACE = 8; //动画3
//
// private final int FACE_4 = 9; //动画4
// private final int FACE_MOV1 = 10; //动画1
// private final int FACE_MOV2 = 11; //动画2
private final int FACE_PROP_ICON = 14; //道具图标图形
private final int FACE_JIAN1 = 15; //道具图标图形
private final int FACE_JIAN2 = 16; //道具图标图形
// private final int FACE_BIGCANNON = 16; //飞机坦克用的炮管
// private final int FACE_ZIZOU_GUN = 17; //自走炮的图形
//****************************************************************************
/** @todo:构造函数 */
//******************************* *********************************************
Image sp = null;
// private boolean isEnd1 = false;
// private EffectFunction effect;
public numencanva() {
try {
logo = Image.createImage("/logo.png");
sp = Image.createImage("/sp.png");
}
catch (IOException ex) {
}
// effect = new EffectFunction(176, 208);
face_load();
screen_index = -10;
}
//****************************************************************************
/** @todo: 框架代码 */
//****************************************************************************
private int screen_index = 0;
private boolean process_lock = false;
private final int SCREEN_MAINMENU = 0; //主菜单页面
private final int SCREEN_GAMEBODY = 1; //游戏页面
private final int SCREEN_HELPINFO = 2; //帮助页面
private final int SCREEN_COPYRIGH = 3; //版权信息
private final int SCREEN_GAMEOVER = 4; //游戏结束
private final int SCREEN_HIGHLIST = 5; //排行榜
private final int SCREEN_SELEGATE = 6; //选择关卡
private final int SCREEN_RESSLOAD = 7; //资源装载页面
/**********************************************
*
**********************************************/
protected final void process_set(int index) {
process_lock = true;
switch (screen_index) {
case SCREEN_GAMEBODY:
gamebody_free();
break;
// case SCREEN_MAINMENU: mainmenu_free(); break;
// case SCREEN_HELPINFO: helpinfo_free(); break;
// case SCREEN_COPYRIGH: copyrigh_free(); break;
// case SCREEN_GAMEOVER: gameover_free(); break;
// case SCREEN_HIGHLIST: highlist_free(); break;
// case SCREEN_RESSLOAD: ressload_free(); break;
// case SCREEN_SELEGATE: selegate_free(); break;
}
screen_index = index;
switch (index) {
case SCREEN_GAMEBODY:
gamebody_init();
break;
case SCREEN_MAINMENU:
mainmenu_init();
break;
case SCREEN_HELPINFO:
helpinfo_init();
break;
case SCREEN_COPYRIGH:
copyrigh_init();
break;
case SCREEN_HIGHLIST:
highlist_init();
break;
case SCREEN_SELEGATE:
selegate_init();
break;
// case SCREEN_GAMEOVER: gameover_init(); break;
// case SCREEN_RESSLOAD: ressload_init(); break;
}
process_lock = false;
}
/**********************************************
* 状态处理
**********************************************/
int loop = 0;
Image logo = null;
public final void process_tick() {
if (process_lock) {
return;
}
switch (screen_index) {
case -10:
if (loop > 20) {
screen_index = -9;
logo = null;
System.gc();
loop = 0;
repaint();
}
else {
loop++;
}
break;
case -9:
if (loop > 20) {
process_set(SCREEN_MAINMENU);
sp = null;
System.gc();
loop = 0;
}
else {
loop++;
}
break;
case -8:
tttt = !tttt;
refresh();
break;
case SCREEN_GAMEBODY:
gamebody_run();
break;
case SCREEN_MAINMENU:
mainmenu_run();
break;
case SCREEN_HELPINFO:
helpinfo_run();
break;
case SCREEN_COPYRIGH:
copyrigh_run();
break;
case SCREEN_GAMEOVER:
gameover_run();
break;
case SCREEN_HIGHLIST:
highlist_run();
break;
case SCREEN_RESSLOAD:
ressload_exec();
break;
case SCREEN_SELEGATE:
selegate_run();
break;
}
}
/**********************************************
* 按键处理
**********************************************/
protected final void process_key(int keycode) {
if (process_lock) {
return;
}
switch (screen_index) {
case -10:
// process_set(SCREEN_RESSLOAD);
screen_index = -9;
repaint();
logo = null;
System.gc();
loop = 0;
break;
case -9:
process_set(SCREEN_MAINMENU);
// screen_index = -8;
repaint();
sp = null;
System.gc();
loop = 0;
break;
case -8:
switch (keycode) {
case KEY_LEFT:
case KEY_RIGH:
if (id == 0) {
id = 1;
}
else {
id = 0;
}
refresh();
break;
case KEY_FIRE:
case KEY_SOFT1:
process_set(SCREEN_RESSLOAD);
break;
}
// mainmenu_execute(mainmenu_index);
// process_set(SCREEN_RESSLOAD);
break;
case SCREEN_GAMEBODY:
gamebody_key(keycode);
break;
case SCREEN_MAINMENU:
mainmenu_key(keycode);
break;
case SCREEN_HELPINFO:
helpinfo_key(keycode);
break;
case SCREEN_COPYRIGH:
copyrigh_key(keycode);
break;
case SCREEN_GAMEOVER:
gameover_key(keycode);
break;
case SCREEN_HIGHLIST:
highlist_key(keyco
评论0
最新资源