Exemple #1
0
        public bool TrygetValue(string name, out GameSceneInfo s)
        {
            if (SceneList == null)
            {
                Init();
            }

            for (int i = 0; i < this.SceneList.Count; ++i)
            {
                GameSceneInfo scene = this.SceneList[i];
                if (scene.IsValid() && scene.name.IgnoreUpOrlower(name))
                {
                    s = scene;
                    return(true);
                }
            }

            if (!FrameWorkConfig.Open_DEBUG)
            {
                throw new FrameWorkResNotMatchException(string.Format("不存在此场景 :{0}", name));
            }

            s = default(GameSceneInfo);
            return(false);
        }
Exemple #2
0
        private bool TrygetValue(int id, out GameSceneInfo s)
        {
            if (this.SceneList == null)
            {
                Init();
            }

            for (int i = 0; i < this.SceneList.Count; ++i)
            {
                GameSceneInfo scene = this.SceneList[i];
                if (scene.IsValid() && scene.buildIndex == id)
                {
                    s = scene;
                    return(true);
                }
            }

            LogMgr.LogError(string.Format("不存在此场景 :{0}", id));

            s = default(GameSceneInfo);
            return(false);
        }
Exemple #3
0
        private void Init()
        {
            if (SceneList != null)
            {
                return;
            }

#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6
            this.SceneList = new List <GameSceneInfo>((int)AutoScenes.END);

            for (int i = 0; i < (int)AutoScenes.END; ++i)
            {
                GameSceneInfo scene = new GameSceneInfo();
                scene.buildIndex = i;
                scene.name       = ((AutoScenes)i).ToString();
                scene.SetValid();
                this.SceneList.Add(scene);
            }

            if (this.SceneList.Count > 0)
            {
            #if UNITY_EDITOR
                GameSceneInfo scene = this.SceneList.Find(p => p.buildIndex == EditorSceneManager.GetActiveScene().buildIndex);
                if (!scene.IsValid() || scene.name.Equals("END"))
                {
                    LogMgr.LogError("场景配置异常");
                    scene = new GameSceneInfo();
                    Scene current = EditorSceneManager.GetActiveScene();
                    scene.buildIndex = current.buildIndex;
                    scene.name       = current.name;
                    scene.SetValid();
                }
                this.DefaultScene = scene;
                this.CurScene     = this.DefaultScene;
            #else
                this.DefaultScene = this.SceneList[0];
                this.CurScene     = this.DefaultScene;
            #endif
            }
#else
            this.SceneList = new List <GameSceneInfo>();

            for (int i = 0; i < AutoScenes.END; ++i)
            {
                GameSceneInfo scene = new GameSceneInfo();
                scene.buildIndex = i;
                scene.name       = ((AutoScenes)i).ToString();
                scene.SetValid();
                this.SceneList.Add(scene);
            }

            if (this.SceneList.Count > 0)
            {
#if UNITY_EDITOR
                GameSceneInfo scene = this.SceneList.Find(p => p.name == EditorApplication.currentScene);
                this.DefaultScene = scene;
                this.CurScene     = this.DefaultScene;
#else
                this.DefaultScene = this.SceneList[0];
                this.CurScene     = this.DefaultScene;
#endif
            }
#endif
        }