public void UnRegister(EnumSceneType scnenId) { if (dicScneneInfo != null && IsRegister(scnenId)) { dicScneneInfo.Remove(scnenId); } }
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); } }
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); } }
public void UnRegisterScene(EnumSceneType _sceneID) { if (dicSceneInfos.ContainsKey(_sceneID)) { dicSceneInfos.Remove(_sceneID); } }
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); }
public string GetSceneName(EnumSceneType sceneId) { if (IsRegister(sceneId)) { SceneInfoData info = dicScneneInfo[sceneId]; return(info.SceneName); } return(""); }
public SceneInfoData GetSceneInfo(EnumSceneType _sceneID) { if (dicSceneInfo.ContainsKey(_sceneID)) { return(dicSceneInfo [_sceneID]); } Debug.LogError("This Scene hasn't registen! ID: " + _sceneID.ToString()); return(null); }
public SceneInfoData GetSceneInfo(EnumSceneType _sceneId) { if (dicSceneInfos.ContainsKey(_sceneId)) { return(dicSceneInfos[_sceneId]); } Debug.LogError("This Scene is not register ! ID: " + _sceneId.ToString()); return(null); }
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); }
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); } }
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); } }
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); } }
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)); }
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); }
public SceneInfoData GetSceneInfo(EnumSceneType _sceneID) { if (dicSceneInfos.ContainsKey(_sceneID)) { return(dicSceneInfos[_sceneID]); } Debug.LogError("This Scene is not register! ID:" + _sceneID.ToString()); return(null); }
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()); }
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)); }
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); } }
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); } }
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); } }
/// <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); } }
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()); }
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(); }
/// <summary> /// 加载场景 /// </summary> /// <param name="sceneType"></param> public void LoadScene(EnumSceneType sceneType) { currentScene = sceneType; SceneManager.LoadScene("LoadingScene"); }
public bool IsRegister(EnumSceneType scnenId) { return(dicScneneInfo.ContainsKey(scnenId)); }
public bool IsRegisterScene(EnumSceneType _sceneID) { return(dicSceneInfos.ContainsKey(_sceneID)); }
public void Load(EnumSceneType _sceneType) { LoadingStart(); CoroutineController.Instance.StartCoroutine(StartLoad(_sceneType)); }