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

📄 begincontrol.java

📁 游戏说明
💻 JAVA
字号:
package com.tianxia.qipai.control.universal;

import javax.microedition.lcdui.Display;

import com.tianxia.qipai.MobileGameMidlet;
import com.tianxia.qipai.control.MainControl;
import com.tianxia.qipai.event.*;
import com.tianxia.qipai.model.universal.*;
import com.tianxia.qipai.model.util.*;
import com.tianxia.qipai.view.universal.*;

public class BeginControl  implements GameEventDeal{   //从游戏启动到用户选择子游戏列表的控制器
	private Display display;                  //屏幕
	private CommStructNode commstructnode;		//各控制模块之间数据字段data的通信结构节点
	private MainControl maincontrol;			//主控制模块,通过调用它的handEvent方法来与主控制模块通信
	private static BeginControl instance;     //自身的实例
	private MainGameEvent maingameevent;       //本模块要用的事件事例
	private WelcomeView welcomeview; 			//游戏欢迎视图
	private RegView regview;                   //游戏注册登录视图
	public Runtime rt = Runtime.getRuntime();
	public BeginControl() {
		super();
		// TODO 自动生成构造函数存根
	}

	public void init(MainControl maincontrol){
		this.maincontrol = maincontrol;	
		display = maincontrol.getDisplay();
	}

	public static synchronized BeginControl getInstance(){
	if(instance == null){
			instance = new BeginControl();
		}
		return instance;
	}
	
	public Display getDisplay(){
		return this.display;
	}
	
	public MainGameEvent getMainGameEvent(){
		return this.maingameevent;
	}
	
	public void handleEvent(int eventID, MainGameEvent e){
		System.out.println("freeMory:  "+String.valueOf(rt.freeMemory()));
		switch(eventID){
			case UniGameEvent.MAINGAMESTART:	     //游戏开始,显示欢迎界面
				this.maingameevent = e;
				welcomeview = new WelcomeView(this);
				display.setCurrent(welcomeview);
					break;
			
			case UniGameEvent.MAINGAMEPAUSE:
				
					break;
			
			case UniGameEvent.MAINGAMEEXIT:
				maincontrol.handleEvent(MainGameEvent.MAINGAMEEXIT,e);
				break;
		
			case UniGameEvent.WELCOMEVIEWEXIT:     //欢迎界面退出,显示注册或登陆界面
				this.maingameevent = e;
				welcomeview.setNull();
				welcomeview = null;
				rt.gc();
				regview = new RegView(this);
				break;
			
			case UniGameEvent.DATAMODIFYREQ:    //用户资料修改请求
				this.maingameevent = e;
				regview.handleEvent(UniGameEvent.DATAMODIFYREQ,maingameevent);
				break;
			case UniGameEvent.MODIFYSUCCESSFUL:   //用户资料修改成功
				this.maingameevent = e;
				maincontrol.handleEvent(UniGameEvent.MODIFYSUCCESSFUL,maingameevent);
				break;
			case UniGameEvent.GAMELISTVIEWEXIT:
				this.maingameevent = e;
				maincontrol.handleEvent(UniGameEvent.SUBCONTROLSWITCH,maingameevent);
				break;
			
			case UniGameEvent.SUBMODELEXIT:   //返回游戏列表
				this.maingameevent = e;
				regview.handleEvent(UniGameEvent.SUBMODELEXIT,maingameevent);
				break;
			case UniGameEvent.BELOGOUT:  //用户被注销
				this.maingameevent = e;
				maincontrol.handleEvent(UniGameEvent.BELOGOUT,maingameevent);
				break;
			default:
					break;
			}
	}
	
		
}

⌨️ 快捷键说明

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