示例#1
0
 /// <summary>
 /// 切换到指定关卡,限定 Sync + Single 模式。
 /// </summary>
 /// <param name="nextMap">目标关卡。</param>
 /// <param name="outFader">淡出控制器。</param>
 /// <param name="blackScreen">黑屏阶段控制器。</param>
 /// <param name="inFader">淡入控制器。</param>
 public static void SwitchToLevel(ALevelMap nextMap,
                                  ASceneFadeOutProcessor outFader        = null,
                                  ASceneBlackScreenProcessor blackScreen = null,
                                  ASceneFadeInProcessor inFader          = null)
 {
     Instance.DoSwitchToLevel(nextMap, outFader, blackScreen, inFader, null, false);
 }
示例#2
0
        /// <summary>
        /// 执行场景淡出过程。
        /// </summary>
        /// <param name="nextMap">下一个关卡。</param>
        /// <param name="outFader">淡出控制器。</param>
        private void DoFadeOut(ALevelMap nextMap, ASceneFadeOutProcessor outFader)
        {
            Assert.IsNotNull(outFader);

            if (WillFadeOut != null)
            {
                WillFadeOut(nextMap);
            }

            outFader.InitFadeOut(nextMap);

            if (StartFadeOut != null)
            {
                StartFadeOut(nextMap);
            }

            outFader.FadeOut(nextMap, FadeOutCompletedCallback);
        }
示例#3
0
        /// <summary>
        /// 切换到指定关卡,限定 Single 模式。
        /// </summary>
        /// <param name="nextMap">目标关卡。</param>
        /// <param name="outFader">淡出控制器。</param>
        /// <param name="blackScreen">黑屏阶段控制器。</param>
        /// <param name="inFader">淡入控制器。</param>
        /// <param name="asyncer">异步加载控制器。</param>
        /// <param name="async">是否异步加载。</param>
        private void DoSwitchToLevel(ALevelMap nextMap,
                                     ASceneFadeOutProcessor outFader,
                                     ASceneBlackScreenProcessor blackScreen,
                                     ASceneFadeInProcessor inFader,
                                     AAsyncProcessor asyncer,
                                     bool async)
        {
            Assert.IsNotNull(nextMap);

            if (isSwitching)
            {
                Debug.LogError("LevelTransition is in switching");
                return;
            }

            isSwitching    = true;
            ManuallyFadeIn = false;
            StoreProcessors(blackScreen, asyncer, inFader);
            isAsyncSwitching = async;

            if (outFader != null)
            {
                DoFadeOut(nextMap, outFader);
                return; // 流程转入 FadeOutCompletedCallback
            }

            if (blackScreen != null)
            {
                DoProcessBlackScreen(nextMap, blackScreen);
                return; // 流程转入 BlackScreenCompletedCallback
            }

            if (async)
            {
                DoLoadLevelAsync(nextMap, LoadMode.Single, asyncer);
            }
            else
            {
                DoLoadLevel(nextMap, LoadMode.Single);
            }
        }