40 lines
986 B
C#
40 lines
986 B
C#
|
using System;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
[ActorMessageHandler]
|
|||
|
public class C2M_KickoutTeamHandler : AMActorLocationRpcHandler<Unit, C2M_KickoutTeam, M2C_KickoutTeam>
|
|||
|
{
|
|||
|
protected override async ETTask Run(Unit unit, C2M_KickoutTeam request, M2C_KickoutTeam response, Action reply)
|
|||
|
{
|
|||
|
if (unit.Id == request.TargetId)
|
|||
|
{
|
|||
|
response.Message = "抱歉,你不能踢自己!";
|
|||
|
reply();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (!unit.IsTeamLeader)
|
|||
|
{
|
|||
|
response.Message = "你不是队长,无权限!";
|
|||
|
reply();
|
|||
|
return;
|
|||
|
}
|
|||
|
Team team = TeamComponent.Instance.Get(unit.Id);
|
|||
|
if (team.TeamState == TeamState.Fight)
|
|||
|
{
|
|||
|
response.Message = "战斗中,不能进行此操作!";
|
|||
|
reply();
|
|||
|
return;
|
|||
|
}
|
|||
|
team.Remove(request.TargetId);
|
|||
|
|
|||
|
//创建新队伍
|
|||
|
var targetTeam = TeamComponent.Instance.CreateTeam(request.TargetId);
|
|||
|
|
|||
|
reply();
|
|||
|
TeamHelper.SendTeamMember(targetTeam);
|
|||
|
TeamHelper.SendTeamMember(team);
|
|||
|
await ETTask.CompletedTask;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|