using System; namespace ET { [ActorMessageHandler] public class C2M_DropSkillHandler : AMActorLocationRpcHandler { 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(); 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(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; } } }