Exemple #1
0
//         public void CallBack(object obj)
//         {
//             GameStateType state = (GameStateType)obj;
//             SetStateTo(state);
//         }

        public void Enter()
        {
            if (mNextState == GameStateType.GS_Continue)
            {
                return;
            }

            SetStateTo(GameStateType.GS_Continue);

            //加载UI
            mUIRoot = GameMethod.LoadProgress();
            LoadScene.Instance.GState        = mNextState;
            LoadScene.Instance.OnLoadFinish += LoadFinish;


            //加载场景之前需要进行清除操作
            BlGame.Effect.EffectManager.Instance.DestroyAllEffect();
            //清除GameObjectPool数据
            GameObjectPool.Instance.Clear();

            //加载场景
            if (mNextState == BlGame.GameState.GameStateType.GS_Play)
            {
                LoadScene.Instance.isCloseBySelf = false;
                string name = GetLoadMapName();
                LoadScene.Instance.LoadAsignedSene("Scenes/" + name);

                WindowManager.Instance.ChangeScenseToPlay(mFrontScenes);
            }
            else
            {
                //返回Pvp_Login选人界面需要清除预加载信息
                ReadPreLoadConfig.Instance.Clear();

                LoadScene.Instance.isCloseBySelf = true;
                LoadScene.Instance.LoadAsignedSene("Scenes/Pvp_Login");

                WindowManager.Instance.ChangeScenseToLogin(mFrontScenes);
            }
            //AudioClip clip = Resources.Load(AudioDefine.PATH_UIBGSOUND) as AudioClip;
            //AudioManager.Instance.PlayBgAudio(clip);

            ResourceUnit clipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_UIBGSOUND, ResourceType.ASSET);
            AudioClip    clip     = clipUnit.Asset as AudioClip;

            AudioManager.Instance.PlayBgAudio(clip);

            EventCenter.AddListener(EGameEvent.eGameEvent_ConnectServerFail, OnConnectServerFail);
            EventCenter.AddListener <CEvent>(EGameEvent.eGameEvent_IntoRoom, OnEvent);
        }
Exemple #2
0
        public void Enter()
        {
            if (mNextState == GameStateTypeEnum.Continue)
            {
                return;
            }

            SetStateTo(GameStateTypeEnum.Continue);

            //加载UI
            mUIRoot = GameMethod.LoadProgress();
            LoadScene.Instance.GState        = mNextState; //狀態賦值
            LoadScene.Instance.OnLoadFinish += LoadFinish; //委託賦值   LoadFinish 封裝了設置狀態函數

            //加载场景之前需要进行清除操作
            Thanos.Effect.EffectManager.Instance.DestroyAllEffect();
            //清除GameObjectPool数据
            ObjectPool.Instance.Clear();

            //加载场景  如果下一个状态是战斗状态  加载战斗场景
            if (mNextState == Thanos.GameState.GameStateTypeEnum.Play)
            {
                LoadScene.Instance.isCloseBySelf = false;
                string name = GetLoadMapName();
                LoadScene.Instance.LoadAsignedSene("Scenes/" + name);
                //Play UI窗口加载
                WindowManager.Instance.ChangeScenseToPlay(mFrontScenes);
            }
            else
            {
                //返回Pvp_Login选人界面需要清除预加载信息
                ReadPreLoadConfig.Instance.Clear();
                LoadScene.Instance.isCloseBySelf = true;
                LoadScene.Instance.LoadAsignedSene("Scenes/Pvp_Login");//加载指定场景
                //Login UI窗口加载
                WindowManager.Instance.ChangeScenseToMain(mFrontScenes);
            }
            //音频播放
            ResourceItem clipUnit = ResourcesManager.Instance.loadImmediate(AudioDefine.PATH_UIBGSOUND, ResourceType.ASSET);
            AudioClip    clip     = clipUnit.Asset as AudioClip;

            AudioManager.Instance.PlayBgAudio(clip);

            //事件添加
            EventCenter.AddListener((Int32)GameEventEnum.ConnectServerFail, OnConnectServerFail);
            EventCenter.AddListener <FEvent>((Int32)GameEventEnum.IntoRoom, OnEvent);
        }