等待加载的完成回调
parent
78698c763f
commit
9037a3ca5c
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换主场景状态
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示引导提示
|
||||
|
|
@ -570,6 +540,39 @@ namespace Gameplay.Guide
|
|||
}
|
||||
}
|
||||
|
||||
#region 进入流程
|
||||
/// <summary>
|
||||
/// 切换主场景状态
|
||||
/// </summary>
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入关卡
|
||||
/// </summary>
|
||||
|
|
@ -630,6 +633,54 @@ namespace Gameplay.Guide
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进入编队
|
||||
/// </summary>
|
||||
internal sealed class EnterEnterEditTeam : GuideStepBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 关卡id
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 关卡上阵
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Gameplay
|
|||
/// <summary>
|
||||
/// 加载完成回调
|
||||
/// </summary>
|
||||
private readonly Action callBackAction;
|
||||
private readonly Func<UniTask> callBackFunc;
|
||||
/// <summary>
|
||||
/// 是否关闭其他UI
|
||||
/// </summary>
|
||||
|
|
@ -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<UniTask> 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();
|
||||
|
|
|
|||
|
|
@ -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<UniTask> callback) : base(type, true, callback)
|
||||
{
|
||||
loadingType = type;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<E_LoadingResult> OnExecute()
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ namespace cfg.GuideCfg
|
|||
/// 保存默认编队
|
||||
/// </summary>
|
||||
SaveDefaultTeam = 15,
|
||||
/// <summary>
|
||||
/// 进入编队界面
|
||||
/// </summary>
|
||||
EnterEditTeam = 16,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue