Beispiel #1
0
        public override IScenceType AddComponent()
        {
            IScenceType curScence  = null;
            UnityLogic  unityLogic = CommonLogicData.UnityLogic;

            if (unityLogic != null)
            {
                curScence = unityLogic.AddCompent(ScenceType.Room_Scene);
            }

            return(curScence);
        }
Beispiel #2
0
    public IScenceType AddCompent(ScenceType type)
    {
        IScenceType curScence = null;

        if (CSceneBehaviour.Current != null)
        {
            switch (type)
            {
            case ScenceType.Room_Scene:
                curScence = CSceneBehaviour.Current.gameObject.AddComponent <RoomScene>();
                break;
            }
        }

        return(curScence);
    }
Beispiel #3
0
        static bool m_IsSwitch = false;                          // 是否在切换场景中 true 表示切换中

        /// <summary>
        /// 切换场景
        /// </summary>
        public static IEnumerator SwitchToScence(object obj)
        {
            SceneSwitchBase sceneSwitcher = obj as SceneSwitchBase;
            IEnumerator     itor          = null;

            if (sceneSwitcher != null)
            {
                if (sceneSwitcher != null)
                {
                    if (sceneSwitcher.CanSwitch)
                    {
                        itor = sceneSwitcher.OnReleaseCachedData();
                        while (itor.MoveNext())
                        {
                            yield return(null);
                        }

                        //itor = sceneSwitcher.PrepareSwitch();
                        //while (itor.MoveNext())
                        //{
                        //    yield return null;
                        //}

                        sceneSwitcher.IsCreatingScene = true;

                        itor = SwitchingControl.ShowSwitching(true, 100);
                        while (itor.MoveNext())
                        {
                            yield return(null);
                        }

                        //itor = sceneSwitcher.BeginSwitch();
                        //while (itor.MoveNext())
                        //{
                        //    yield return null;
                        //}

                        //itor = unityLogic.DestoryAllUIAsync();
                        //while (itor.MoveNext())
                        //{
                        //    yield return null;
                        //}

                        itor = sceneSwitcher.LoadSceneAnimation();
                        while (itor.MoveNext())
                        {
                            yield return(null);
                        }

                        if (!string.IsNullOrEmpty(sceneSwitcher.SceneName))
                        {
                            itor = SceneLoader.LoadStageScene(sceneSwitcher.SceneName);
                            while (itor.MoveNext())
                            {
                                yield return(null);
                            }
                        }
                        else
                        {
                            Debug.LogError("SceneSwitchBase.SwitchToScence SceneName can not be null");
                        }

                        IScenceType curScene = sceneSwitcher.AddComponent();

                        //itor = sceneSwitcher.CreateScenePlayer();
                        //while (itor.MoveNext())
                        //{
                        //    yield return null;
                        //}

                        if (curScene != null)
                        {
                            SceneBehaviourBase sceneBehaviourBase = CommonLogicData.CurrentSceneBehaviour;
                            if (sceneBehaviourBase != null)
                            {
                                sceneBehaviourBase.CurScene = curScene;
                            }
                            itor = curScene.IEPlayerEnterScene(true);
                            while (itor.MoveNext())
                            {
                                yield return(null);
                            }
                        }

                        itor = sceneSwitcher.PrepareUIAndData();
                        while (itor.MoveNext())
                        {
                            yield return(null);
                        }

                        sceneSwitcher.IsCreatingScene = false;

                        itor = sceneSwitcher.FinishSwitch();
                        while (itor.MoveNext())
                        {
                            yield return(null);
                        }

                        SwitchingControl.HideSwitching();
                        //unityLogic.HideSwitching();
                    }
                    else
                    {
                        Debug.LogError("SceneSwitchMgr.SwitchToScence unityLogic can not be null");
                    }
                }
                else
                {
                    Debug.LogError("SceneSwitchMgr.SwitchToScence sceneSwitcher can not be null");
                }
            }
        }