184 lines
4.6 KiB
C#
184 lines
4.6 KiB
C#
|
|
using cfg.ProcedureCfg;
|
|||
|
|
using Gameplay;
|
|||
|
|
using Gameplay.Level;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 强制流程基类
|
|||
|
|
/// </summary>
|
|||
|
|
public abstract class ProcedureBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 配置数据
|
|||
|
|
/// </summary>
|
|||
|
|
public DataProcedure Cfg
|
|||
|
|
{
|
|||
|
|
get;
|
|||
|
|
private set;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public ProcedureBase(DataProcedure cfg)
|
|||
|
|
{
|
|||
|
|
Cfg = cfg;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否可以开始
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public abstract bool IsCanStart();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否正在流程中
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
public abstract bool IsProceduring();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 开始强制流程
|
|||
|
|
/// </summary>
|
|||
|
|
public abstract void Begin();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 进入关卡
|
|||
|
|
/// </summary>
|
|||
|
|
public sealed class EnterLevel_Procedure : ProcedureBase
|
|||
|
|
{
|
|||
|
|
private readonly int levelId;
|
|||
|
|
|
|||
|
|
public EnterLevel_Procedure(DataProcedure cfg) : base(cfg)
|
|||
|
|
{
|
|||
|
|
if (cfg.ProcedureParams.Length < 1)
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数数量错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!int.TryParse(cfg.ProcedureParams[0], out int id))
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数类型错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
levelId = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Begin()
|
|||
|
|
{
|
|||
|
|
LevelManager.Instance.TryEnterLevel(levelId, null, null, true);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsCanStart()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsProceduring()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass; // 没有通关,则在该流程中
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 进入队伍信息界面
|
|||
|
|
/// </summary>
|
|||
|
|
public sealed class EnterTeamInfoUI_Procedure : ProcedureBase
|
|||
|
|
{
|
|||
|
|
private readonly int levelId;
|
|||
|
|
|
|||
|
|
public EnterTeamInfoUI_Procedure(DataProcedure cfg) : base(cfg)
|
|||
|
|
{
|
|||
|
|
if (cfg.ProcedureParams.Length < 1)
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数数量错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!int.TryParse(cfg.ProcedureParams[0], out int id))
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数类型错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
levelId = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Begin()
|
|||
|
|
{
|
|||
|
|
GameStateManager.Instance.ChangeState(new GameStateMainScene(false, false, async () =>
|
|||
|
|
{
|
|||
|
|
await JumpToManager.JumpFuncAsync(cfg.JumpFuncType.TeamInfoByGuide, levelId);
|
|||
|
|
}));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsCanStart()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsProceduring()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass; // 没有通关,则在该流程中
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 进入编队信息界面
|
|||
|
|
/// </summary>
|
|||
|
|
public sealed class EnterEditTeamUI_Procedure : ProcedureBase
|
|||
|
|
{
|
|||
|
|
private readonly int levelId;
|
|||
|
|
|
|||
|
|
public EnterEditTeamUI_Procedure(DataProcedure cfg) : base(cfg)
|
|||
|
|
{
|
|||
|
|
if (cfg.ProcedureParams.Length < 1)
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数数量错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (!int.TryParse(cfg.ProcedureParams[0], out int id))
|
|||
|
|
{
|
|||
|
|
DebugUtil.LogError($"强制流程id:{cfg.Id},参数类型错误,需要1个参数:关卡id");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
levelId = id;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void Begin()
|
|||
|
|
{
|
|||
|
|
GameStateManager.Instance.ChangeState(new GameStateMainScene(false, false, async () =>
|
|||
|
|
{
|
|||
|
|
await JumpToManager.JumpFuncAsync(cfg.JumpFuncType.TeamSelect, levelId);
|
|||
|
|
}));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsCanStart()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override bool IsProceduring()
|
|||
|
|
{
|
|||
|
|
if (!LevelManager.Instance.TryGetLevelInfoByID(levelId, out LevelInfo levelInfo))
|
|||
|
|
return false;
|
|||
|
|
|
|||
|
|
return !levelInfo.IsPass; // 没有通关,则在该流程中
|
|||
|
|
}
|
|||
|
|
}
|