37 lines
910 B
C#
37 lines
910 B
C#
using System;
|
|
using System.Linq;
|
|
|
|
namespace ET
|
|
{
|
|
[ActorMessageHandler]
|
|
public class C2M_QuitTeamHandler : AMActorLocationRpcHandler<Unit,C2M_QuitTeam, M2C_QuitTeam>
|
|
{
|
|
protected override async ETTask Run(Unit unit, C2M_QuitTeam request, M2C_QuitTeam response, Action reply)
|
|
{
|
|
Team team = TeamComponent.Instance.Get(unit.TeamLeaderId);
|
|
if(team==null)
|
|
{
|
|
Log.Error($"team == null where id = {unit.TeamLeaderId}");
|
|
reply();
|
|
return;
|
|
}
|
|
if (team.TeamState == TeamState.Fight)
|
|
{
|
|
response.Message = "战斗中,不能进行此操作!";
|
|
reply();
|
|
return;
|
|
}
|
|
if(team.MemberCount == 1)
|
|
{
|
|
response.Message = "无效操作!";
|
|
reply();
|
|
return;
|
|
}
|
|
|
|
TeamComponent.Instance.QuitTeam(unit, team);
|
|
|
|
reply();
|
|
await ETTask.CompletedTask;
|
|
}
|
|
}
|
|
} |