50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
|
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;
|
|||
|
}
|
|||
|
var ai = MainStoryAIComponent.instance.GetAI(unit);
|
|||
|
var 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;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|