private IEnumerator OnTransitionCoroutine<T>(string resourceName, float fadeInDuration, float fadeOutDuration, System.Action<eSceneTransitionErrorCode> completed) where T : SceneBase { string currentPageType = m_currentScene ? m_currentScene.GetType().ToString() : string.Empty; string nextPageType = typeof(T).ToString(); Global.WidgetMgr.ShowLoadingWidget(fadeInDuration, currentPageType, nextPageType); yield return new WaitForEndOfFrame(); if (m_currentScene != null) { m_priviousPageTypeName = currentPageType; m_currentScene.OnFinalize(); m_currentScene.OnExit(); } yield return new WaitForEndOfFrame(); float currentProgress = 0.0f; const float sceneLoadingProgressRate = 0.4f; if (string.IsNullOrEmpty(resourceName) == false) { UnityEngine.SceneManagement.Scene activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); if (activeScene != null) { m_priviousResourceName = activeScene.name; } yield return Global.ResourceMgr.LoadSceneAsync(resourceName, (progress) => { // scene loading.. currentProgress = progress * sceneLoadingProgressRate; Global.WidgetMgr.SetLoadingProgressInfo(currentProgress); LogWarning(StringUtil.Format("OnTransitionCoroutine -> LoadScene {0} %", (int)(currentProgress * 100))); }, () => { // completed scene load currentProgress = sceneLoadingProgressRate; Global.WidgetMgr.SetLoadingProgressInfo(currentProgress); LogWarning("OnTransitionCoroutine -> Completed LoadScene."); }); } else { currentProgress = sceneLoadingProgressRate; } m_currentScene = FindPage(typeof(T).ToString()); if (m_currentScene == null) { m_currentScene = ComponentFactory.GetChildComponent<T>(RootObject != null ? RootObject : Setting.gameObject, IfNotExist.AddNew); AddPage(m_currentScene); } if (m_currentScene != null) { yield return m_currentScene.OnEnter(currentProgress); m_currentScene.OnInitialize(); } yield return new WaitForEndOfFrame(); if (completed != null) { Global.WidgetMgr.HideLoadingWidget(fadeOutDuration); completed(eSceneTransitionErrorCode.Success); } m_transitionCoroutine = null; }