Beispiel #1
0
 /// <summary>
 /// 保存当前关卡切换过程中要使用的各个控制器。
 /// </summary>
 /// <param name="blackScreen">黑屏控制器。</param>
 /// <param name="asyncer">异步加载控制器。</param>
 /// <param name="inFader">淡入控制器。</param>
 private void StoreProcessors(ASceneBlackScreenProcessor blackScreen,
                              AAsyncProcessor asyncer, ASceneFadeInProcessor inFader)
 {
     currentBlackScreenProcessor = blackScreen;
     currentAsyncer = asyncer;
     currentInFader = inFader;
 }
Beispiel #2
0
        private void DoInitFadeIn(ALevelMap map, ASceneFadeInProcessor inFader)
        {
            Assert.IsNotNull(map);
            Assert.IsNotNull(inFader);

            inFader.InitFadeIn(map);
        }
Beispiel #3
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);
 }
Beispiel #4
0
        /// <summary>
        /// 执行场景淡入过程。
        /// </summary>
        /// <param name="map">当前关卡。</param>
        /// <param name="inFader">淡入控制器。</param>
        private void DoFadeIn(ALevelMap map, ASceneFadeInProcessor inFader)
        {
            Assert.IsNotNull(map);
            Assert.IsNotNull(inFader);

            if (StartFadeIn != null)
            {
                StartFadeIn(map);
            }

            inFader.FadeIn(map, FadeInCompletedCallback);
        }
Beispiel #5
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);
            }
        }