void OnApplicationQuit() { PlayerManager.GetSingleton().Clear(); ClientService.GetSingleton().Disconnect(); SceneMachine.GetSingleton().Destroy(); Application.Quit(); }
public void GotoScene(SceneType type) { m_CurrentSceneType = type; string tmpSceneName = type.ToString(); if (SceneMachine == null) { SceneMachine = SceneMachine.GetSingleton(); } GameScene tmpScene = SceneMachine.GetState(tmpSceneName) as GameScene; if (tmpScene == null) { return; } GameScene tmpCurrentScene = SceneMachine.GetCurrentScene() as GameScene; if (tmpCurrentScene == tmpScene) { //两次跳转的场景相同,则返回; return; } SceneMachine.SetNextState(tmpScene.pStateName); }
private void NotifyCharacterEnd() { GameScene mScene = SceneMachine.GetCurrentScene() as GameScene; if (mScene != null) { mScene.NotifySceneEvent(new EventEX <Player>((int)SceneEventType.SE_CharacterEnd, this)); } }
// Update is called once per frame void Update() { TimerHeap.Tick(); ClientService.GetSingleton().Update(); SceneMachine.GetSingleton().OnUpdate(); PlayerManager.GetSingleton().OnUpdate(); }
void Awake() { DontDestroyOnLoad(gameObject); WindowManager.GetSingleton(); SceneMachine.GetSingleton().Init(); SceneMachine.GetSingleton().ChangeScene(GameSceneType.FrameScene); }
private void RegisterSceneEvent() { mScene = SceneMachine.GetCurrentScene() as GameScene; if (mScene != null) { mScene.RegisterSceneEvent(SceneEventType.SE_NotifyTSDKLoginSucceed, TSDKLoginSuccees); mScene.RegisterSceneEvent(SceneEventType.SE_NotifyTSDKLoginFail, OnLoginFail); mScene.RegisterSceneEvent(SceneEventType.SE_NotifyStartTSDKLogin, OnStartLogin); mScene.RegisterSceneEvent(SceneEventType.SE_NotifyVersionUpdate, OnStatrVersionCheck); mScene.RegisterSceneEvent(SceneEventType.SE_NotifyConfigCheck, StartConfigCheck); } mGlobalEventQueue = new EventHandlerQueue(CrossContextEventProcessor.GetInstance()); mGlobalEventQueue.Add((int)CrossContextEventType.GE_NetWorkState, OnNetWorkState); }
/// <summary> /// Initilize our game here. /// </summary> void InitGame() { Application.targetFrameRate = 30; // disable vsync and set target frame rate to 30fps Screen.sleepTimeout = SleepTimeout.NeverSleep; // keep the screen always display // initiaize SceneMachine and register scenes SceneMachine = SceneMachine.GetSingleton(); SceneMachine.RegisterState(new LoginScene()); SceneMachine.RegisterState(new MainScene()); // ModuleManager.GetInstance().CreateContext<LoginContext>(); //LoginContext<LoginModuleController, LoginViewController> context = ModuleManager.GetInstance().CreateViewContext<LoginModuleController, LoginViewController>() as LoginContext<LoginModuleController, LoginViewController>; //LoginContext<LoginController, LoginViewController> loginContext = ContextManager.GetInstance().Add<LoginContext<LoginController, LoginViewController>>(); //ContextManager.GetInstance().Add<ResContext<ResController>>(); Air2000.Res.ResContext.ListenInitializeFinish += OnResourceManagerInitialized; Air2000.Res.ResContext.Initialize(); }
public void RegisterSceneEvent() { mScene = SceneMachine.GetCurrentScene() as GameScene; }