using System; using System.Collections.Generic; namespace ET { [ActorMessageHandler] public class C2M_EndMainStoryAIHandler : AMActorLocationRpcHandler { protected override async ETTask Run(Unit unit, C2M_EndMainStoryAI request, M2C_EndMainStoryAI response, Action reply) { try { if (!unit.IsTeamLeader) { response.Message = "您不是队长"; reply(); return; } if (unit.teamState == TeamState.Fight) { response.Message = "战斗中"; reply(); return; } MainStoryAI ai = MainStoryAIComponent.instance.GetAI(unit); bool ret = MainStoryAIComponent.instance.DestoryAI(ai); if (!ret) { response.Message = "结束出错"; reply(); return; } await Game.EventSystem.Publish(new ET.EventType.BackMainCity { unit = unit, isForce = true }); } catch (Exception e) { Log.Error(e); } reply(); await ETTask.CompletedTask; } } }