diff --git a/ProjectNLD/Assets/Code/Scripts/Gameplay/Game/GameStateMainScene.cs b/ProjectNLD/Assets/Code/Scripts/Gameplay/Game/GameStateMainScene.cs index 9570edb1e49..ceb6c7551b6 100644 --- a/ProjectNLD/Assets/Code/Scripts/Gameplay/Game/GameStateMainScene.cs +++ b/ProjectNLD/Assets/Code/Scripts/Gameplay/Game/GameStateMainScene.cs @@ -40,9 +40,9 @@ public class GameStateMainScene : IState { } - private void OnLoadingComplete() + private async UniTask OnLoadingComplete() { - UI_MainPanelController.Open().Forget(); + await UI_MainPanelController.Open(); callbackAction?.Invoke(); } } \ No newline at end of file diff --git a/ProjectNLD/Assets/Code/Scripts/Gameplay/Guide/GuideStep.cs b/ProjectNLD/Assets/Code/Scripts/Gameplay/Guide/GuideStep.cs index 1d67e4fe864..935aa182699 100644 --- a/ProjectNLD/Assets/Code/Scripts/Gameplay/Guide/GuideStep.cs +++ b/ProjectNLD/Assets/Code/Scripts/Gameplay/Guide/GuideStep.cs @@ -6,6 +6,7 @@ using Gameplay.Level; using UnityEngine.UI; using UnityEngine; using Framework; +using cfg.LevelCfg; namespace Gameplay.Guide { @@ -488,37 +489,6 @@ namespace Gameplay.Guide } } - /// - /// 切换主场景状态 - /// - internal sealed class EnterMainStateStep : GuideStepBase - { - public EnterMainStateStep(DataGuideCfg cfg) : base(cfg) - { - } - - protected override void DoGuide() - { - try - { - base.DoGuide(); - - GameStateManager.Instance.ChangeState(new GameStateMainScene()); - } - catch (Exception e) - { - DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); - } - } - - protected override void SetGuideState() - { - } - - protected override void RecoverState() - { - } - } /// /// 显示引导提示 @@ -570,6 +540,39 @@ namespace Gameplay.Guide } } + #region 进入流程 + /// + /// 切换主场景状态 + /// + internal sealed class EnterMainStateStep : GuideStepBase + { + public EnterMainStateStep(DataGuideCfg cfg) : base(cfg) + { + } + + protected override void DoGuide() + { + try + { + base.DoGuide(); + + GameStateManager.Instance.ChangeState(new GameStateMainScene()); + } + catch (Exception e) + { + DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); + } + } + + protected override void SetGuideState() + { + } + + protected override void RecoverState() + { + } + } + /// /// 进入关卡 /// @@ -630,6 +633,54 @@ namespace Gameplay.Guide } } + /// + /// 进入编队 + /// + internal sealed class EnterEnterEditTeam : GuideStepBase + { + /// + /// 关卡id + /// + private readonly int levelId; + + public EnterEnterEditTeam(DataGuideCfg cfg) : base(cfg) + { + if (Cfg.GuideTypeParams.Length < 1) + throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.关卡id"); + + if (int.TryParse(Cfg.GuideTypeParams[0], out int id)) + levelId = id; + else + throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为int类型"); + } + + protected override void DoGuide() + { + try + { + base.DoGuide(); + + GameStateManager.Instance.ChangeState(new GameStateMainScene(false, () => + { + JumpToManager.JumpFunc(cfg.JumpFuncType.Level_Select, levelId); + })); + } + catch (Exception e) + { + DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}"); + } + } + + protected override void SetGuideState() + { + } + + protected override void RecoverState() + { + } + } + #endregion + /// /// 关卡上阵 /// diff --git a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/LoadingExecutor.cs b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/LoadingExecutor.cs index 8eb2904fa45..107025ada2c 100644 --- a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/LoadingExecutor.cs +++ b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/LoadingExecutor.cs @@ -19,7 +19,7 @@ namespace Gameplay /// /// 加载完成回调 /// - private readonly Action callBackAction; + private readonly Func callBackFunc; /// /// 是否关闭其他UI /// @@ -47,13 +47,13 @@ namespace Gameplay public bool IsRunning { get { return isRunning; } } #endregion - public LoadingExecutor(E_LoadingType type, bool closeUI = true, Action callBack = null) + public LoadingExecutor(E_LoadingType type, bool closeUI = true, Func callBack = null) { Progress = 0f; isRunning = false; loadingType = type; isCloseUI = closeUI; - callBackAction = callBack; + callBackFunc = callBack; } public async UniTask Excute(float loadingCompleteWaitTime) @@ -75,7 +75,8 @@ namespace Gameplay #region 加载结束 Progress = 1f; await UniTask.WaitForSeconds(loadingCompleteWaitTime, true); - callBackAction?.Invoke(); + if (null != callBackFunc) + await callBackFunc.Invoke(); isRunning = false; await TransitionManager.Instance.OpenNormalTransitionUI(); TransitionManager.Instance.ReadyShowNormalTransition(); diff --git a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneLoadingExecutor.cs b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneLoadingExecutor.cs index 3abcbbc7627..5e4be0b6b51 100644 --- a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneLoadingExecutor.cs +++ b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneLoadingExecutor.cs @@ -16,7 +16,7 @@ namespace Gameplay { private readonly E_LoadingType loadingType; - public MainSceneLoadingExecutor(E_LoadingType type, Action callback) : base(type, true, callback) + public MainSceneLoadingExecutor(E_LoadingType type, Func callback) : base(type, true, callback) { loadingType = type; } diff --git a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneReLoadingExecutor.cs b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneReLoadingExecutor.cs index b6525edbbfd..3ddc5e90d3b 100644 --- a/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneReLoadingExecutor.cs +++ b/ProjectNLD/Assets/Code/Scripts/Gameplay/LoadingExecutor/MainSceneReLoadingExecutor.cs @@ -8,8 +8,8 @@ namespace Gameplay { public class MainSceneReLoadingExecutor: LoadingExecutor { - public MainSceneReLoadingExecutor() : base(E_LoadingType.CommonLoading,true, () => { UI_MainPanelController.Open().Forget(); }) - { + public MainSceneReLoadingExecutor() : base(E_LoadingType.CommonLoading, true, async () => { await UI_MainPanelController.Open(); }) + { } protected override async UniTask OnExecute() diff --git a/ProjectNLD/Assets/Code/Scripts/GenCode/Luban/DataTable/GuideCfg/E_GuideStepType.cs b/ProjectNLD/Assets/Code/Scripts/GenCode/Luban/DataTable/GuideCfg/E_GuideStepType.cs index 17b41444abd..c6c0c4b0c4d 100644 --- a/ProjectNLD/Assets/Code/Scripts/GenCode/Luban/DataTable/GuideCfg/E_GuideStepType.cs +++ b/ProjectNLD/Assets/Code/Scripts/GenCode/Luban/DataTable/GuideCfg/E_GuideStepType.cs @@ -75,6 +75,10 @@ namespace cfg.GuideCfg /// 保存默认编队 /// SaveDefaultTeam = 15, + /// + /// 进入编队界面 + /// + EnterEditTeam = 16, } }