Ejemplo n.º 1
0
 public void UnRegister(EnumSceneType scnenId)
 {
     if (dicScneneInfo != null && IsRegister(scnenId))
     {
         dicScneneInfo.Remove(scnenId);
     }
 }
Ejemplo n.º 2
0
    private IEnumerator StartLoad(EnumSceneType _sceneType)
    {
        int            displayProgress = 0;
        int            toProgress      = 0;
        string         sceneName       = SceneManager.Instance.GetSceneName(_sceneType);
        AsyncOperation op = Application.LoadLevelAsync(sceneName);

        op.allowSceneActivation = false;
        if (op.progress < 0.9f)
        {
            toProgress = (int)op.progress * 100;
            while (displayProgress < toProgress)
            {
                ++displayProgress;
                SetLoadingPercentage(displayProgress);
                yield return(new WaitForEndOfFrame());
            }
        }

        toProgress = 100;
        while (displayProgress < toProgress)
        {
            ++displayProgress;
            SetLoadingPercentage(displayProgress);
            yield return(new WaitForEndOfFrame());
        }
        op.allowSceneActivation = true;
        if (null != LoadingComplete)
        {
            EventArgs e = new EventArgs();
            LoadingComplete(this, e);
        }
    }
Ejemplo n.º 3
0
                public void ChangeScene(EnumSceneType _sceneType, EnumUIType _uiType, params object[] _params)
        {
                        sceneOpenUIType   = _uiType;
                        sceneOpenUIParams = _params;

                        if (LastSceneType == _sceneType)
            {
                                if (sceneOpenUIType == EnumUIType.None)
                {
                                        return;

                                   
                }

                               //UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParams);
                               sceneOpenUIType = EnumUIType.None;
                           
            }
            else
            {
                                ChangeScene(_sceneType);

                           
            }
                   
        }
Ejemplo n.º 4
0
 public void UnRegisterScene(EnumSceneType _sceneID)
 {
     if (dicSceneInfos.ContainsKey(_sceneID))
     {
         dicSceneInfos.Remove(_sceneID);
     }
 }
Ejemplo n.º 5
0
 public string GetSceneName(EnumSceneType _sceneID)
 {
     if (dicSceneInfos.ContainsKey(_sceneID))
     {
         return(dicSceneInfos[_sceneID].SceneName);
     }
     Debug.LogError("This Scene is not register! ID: " + _sceneID.ToString());
     return(null);
 }
Ejemplo n.º 6
0
 public string GetSceneName(EnumSceneType sceneId)
 {
     if (IsRegister(sceneId))
     {
         SceneInfoData info = dicScneneInfo[sceneId];
         return(info.SceneName);
     }
     return("");
 }
Ejemplo n.º 7
0
 public SceneInfoData GetSceneInfo(EnumSceneType _sceneID)
 {
     if (dicSceneInfo.ContainsKey(_sceneID))
     {
         return(dicSceneInfo [_sceneID]);
     }
     Debug.LogError("This Scene hasn't registen! ID: " + _sceneID.ToString());
     return(null);
 }
Ejemplo n.º 8
0
 public SceneInfoData GetSceneInfo(EnumSceneType _sceneId)
 {
     if (dicSceneInfos.ContainsKey(_sceneId))
     {
         return(dicSceneInfos[_sceneId]);
     }
     Debug.LogError("This Scene is not register ! ID: " + _sceneId.ToString());
     return(null);
 }
Ejemplo n.º 9
0
                public void UnRegisterScene(EnumSceneType _sceneID)
        {
                        if (dicSceneInfos.ContainsKey(_sceneID))
            {
                                dicSceneInfos.Remove(_sceneID);

                           
            }
                   
        }
Ejemplo n.º 10
0
        public BaseScene GetScene(EnumSceneType scnenId)
        {
            Debug.Log("Get  Scene: " + scnenId);
            SceneInfoData info = dicScneneInfo[scnenId];

            if (info == null || info.ScriptType == null)
            {
                return(null);
            }
            return(System.Activator.CreateInstance(info.ScriptType) as BaseScene);
        }
Ejemplo n.º 11
0
 public void RegisterScene(EnumSceneType _sceneID, string _sceneName, Type _sceneType, params object[] _params)
 {
     if (_sceneType == null || _sceneType.BaseType != typeof(BaseScene))
     {
         throw new Exception("Register scene type must not null and extends BaseScene");
     }
     if (!dicSceneInfos.ContainsKey(_sceneID))
     {
         SceneInfoData sceneInfo = new SceneInfoData(_sceneName, _sceneType, _params);
         dicSceneInfos.Add(_sceneID, sceneInfo);
     }
 }
Ejemplo n.º 12
0
 public void RegisterScene(EnumSceneType _sceneId, string _sceneName, Type _sceneType, params object[] _params)
 {
     if (null == _sceneType || _sceneType.BaseType != typeof(BaseScene))
     {
         throw new SingletonException("Register scene type must nor null and extends BaseScene !");
     }
     if (!dicSceneInfos.ContainsKey(_sceneId))
     {
         SceneInfoData info = new SceneInfoData(_sceneName, _sceneType, _params);
         dicSceneInfos.Add(_sceneId, info);
     }
 }
Ejemplo n.º 13
0
        public void Register(EnumSceneType scnenId, Type ssriptType, string sceneName, params object[] sceneParams)
        {
            SceneInfoData info = new SceneInfoData(ssriptType, sceneName, sceneParams);

            if (IsRegister(scnenId))
            {
                dicScneneInfo[scnenId] = info;
            }
            else
            {
                dicScneneInfo.Add(scnenId, info);
            }
        }
Ejemplo n.º 14
0
        public void ChangeScneneDirect(EnumSceneType sceneType)
        {
            UIManager.Instance.CloseUIAll();
            if (CurrentScene != null)
            {
                CurrentScene.Release();
            }
            lastScneneType  = changeSceneType;
            changeSceneType = sceneType;
            string sceneName = GetSceneName(sceneType);

            CoroutineController.Instance.StartCoroutine(AysncLoadScene(sceneName));
        }
Ejemplo n.º 15
0
        internal BaseScene GetBaseScene(EnumSceneType _sceneType)
        {
            Debug.Log(" GetBaseScene  sceneId = " + _sceneType.ToString());
            SceneInfoData sceneInfo = GetSceneInfo(_sceneType);

            if (sceneInfo == null || sceneInfo.SceneType == null)
            {
                return(null);
            }
            BaseScene scene = System.Activator.CreateInstance(sceneInfo.SceneType) as BaseScene;

            return(scene);
        }
Ejemplo n.º 16
0
                public SceneInfoData GetSceneInfo(EnumSceneType _sceneID)
        {
                        if (dicSceneInfos.ContainsKey(_sceneID))
            {
                                return(dicSceneInfos[_sceneID]);

                           
            }

                        Debug.LogError("This Scene is not register! ID:" + _sceneID.ToString());

                        return(null);

                   
        }
Ejemplo n.º 17
0
        public void ChangeScene(EnumSceneType _sceneType)
        {
            UIManager.Instance.CloseUIAll();

            if (CurrentScene != null)
            {
                CurrentScene.Release();
                CurrentScene = null;
            }

            LastSceneType   = ChangeSceneType;
            ChangeSceneType = _sceneType;
            //change loading scene
            CoroutineController.Instance.StartCoroutine(AsyncLoadOtherScene());
        }
Ejemplo n.º 18
0
        public void ChangeSceneDirect(EnumSceneType _sceneType)
        {
            UIManager.Instance.CloseUIAll();
            if (CurrentScene != null)
            {
                CurrentScene.Release();
                CurrentScene = null;
            }

            LastSceneType   = ChangeSceneType;
            ChangeSceneType = _sceneType;
            string sceneName = GetSceneName(_sceneType);

            //change scene
            CoroutineController.Instance.StartCoroutine(AsyncLoadScene(sceneName));
        }
Ejemplo n.º 19
0
                public void RegisterScene(EnumSceneType _sceneID, string _sceneName, Type _sceneType, params System.Object[] _params)
        {
                         if (_sceneType  ==  null  ||  _sceneType.BaseType !=  typeof(BaseScene))
            {
                                  throw new Exception("Register scene type must not null and extends BaseScene");
                             
            }

                         if (dicSceneInfos.ContainsKey(_sceneID))
            {
                               SceneInfoData sceneInfo = new SceneInfoData(_sceneName, _sceneType, _params);
                               dicSceneInfos.Add(_sceneID, sceneInfo);

                          
            }
                   
        }
Ejemplo n.º 20
0
 public void ChangeScene(EnumSceneType _sceneType, EnumUIType _uiType, params object[] _params)
 {
     sceneOpenUIType   = _uiType;
     sceneOpenUIParams = _params;
     if (LastSceneType == _sceneType)
     {
         if (sceneOpenUIType == EnumUIType.None)
         {
             return;
         }
         UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParams);
         sceneOpenUIType = EnumUIType.None;
     }
     else
     {
         ChangeScene(_sceneType);
     }
 }
Ejemplo n.º 21
0
 public void ChangeScneneDirect(EnumSceneType sceneType, EnumUIType uiType, params object[] uiParams)
 {
     lastScneneType   = changeSceneType;
     changeSceneType  = sceneType;
     ScneneOpenUIType = uiType;
     this.UiParams    = uiParams;
     if (lastScneneType == sceneType)
     {
         if (ScneneOpenUIType != EnumUIType.None)
         {
             UIManager.Instance.OpenUI(ScneneOpenUIType, uiParams);
             ScneneOpenUIType = EnumUIType.None;
         }
     }
     else
     {
         ChangeScneneDirect(sceneType);
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 判断是否打开目标Scene
 /// </summary>
 /// <param name="_sceneType"></param>
 /// <param name="_uiType"></param>
 /// <param name="_params"></param>
 public void ChangeSceneDirect(EnumSceneType _sceneType, EnumUIType _uiType, GameObject _uiParent = null, params object[] _params)
 {
     sceneOpenUIType   = _uiType;
     sceneOpenUIParams = _params;
     sceneOpenUIParent = _uiParent;
     if (LastSceneType == _sceneType)
     {
         if (sceneOpenUIType == EnumUIType.None)
         {
             return;
         }
         UIManager.Instance.OpenUI(sceneOpenUIType, sceneOpenUIParent, sceneOpenUIParams);
         sceneOpenUIType = EnumUIType.None;
     }
     else
     {
         ChangeSceneDirect(_sceneType);
     }
 }
Ejemplo n.º 23
0
                public void ChangeScene(EnumSceneType _sceneType)
        {
                        //UIManager.Instance.CloseUIAll();

                        if (CurrentScene != null)
            {
                                CurrentScene.Release();

                                CurrentScene = null;
                           
            }

                        LastSceneType   = ChangeSceneType;
                        ChangeSceneType = _sceneType;

                        string sceneName = GetSceneName(_sceneType);

                        //change loading scene
                        //CoroutineController.Instance.StartCoroutine(AsyncLoadOtherScene());
                       
        }
Ejemplo n.º 24
0
                internal BaseScene GetBaseScene(EnumSceneType _sceneType)
        {
                        Debug.Log("GetBaseScene sceneId = "   + _sceneType.ToString());

                        SceneInfoData sceneInfo = GetSceneInfo(_sceneType);

                        if (sceneInfo ==  null ||  sceneInfo.SceneType ==  null)
            {
                                return(null);

                           
            }

                        BaseScene scene = System.Activator.CreateInstance(sceneInfo.SceneType) as BaseScene;

                        return(scene);

                        //BaseScene scene = Game.Instance.GetBaseScene(Game.Instance.ChangeSceneId);
                        //Game.Instance.CurrentScene = scene;
                        //scene.Load();
                       
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 加载场景
 /// </summary>
 /// <param name="sceneType"></param>
 public void LoadScene(EnumSceneType sceneType)
 {
     currentScene = sceneType;
     SceneManager.LoadScene("LoadingScene");
 }
Ejemplo n.º 26
0
 public bool IsRegister(EnumSceneType scnenId)
 {
     return(dicScneneInfo.ContainsKey(scnenId));
 }
Ejemplo n.º 27
0
 public bool IsRegisterScene(EnumSceneType _sceneID)
 {
     return(dicSceneInfos.ContainsKey(_sceneID));
 }
Ejemplo n.º 28
0
 public void Load(EnumSceneType _sceneType)
 {
     LoadingStart();
     CoroutineController.Instance.StartCoroutine(StartLoad(_sceneType));
 }