//------------------------------------------------------------------------- void _destory() { if (mEngine == null) { return; } if (mEngine != null) { mEngine.close(); mEngine = null; } if (UiMgr != null) { UiMgr.destroy(); UiMgr = null; } if (mSoundMgr != null) { mSoundMgr.destroy(); mSoundMgr = null; } if (mAsyncLoadAssetMgr != null) { mAsyncLoadAssetMgr.destory(); mAsyncLoadAssetMgr = null; } Screen.sleepTimeout = SleepTimeout.SystemSetting; EbLog.Note("MbMain._destory()"); }
public void LoadLevel(string scene) { UpdateParameters(); EventMgr.Instance.Clear(); UiMgr.Clear(); actorList.Clear(); enemyList.Clear(); Application.LoadLevel(scene); }
//--------------------------------------------------------------------- public CasinosContext() { Instance = this; UiMgr = new UiMgr(); UiMgr.RegUiFactory(new UiFactoryMain()); UiMgr.CreateUi("Main"); LuaMgr = new LuaMgr(); }
//------------------------------------------------------------------------- void Start() { // 初始化系统参数 { Application.runInBackground = true; Time.fixedDeltaTime = 0.03f; Application.targetFrameRate = 60; Screen.sleepTimeout = SleepTimeout.NeverSleep; } // 初始化日志 { EbLog.NoteCallback = Debug.Log; EbLog.WarningCallback = Debug.LogWarning; EbLog.ErrorCallback = Debug.LogError; } EbLog.Note("MbMain.Start()"); // 初始化PathMgr if (mPathMgr == null) { mPathMgr = new PathMgr(); } if (mClientConfig == null) { mClientConfig = new ClientConfig(); } if (mAsyncLoadAssetMgr == null) { mAsyncLoadAssetMgr = new AsyncLoadAssetMgr(); mAsyncLoadAssetMgr.init(); } if (mEngine == null) { EcEngineSettings settings; settings.ProjectName = "Fishing"; settings.RootEntityType = "EtRoot"; settings.EnableCoSuperSocket = true; mEngine = new EcEngine(ref settings, new EcEngineListener()); } UiMgr = new UiMgr(); UiMgr.create(EntityMgr.Instance); mSoundMgr = new CSoundMgr(); // 创建EtClientApp EntityMgr.Instance.createEntity <EtApp>(null, EcEngine.Instance.EtNode); }
//------------------------------------------------------------------------- public void create(EntityMgr entity_mgr) { mUiMgr = this; EntityMgr = entity_mgr; UIConfig.defaultFont = "Microsoft YaHei"; UIPackage.AddPackage("Ui/Common"); UIPackage.AddPackage("Ui/Main"); UIPackage.AddPackage("Ui/Loading"); UIPackage.AddPackage("Ui/Login"); UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAsset("Common", "Close"); //UIConfig.verticalScrollBar = UIPackage.GetItemURL("Common", "ScrollBar_VT"); //UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ"); //UIConfig.popupMenu = UIPackage.GetItemURL("Basics", "PopupMenu"); //GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(_onKeyDown); }
//------------------------------------------------------------------------- void Update() { if (mEngine != null) { mEngine.update(Time.deltaTime); } if (UiMgr != null) { UiMgr.update(Time.deltaTime); } if (mSoundMgr != null) { mSoundMgr.update(); } if (mAsyncLoadAssetMgr != null) { mAsyncLoadAssetMgr.update(Time.deltaTime); } }
//--------------------------------------------------------------------- public void AddLog(string log) { UiMgr.GetUiMain().AddLog(log); }
//--------------------------------------------------------------------- public void Destroy() { UiMgr.Destroy(); LuaMgr.Destroy(); }
//--------------------------------------------------------------------- public void Update(float tm) { UiMgr.Update(tm); LuaMgr.Update(tm); }
//------------------------------------------------------------------------- public T genEvent <T>() where T : EntityEvent, new() { return(UiMgr.genEvent <T>()); }
//------------------------------------------------------------------------- void _destory() { if (mEngine == null) return; if (mEngine != null) { mEngine.close(); mEngine = null; } if (UiMgr != null) { UiMgr.destroy(); UiMgr = null; } if (mSoundMgr != null) { mSoundMgr.destroy(); mSoundMgr = null; } if (mAsyncLoadAssetMgr != null) { mAsyncLoadAssetMgr.destory(); mAsyncLoadAssetMgr = null; } Screen.sleepTimeout = SleepTimeout.SystemSetting; EbLog.Note("MbMain._destory()"); }
//------------------------------------------------------------------------- void Start() { // 初始化系统参数 { Application.runInBackground = true; Time.fixedDeltaTime = 0.03f; Application.targetFrameRate = 60; Screen.sleepTimeout = SleepTimeout.NeverSleep; } // 初始化日志 { EbLog.NoteCallback = Debug.Log; EbLog.WarningCallback = Debug.LogWarning; EbLog.ErrorCallback = Debug.LogError; } EbLog.Note("MbMain.Start()"); // 初始化PathMgr if (mPathMgr == null) { mPathMgr = new PathMgr(); } if (mClientConfig == null) { mClientConfig = new ClientConfig(); } if (mAsyncLoadAssetMgr == null) { mAsyncLoadAssetMgr = new AsyncLoadAssetMgr(); mAsyncLoadAssetMgr.init(); } if (mEngine == null) { EcEngineSettings settings; settings.ProjectName = "Fishing"; settings.RootEntityType = "EtRoot"; mEngine = new EcEngine(ref settings, new EcEngineListener()); } UiMgr = new UiMgr(); UiMgr.create(EntityMgr.Instance); mSoundMgr = new CSoundMgr(); // 创建EtClientApp EntityMgr.Instance.createEntity<EtApp>(null, EcEngine.Instance.EtNode); }