78 lines
2.5 KiB
C#
78 lines
2.5 KiB
C#
using Framework;
|
|
using Gameplay.Common;
|
|
using Gameplay.PlayerSkill.Data;
|
|
using LTGame;
|
|
using UnityEngine;
|
|
namespace Gameplay.PlayerSkill.State
|
|
{
|
|
public class PlayerSkillStateIdle : BasePlayerSkillState
|
|
{
|
|
|
|
public PlayerSkillStateIdle(PlayerSkillManager owner) : base(owner, EPlayerSkillState.Idle)
|
|
{
|
|
|
|
}
|
|
|
|
protected override void _OnEnter(NBaseState exitState,
|
|
object param)
|
|
{
|
|
base._OnEnter(exitState, param);
|
|
|
|
EventManager.Instance.Register<EDReadyPlayerSkill>(EventManager.EventName.INFIGHT_PLAYER_SKILL_READYUSE, _OnRecvReadySkill);
|
|
}
|
|
|
|
protected override void _OnRunning()
|
|
{
|
|
base._OnRunning();
|
|
|
|
_FakeInput();
|
|
|
|
}
|
|
|
|
protected override void _OnExit(NBaseState exitState,
|
|
object param)
|
|
{
|
|
base._OnExit(exitState, param);
|
|
|
|
EventManager.Instance.Unregister<EDReadyPlayerSkill>(EventManager.EventName.INFIGHT_PLAYER_SKILL_READYUSE, _OnRecvReadySkill);
|
|
}
|
|
|
|
private void _FakeInput()
|
|
{
|
|
// TODO: 临时逻辑, 用于测试
|
|
if (Input.GetKeyDown(KeyCode.Q))
|
|
{
|
|
var readyData = new EDReadyPlayerSkill();
|
|
readyData.playerSkillId = 91101;
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_PLAYER_SKILL_READYUSE, readyData);
|
|
}
|
|
}
|
|
|
|
private void _OnRecvReadySkill(EDReadyPlayerSkill readyData)
|
|
{
|
|
if (owner.isInCD) return;
|
|
owner.ReadySkill(readyData.playerSkillId);
|
|
|
|
isFinished = true;
|
|
switch (owner.readySkillConfig.PreSelectType)
|
|
{
|
|
case EPreSelectType.ChoosePos:
|
|
nextState = EPlayerSkillState.ChoosePos;
|
|
break;
|
|
case EPreSelectType.AllSelfUnitHasEffect:
|
|
nextState = EPlayerSkillState.ShowGlobalEffect;
|
|
break;
|
|
case EPreSelectType.NoEffect:
|
|
nextState = EPlayerSkillState.PreNoEffect;
|
|
break;
|
|
default:
|
|
nextState = EPlayerSkillState.Idle;
|
|
DebugUtil.LogError("暂未实现的技能选择类型: " + owner.readySkillConfig.PreSelectType);
|
|
break;
|
|
}
|
|
EventManager.Instance.Send(EventManager.EventName.Guide_UseSkill);
|
|
}
|
|
|
|
}
|
|
}
|