protected Singleton() { #if UNITY_EDITOR if (!mNewInstance) { RTLog.LogWarning(LogCat.Game, string.Format("{0} 被定义为一个单例类,请使用.Instance 或者 .GetOrNewInstance() 方法替换 new 方法。", typeof(T))); } #endif }
/// <summary> /// 加载场景 /// </summary> /// <param name="sceneName"></param> /// <param name="displayTime"></param> public void LoadScene(string sceneName, float displayTime = 0, System.Action complateCallback = null) { if (mLoadingScene == sceneName) { #if UNITY_EDITOR RTLog.LogWarning(LogCat.Game, string.Format("Scene:{0} is loading, don't need to load it agin.", sceneName)); #endif if (complateCallback != null) { mLoadEndCallback += complateCallback; } return; } mLoadingScene = sceneName; mLoader.Reset(); mLoadEndCallback = complateCallback; mLoading = true; OnLoadBegin(mLoadingScene); LoadSceneTask task = new LoadSceneTask(mLoadingScene, displayTime, m_WaitForTimeWeight); task.PresetTask = new WaitTask(() => !PanelManager.HasAnyPanelClosing); SceneTask = task; mLoader.AddTask(SceneTask); mLoader.Start(); }