1416 lines
44 KiB
C#
1416 lines
44 KiB
C#
using cfg.GuideCfg;
|
||
using System;
|
||
using System.Linq;
|
||
using Cysharp.Threading.Tasks;
|
||
using Gameplay.Level;
|
||
using UnityEngine.UI;
|
||
using UnityEngine;
|
||
using Framework;
|
||
using cfg.LevelCfg;
|
||
using Gameplay.Area;
|
||
using Gameplay.Skill;
|
||
|
||
namespace Gameplay.Guide
|
||
{
|
||
/// <summary>
|
||
/// 引导状态
|
||
/// </summary>
|
||
public enum E_GuideState
|
||
{
|
||
/// <summary>
|
||
/// 等待引导
|
||
/// </summary>
|
||
Idle,
|
||
|
||
/// <summary>
|
||
/// 引导中
|
||
/// </summary>
|
||
Guiding,
|
||
|
||
/// <summary>
|
||
/// 引导完成
|
||
/// </summary>
|
||
Complete,
|
||
}
|
||
|
||
/// <summary>
|
||
/// 引导步骤基类
|
||
/// </summary>
|
||
public abstract class GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 引导完成类型
|
||
/// </summary>
|
||
private readonly GuideCompleteBase completeBase;
|
||
private bool isWait;
|
||
private bool isComplete;
|
||
|
||
/// <summary>
|
||
/// 引导配置
|
||
/// </summary>
|
||
public DataGuideCfg Cfg { get; private set; }
|
||
|
||
/// <summary>
|
||
/// 引导状态
|
||
/// </summary>
|
||
public E_GuideState GuideState { get; private set; }
|
||
|
||
/// <summary>
|
||
/// 是否引导中
|
||
/// </summary>
|
||
public bool IsGuiding
|
||
{
|
||
get { return E_GuideState.Guiding == GuideState; }
|
||
}
|
||
|
||
public GuideStepBase(DataGuideCfg cfg)
|
||
{
|
||
Cfg = cfg;
|
||
|
||
GuideState = E_GuideState.Idle;
|
||
isWait = true;
|
||
isComplete = false;
|
||
|
||
completeBase = Cfg.GuideCompleteType switch
|
||
{
|
||
E_GuideCompleteType.PlayVideoOver => new PlayVideoComplete(Cfg, Complete),
|
||
E_GuideCompleteType.OpenUI => new OpenUIComplete(Cfg, Complete),
|
||
E_GuideCompleteType.CloseUI => new CloseUIComplete(Cfg, Complete),
|
||
E_GuideCompleteType.DestroyUI => new DestroyUIComplete(Cfg, Complete),
|
||
E_GuideCompleteType.OpenUIAndAnim => new OpenUIAndAnimComplete(Cfg, Complete),
|
||
E_GuideCompleteType.CloseUIAndAnim => new CloseUIAndAnimComplete(Cfg, Complete),
|
||
E_GuideCompleteType.EnterFightLevelComplete => new EnterFightLevelComplete(Cfg, Complete),
|
||
E_GuideCompleteType.EnterStorylineLevelComplete => new EnterStorylineLevelComplete(Cfg, Complete),
|
||
E_GuideCompleteType.EmbattleComplete => new LevelEmbattleComplete(Cfg, Complete),
|
||
E_GuideCompleteType.EmbattleVehicleComplete => new LevelEmbattleComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightBegin => new FightBeginComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightMoveBeginComplete => new FightBeginMoveComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightMoveComplete => new FightMoveComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightAttackComplete => new FightAttackComplete(Cfg, Complete),
|
||
E_GuideCompleteType.PreparaUseSkillComplete => new FightPreparaUseSkillComplete(Cfg, Complete),
|
||
E_GuideCompleteType.PreparaUsePlayerSkillComplete => new FightPreparaUsePlayerSkillComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightUseSkillComplete => new FightUseSkillComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightUsePlayerSkillComplete => new FightUsePlayerSkillComplete(Cfg, Complete),
|
||
E_GuideCompleteType.LevelComplete => new LevelComplete(Cfg, Complete),
|
||
E_GuideCompleteType.ClickGuideButton => new ClickGuideButtonComplete(Cfg, Complete),
|
||
E_GuideCompleteType.ClickFloorComplete => new ClickGuideFloorComplete(Cfg, Complete),
|
||
E_GuideCompleteType.FightStartButtonShowComplete => new WaitFightStartButtonShowComplete(Cfg, Complete),
|
||
E_GuideCompleteType.WaitPreparatShowComplete => new WaitPreparatShowComplete(Cfg, Complete),
|
||
E_GuideCompleteType.WaitEnemyRetreat => new WaitEnemyRetreatComplete(Cfg, Complete),
|
||
E_GuideCompleteType.WaitChangeName => new WaitChangeNameComplete(Cfg, Complete),
|
||
E_GuideCompleteType.WaitEditTeamComplete => new WaitEditTeamComplete(Cfg, Complete),
|
||
E_GuideCompleteType.AnyClickComplete => new AnyClickComplete(Cfg, Complete),
|
||
E_GuideCompleteType.SaveTeamComplete => new SaveTeamComplete(Cfg, Complete),
|
||
E_GuideCompleteType.JoinVehicle => new JoinVehicle(Cfg, Complete),
|
||
E_GuideCompleteType.WaitLoadingComplete => new WaitLoadingComplete(Cfg, Complete),
|
||
E_GuideCompleteType.ClearTeamComplete => new ClearTeamComplete(Cfg, Complete),
|
||
E_GuideCompleteType.SelectTeamComplete => new SelectTeamComplete(Cfg, Complete),
|
||
E_GuideCompleteType.SkillCDComplete => new SkillCDComplete(Cfg, Complete),
|
||
E_GuideCompleteType.WaitComplete => new WaitComplete(Cfg, Complete),
|
||
E_GuideCompleteType.SaveTeamAndCloseUI => new SaveTeamAndCloseUIComplete(Cfg, Complete),
|
||
_ => throw new Exception($"未处理类型:{Cfg.GuideCompleteType}"),
|
||
};
|
||
}
|
||
|
||
/// <summary>
|
||
/// 开始引导
|
||
/// </summary>
|
||
public async UniTask StartGuide()
|
||
{
|
||
GuideState = E_GuideState.Guiding;
|
||
isWait = true;
|
||
|
||
DebugUtil.Log($"<color=#00FA9A>开始id为{Cfg.Id}的引导,延迟{Cfg.StepStartDelay}秒开始</color>"); // #00FA9A绿色
|
||
|
||
await DoBeforeGuide();
|
||
|
||
await UniTask.Delay((int)(Cfg.StepStartDelay * 1000f)); // 延迟时间开始
|
||
isWait = false;
|
||
|
||
DoRealBeforeGuide();
|
||
|
||
DebugUtil.Log($"<color=#00FA9A>实际执行id为{Cfg.Id}的引导</color>"); // #00FA9A绿色
|
||
|
||
DoGuide();
|
||
|
||
CommonUtils.GuideStepBiEvent(Cfg.Id, 0); // BI打点
|
||
|
||
if (isComplete)
|
||
Complete();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 跳过当前步骤
|
||
/// </summary>
|
||
public void SkipStep()
|
||
{
|
||
}
|
||
|
||
/// <summary>
|
||
/// 完成引导
|
||
/// </summary>
|
||
protected void Complete()
|
||
{
|
||
if (!IsGuiding)
|
||
return;
|
||
|
||
if (isWait)
|
||
{
|
||
isComplete = true;
|
||
return;
|
||
}
|
||
|
||
DebugUtil.Log($"<color=#00FA9A>完成id为{Cfg.Id}的引导</color>"); // #00FA9A绿色
|
||
|
||
GuideState = E_GuideState.Complete;
|
||
DoBeforeComplete();
|
||
RecoverState();
|
||
GuideManager.Instance.CompleteStep(this);
|
||
|
||
CommonUtils.GuideStepBiEvent(Cfg.Id, 1); // BI打点
|
||
CommonUtils.GuideStepBiEvent(Cfg.Id.ToString());
|
||
}
|
||
|
||
/// <summary>
|
||
/// 结束引导
|
||
/// </summary>
|
||
public void EndGuide()
|
||
{
|
||
if (!IsGuiding)
|
||
return;
|
||
|
||
completeBase.RemoveListener();
|
||
RecoverState();
|
||
GuideState = E_GuideState.Idle;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 引导开始之前
|
||
/// </summary>
|
||
protected virtual async UniTask DoBeforeGuide()
|
||
{
|
||
InputManager.Instance.IsEnable = false;
|
||
await UI_GuideController.Open();
|
||
|
||
completeBase.AddListener();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 引导实际开始之前
|
||
/// </summary>
|
||
protected virtual void DoRealBeforeGuide()
|
||
{
|
||
InputManager.Instance.IsEnable = true;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 引导
|
||
/// </summary>
|
||
protected virtual void DoGuide()
|
||
{
|
||
SetGuideState();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 引导完成之前
|
||
/// </summary>
|
||
protected virtual void DoBeforeComplete()
|
||
{
|
||
completeBase.RemoveListener();
|
||
|
||
UIManager.Instance.CloseWindow(UINameConst.UI_Guide);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 设置引导状态
|
||
/// </summary>
|
||
protected abstract void SetGuideState();
|
||
|
||
/// <summary>
|
||
/// 还原状态
|
||
/// </summary>
|
||
protected abstract void RecoverState();
|
||
}
|
||
|
||
#region 引导点击
|
||
/// <summary>
|
||
/// 点击按钮
|
||
/// </summary>
|
||
internal sealed class ClickButtonStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
public ClickButtonStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径");
|
||
|
||
uiName = Cfg.GuideTypeParams[0];
|
||
buttonPath = Cfg.GuideTypeParams[1];
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.Button, uiName, buttonPath, Cfg);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
GuideManager.Instance.SkipAllGuide();
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 滑动按钮
|
||
/// </summary>
|
||
internal sealed class SliderButtonStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
/// <summary>
|
||
/// 地板索引
|
||
/// </summary>
|
||
private readonly int floorIndex;
|
||
|
||
public SliderButtonStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引");
|
||
|
||
uiName = Cfg.GuideTypeParams[0];
|
||
buttonPath = Cfg.GuideTypeParams[1];
|
||
|
||
if (Cfg.GuideTypeParams.Length > 2)
|
||
{
|
||
if (int.TryParse(Cfg.GuideTypeParams[2], out int index))
|
||
floorIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型");
|
||
}
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg,
|
||
floorIndex);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 点击地板
|
||
/// </summary>
|
||
internal sealed class ClickFloorStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 底板索引
|
||
/// </summary>
|
||
private readonly int floorIndex;
|
||
|
||
public ClickFloorStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 0)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.地板索引");
|
||
|
||
if (int.TryParse(Cfg.GuideTypeParams[0], out int index))
|
||
floorIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为int类型");
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(floorIndex, Cfg);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
|
||
UIRoot.Instance.IsEnableGraphicRaycasterByGuide(false);
|
||
GuideManager.Instance.IsControlFloor = true;
|
||
GuideManager.Instance.FloorIndex = floorIndex;
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.isInBattle)
|
||
{
|
||
if (GuideManager.Instance.IsUseSkillSuccess)
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
|
||
UIRoot.Instance.IsEnableGraphicRaycasterByGuide(true);
|
||
GuideManager.Instance.IsControlFloor = false;
|
||
GuideManager.Instance.FloorIndex = -1;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 指向UI说明
|
||
/// </summary>
|
||
internal sealed class NoteStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
public NoteStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length > 1)
|
||
{
|
||
uiName = cfg.GuideTypeParams[0];
|
||
buttonPath = cfg.GuideTypeParams[1];
|
||
}
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.UI, uiName, buttonPath, Cfg);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 滑动按钮上阵
|
||
/// </summary>
|
||
internal sealed class SliderButtonBattleStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
/// <summary>
|
||
/// 地板索引
|
||
/// </summary>
|
||
private readonly int floorIndex;
|
||
|
||
public SliderButtonBattleStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引");
|
||
|
||
uiName = Cfg.GuideTypeParams[0];
|
||
buttonPath = Cfg.GuideTypeParams[1];
|
||
|
||
if (Cfg.GuideTypeParams.Length > 2)
|
||
{
|
||
if (int.TryParse(Cfg.GuideTypeParams[2], out int index))
|
||
floorIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型");
|
||
}
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg,
|
||
floorIndex);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
|
||
GuideManager.Instance.IsControlFloor = true;
|
||
GuideManager.Instance.FloorIndex = floorIndex;
|
||
|
||
EventManager.Instance.Register(EventManager.EventName.Guide_CancelModeFight, OnCancelFightModel);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
EventManager.Instance.Unregister(EventManager.EventName.Guide_CancelModeFight, OnCancelFightModel);
|
||
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
|
||
GuideManager.Instance.IsControlFloor = false;
|
||
GuideManager.Instance.FloorIndex = -1;
|
||
}
|
||
|
||
private async void OnCancelFightModel()
|
||
{
|
||
await UniTask.Delay(300);
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 滑动按钮使用技能
|
||
/// </summary>
|
||
internal sealed class SliderButtonUseSkillStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
/// <summary>
|
||
/// 地板索引
|
||
/// </summary>
|
||
private readonly int floorIndex;
|
||
|
||
public SliderButtonUseSkillStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引");
|
||
|
||
uiName = Cfg.GuideTypeParams[0];
|
||
buttonPath = Cfg.GuideTypeParams[1];
|
||
|
||
if (Cfg.GuideTypeParams.Length > 2)
|
||
{
|
||
if (int.TryParse(Cfg.GuideTypeParams[2], out int index))
|
||
floorIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型");
|
||
}
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg,
|
||
floorIndex);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
|
||
GuideManager.Instance.IsControlFloor = true;
|
||
GuideManager.Instance.FloorIndex = floorIndex;
|
||
|
||
EventManager.Instance.Register(EventManager.EventName.UI_SKILL_CANCEL, OnCancelUseSkill);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
EventManager.Instance.Unregister(EventManager.EventName.UI_SKILL_CANCEL, OnCancelUseSkill);
|
||
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
|
||
GuideManager.Instance.IsControlFloor = false;
|
||
GuideManager.Instance.FloorIndex = -1;
|
||
}
|
||
|
||
private async void OnCancelUseSkill()
|
||
{
|
||
AreaManager.instance.LogicUpdate(0);
|
||
await UniTask.Delay(300);
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 滑动按钮使用指挥官技能
|
||
/// </summary>
|
||
internal sealed class SliderButtonUsePlayerSkillStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// UI名
|
||
/// </summary>
|
||
private readonly string uiName;
|
||
|
||
/// <summary>
|
||
/// 按钮路径
|
||
/// </summary>
|
||
private readonly string buttonPath;
|
||
|
||
/// <summary>
|
||
/// 地板索引
|
||
/// </summary>
|
||
private readonly int floorIndex;
|
||
|
||
public SliderButtonUsePlayerSkillStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.UI名,2.按钮路径,3(可选).地板索引");
|
||
|
||
uiName = Cfg.GuideTypeParams[0];
|
||
buttonPath = Cfg.GuideTypeParams[1];
|
||
|
||
if (Cfg.GuideTypeParams.Length > 2)
|
||
{
|
||
if (int.TryParse(Cfg.GuideTypeParams[2], out int index))
|
||
floorIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第3个参数类型错误:应该为int类型");
|
||
}
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg,
|
||
floorIndex);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
|
||
GuideManager.Instance.IsControlFloor = true;
|
||
GuideManager.Instance.FloorIndex = floorIndex;
|
||
|
||
EventManager.Instance.Register(EventManager.EventName.Guide_CancelPlayerSkill, OnCancelUseSkill);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
EventManager.Instance.Unregister(EventManager.EventName.Guide_CancelPlayerSkill, OnCancelUseSkill);
|
||
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
|
||
GuideManager.Instance.IsControlFloor = false;
|
||
GuideManager.Instance.FloorIndex = -1;
|
||
}
|
||
|
||
private async void OnCancelUseSkill()
|
||
{
|
||
SkillManager.instance.playerSkillManager.LogicUpdate(0);
|
||
AreaManager.instance.LogicUpdate(0);
|
||
await UniTask.Delay(300);
|
||
|
||
await UI_GuideController.Open(UI_GuideController.E_GuideArrowType.SliderButton, uiName, buttonPath, Cfg, floorIndex);
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 播放视频
|
||
/// </summary>
|
||
internal sealed class PlayVideoStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 视频路径
|
||
/// </summary>
|
||
private readonly string videoPath;
|
||
|
||
public PlayVideoStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 0)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.视频路径");
|
||
|
||
videoPath = Cfg.GuideTypeParams[0];
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
GuideManager.Instance.IsPlayPVVideo = true;
|
||
await UI_PVAnimaPlayController.Open(videoPath, () =>
|
||
{
|
||
GameStateManager.Instance.ChangeState(new GameStateMainScene());
|
||
});
|
||
Complete();
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 显示引导提示
|
||
/// </summary>
|
||
internal sealed class ShowGuideTipStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 引导提示配置id
|
||
/// </summary>
|
||
private readonly int guideTipCfgId;
|
||
|
||
public ShowGuideTipStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 0)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.引导Tip的Id");
|
||
|
||
if (int.TryParse(Cfg.GuideTypeParams[0], out int id))
|
||
guideTipCfgId = id;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为int类型");
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideTipController.Open(guideTipCfgId);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.Level_0);
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
}
|
||
|
||
#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>
|
||
internal sealed class EnterLevelStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 关卡id
|
||
/// </summary>
|
||
private readonly int levelId;
|
||
|
||
/// <summary>
|
||
/// 进入故事关卡后是否立即播放
|
||
/// </summary>
|
||
private readonly bool isPlay;
|
||
|
||
public EnterLevelStep(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类型");
|
||
|
||
if (Cfg.GuideTypeParams.Length > 1)
|
||
{
|
||
if (bool.TryParse(Cfg.GuideTypeParams[1], out bool isPlay))
|
||
this.isPlay = isPlay;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第2个参数类型错误:应该为bool类型");
|
||
}
|
||
else
|
||
isPlay = true;
|
||
}
|
||
|
||
protected override void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
LevelManager.Instance.TryEnterLevel(levelId, null, null, isPlay);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
GuideManager.Instance.ShowSkipAllGuide();
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <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, false, async () =>
|
||
{
|
||
await JumpToManager.JumpFuncAsync(cfg.JumpFuncType.TeamSelect, levelId);
|
||
}));
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 进入队伍信息
|
||
/// </summary>
|
||
internal sealed class EnterEnterTeamInfo : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 关卡id
|
||
/// </summary>
|
||
private readonly int levelId;
|
||
|
||
public EnterEnterTeamInfo(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, false, async () =>
|
||
{
|
||
await JumpToManager.JumpFuncAsync(cfg.JumpFuncType.TeamInfoByGuide, levelId);
|
||
}));
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 关卡上阵
|
||
/// </summary>
|
||
internal sealed class LevelEmbattleStep : GuideStepBase
|
||
{
|
||
public LevelEmbattleStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override async UniTask DoBeforeGuide()
|
||
{
|
||
await base.DoBeforeGuide();
|
||
|
||
UIWindow uiWindow = UIManager.Instance.GetOpenedWindowByPath<UIWindow>(UINameConst.UI_StartBtn_CMSBtn);
|
||
if (null == uiWindow)
|
||
return;
|
||
|
||
Transform ts = uiWindow.gameObject.transform.Find("UIStartBtn/Image_UI_Start_BG/Button_StartBtn");
|
||
if (null == ts)
|
||
return;
|
||
|
||
Button btn = ts.GetComponent<Button>();
|
||
if (null == btn)
|
||
return;
|
||
|
||
btn.interactable = false;
|
||
}
|
||
|
||
protected override void DoBeforeComplete()
|
||
{
|
||
base.DoBeforeComplete();
|
||
|
||
UIWindow uiWindow = UIManager.Instance.GetOpenedWindowByPath<UIWindow>(UINameConst.UI_StartBtn_CMSBtn);
|
||
if (null == uiWindow)
|
||
return;
|
||
|
||
Transform ts = uiWindow.gameObject.transform.Find("UIStartBtn/Image_UI_Start_BG/Button_StartBtn");
|
||
if (null == ts)
|
||
return;
|
||
|
||
Button btn = ts.GetComponent<Button>();
|
||
if (null == btn)
|
||
return;
|
||
|
||
btn.interactable = true;
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(Cfg, false);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 等待关卡结束
|
||
/// </summary>
|
||
internal sealed class WaitLevelOver : GuideStepBase
|
||
{
|
||
private readonly bool isContinue;
|
||
|
||
public WaitLevelOver(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 0)
|
||
isContinue = false;
|
||
else if (Cfg.GuideTypeParams.Length > 0 && bool.TryParse(Cfg.GuideTypeParams[0], out bool isContinue))
|
||
this.isContinue = isContinue;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为bool类型");
|
||
}
|
||
|
||
protected override void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
UIManager.Instance.CloseWindow(UINameConst.UI_Guide);
|
||
if (LevelManager.Instance.IsInLevel &&
|
||
null != LevelManager.Instance.CurrentLevel &&
|
||
LevelManager.Instance.CurrentLevel.IsInBattle())
|
||
LevelManager.Instance.CurrentLevel.SetSpeed(ELevelSpeed.DEFAULT_SPEED);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
LevelManager.Instance.ExitLevelChangeMainFunc = () => { return isContinue; };
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
LevelManager.Instance.ExitLevelChangeMainFunc = null;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 打开选择角色形象UI
|
||
/// </summary>
|
||
internal sealed class OpenChoosePersonStep : GuideStepBase
|
||
{
|
||
public OpenChoosePersonStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_ChoosePersonController.Open();
|
||
await UI_GuideController.Open(Cfg, false);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 等待步骤
|
||
/// </summary>
|
||
internal sealed class WaitStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 是否有遮罩
|
||
/// </summary>
|
||
private readonly bool isFullMask;
|
||
|
||
public WaitStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length <= 0)
|
||
isFullMask = true;
|
||
else if (bool.TryParse(Cfg.GuideTypeParams[0], out bool isMask))
|
||
isFullMask = isMask;
|
||
else
|
||
isFullMask = false;
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(isFullMask);
|
||
EventManager.Instance.Send(EventManager.EventName.Guide_Wait);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 等待打开改名事件
|
||
/// </summary>
|
||
internal sealed class WaitOpenChangeName : GuideStepBase
|
||
{
|
||
public WaitOpenChangeName(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(false);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
GuideManager.Instance.IsChangeName = false;
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
GuideManager.Instance.IsChangeName = true;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 等待玩家编队
|
||
/// </summary>
|
||
internal sealed class WaitEditTeamStep : GuideStepBase
|
||
{
|
||
public WaitEditTeamStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override async void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
await UI_GuideController.Open(Cfg, false);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
GuideManager.Instance.IsEditTeamGuide = true;
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
GuideManager.Instance.IsEditTeamGuide = false;
|
||
}
|
||
}
|
||
|
||
#region 编队相关
|
||
/// <summary>
|
||
/// 保存默认编队
|
||
/// </summary>
|
||
internal sealed class SaveDefaultTeamStep : GuideStepBase
|
||
{
|
||
public SaveDefaultTeamStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
Team team = TeamEditManager.Instance.GetTeamByIndex(1); // 获取第二个队伍
|
||
if (null == team)
|
||
return;
|
||
|
||
team.ClearTeam();
|
||
uint[] characters = new uint[] { 0, 0, 0, 0 };
|
||
|
||
uint defaultCommander = 100001u;
|
||
|
||
Team newTeam = new(team.TeamIndex,
|
||
team.Name,
|
||
team.IconNumber,
|
||
defaultCommander,
|
||
characters.ToList(),
|
||
team.GetPlayerSkillIDs());
|
||
|
||
TeamEditManager.Instance.SaveTeam(newTeam);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 队伍选择
|
||
/// </summary>
|
||
internal sealed class SelectTeamStep : GuideStepBase
|
||
{
|
||
/// <summary>
|
||
/// 选择的队伍索引
|
||
/// </summary>
|
||
private readonly int teamIndex;
|
||
|
||
public SelectTeamStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
if (Cfg.GuideTypeParams.Length < 1)
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},参数数量错误:1.队伍索引");
|
||
|
||
if (int.TryParse(Cfg.GuideTypeParams[0], out int index))
|
||
teamIndex = index;
|
||
else
|
||
throw new Exception($"引导id:{Cfg.Id}, 引导类型:{Cfg.GuideStepType},第1个参数类型错误:应该为int类型");
|
||
}
|
||
|
||
protected override void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
TeamEditManager.Instance.SetSelectTeam(teamIndex);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 清除编队
|
||
/// </summary>
|
||
internal sealed class ClearTeamStep : GuideStepBase
|
||
{
|
||
public ClearTeamStep(DataGuideCfg cfg) : base(cfg)
|
||
{
|
||
}
|
||
|
||
protected override void DoGuide()
|
||
{
|
||
try
|
||
{
|
||
base.DoGuide();
|
||
|
||
Team team = TeamEditManager.Instance.GetSelectTeam();
|
||
if (null == team)
|
||
return;
|
||
|
||
team.ClearTeam();
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
DebugUtil.LogError($"引导id:{Cfg.Id},执行错误,异常信息:{e}");
|
||
}
|
||
}
|
||
|
||
protected override void SetGuideState()
|
||
{
|
||
}
|
||
|
||
protected override void RecoverState()
|
||
{
|
||
}
|
||
}
|
||
#endregion
|
||
} |