예제 #1
0
 void OnApplicationQuit()
 {
     PlayerManager.GetSingleton().Clear();
     ClientService.GetSingleton().Disconnect();
     SceneMachine.GetSingleton().Destroy();
     Application.Quit();
 }
예제 #2
0
        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);
        }
예제 #3
0
        private void NotifyCharacterEnd()
        {
            GameScene mScene = SceneMachine.GetCurrentScene() as GameScene;

            if (mScene != null)
            {
                mScene.NotifySceneEvent(new EventEX <Player>((int)SceneEventType.SE_CharacterEnd, this));
            }
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        TimerHeap.Tick();

        ClientService.GetSingleton().Update();

        SceneMachine.GetSingleton().OnUpdate();

        PlayerManager.GetSingleton().OnUpdate();
    }
예제 #5
0
    void Awake()
    {
        DontDestroyOnLoad(gameObject);


        WindowManager.GetSingleton();

        SceneMachine.GetSingleton().Init();

        SceneMachine.GetSingleton().ChangeScene(GameSceneType.FrameScene);
    }
예제 #6
0
        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);
        }
예제 #7
0
        /// <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();
        }
예제 #8
0
 public void RegisterSceneEvent()
 {
     mScene = SceneMachine.GetCurrentScene() as GameScene;
 }