zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Server/Hotfix/Game/Handler/Other/C2M_EndMainStoryAIHandler.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
using System;
using System.Collections.Generic;
namespace ET
{
[ActorMessageHandler]
public class C2M_EndMainStoryAIHandler : AMActorLocationRpcHandler<Unit, C2M_EndMainStoryAI, M2C_EndMainStoryAI>
{
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;
}
2021-04-11 19:50:39 +08:00
MainStoryAI ai = MainStoryAIComponent.instance.GetAI(unit);
bool ret = MainStoryAIComponent.instance.DestoryAI(ai);
2021-04-08 20:09:59 +08:00
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;
}
}
}