CTT/Server/Hotfix/Game/Handler/UI/Skill/C2M_DropSkillHandler.cs

45 lines
1.2 KiB
C#
Executable File

using System;
namespace ET
{
[ActorMessageHandler]
public class C2M_DropSkillHandler : AMActorLocationRpcHandler<Unit, C2M_DropSkill, M2C_DropSkill>
{
protected override async ETTask Run(Unit unit, C2M_DropSkill request, M2C_DropSkill response, Action reply)
{
if(unit.teamState == TeamState.Fight)
{
response.Message = "战斗中...";
reply();
return;
}
UserSetting setting = unit.GetComponent<UserSetting>();
if (setting == null)
{
Log.Error("setting == null");
response.Message = "系统错误";
reply();
return;
}
int index = request.SlotId;
if (!(setting.GetMainUISlot(index) is MainUISlot mainUISlot))
{
mainUISlot = EntityFactory.CreateWithParent<MainUISlot>(setting);
setting.UpdateMainUISlot(index, mainUISlot);
}
mainUISlot.RealId = request.SkillId;
if (request.SkillId == 0)
{
mainUISlot.MainUIType = MainUIType.NoneSlot;
}
else
{
mainUISlot.MainUIType = MainUIType.SkillSlot;
}
MainUIHelper.GetMainUISlotInfo(setting,response.MainUISlotList);
reply();
await ETTask.CompletedTask;
}
}
}