using System;
namespace ET.Server
{
///
/// 移除场景单位
///
[MessageHandler(SceneType.Game)]
public class C2G_RemoveUnitHandler: AMRpcHandler
{
protected override async ETTask Run(Session session, C2G_RemoveUnit request, G2C_RemoveUnit response, Action reply)
{
WNPlayer player = session.GetComponent().GetMyPlayer();
if (player == null)
{
Log.Debug($"操作错误, player is null");
response.Error = ErrorCode.ERR_OperationError;
reply();
return;
}
// 参数判断
if (request.UnitId <= 0)
{
Log.Debug($"参数错误...unitId={request.UnitId}");
response.Error = ErrorCode.ERR_ParameterError;
reply();
return;
}
await player.Map.RemovePointUnit(request.UnitId);
reply();
}
}
}