41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using System;
|
|
|
|
namespace ET
|
|
{
|
|
[ActorMessageHandler]
|
|
public class C2M_GMDelOtherUserBagHandler: AMActorLocationRpcHandler<Unit, C2M_GMDelOtherUserBag, M2C_GMDelOtherUserBag>
|
|
{
|
|
protected override async ETTask Run(Unit unit, C2M_GMDelOtherUserBag request, M2C_GMDelOtherUserBag response, Action reply)
|
|
{
|
|
if (!AppConfig.inst.whiteIds.Contains(unit.Id))
|
|
{
|
|
response.Message = "对不起,您没有权限!";
|
|
reply();
|
|
return;
|
|
}
|
|
|
|
var _unit = MapUnitComponent.Instance.Get(request.userId);
|
|
if (_unit)
|
|
{
|
|
response.Message = "对方在线";
|
|
reply();
|
|
return;
|
|
}
|
|
int zone = unit.DomainZone();
|
|
|
|
Bag bag = await UnitHelper.Query<Bag>(unit.DomainZone(),request.userId);
|
|
Item item = bag.DeleteItem(request.index, 1);
|
|
if (item == null)
|
|
{
|
|
response.Message = "删除数量超过此物品数量,失败";
|
|
reply();
|
|
return;
|
|
}
|
|
UnitHelper.SaveComponenet(zone,bag);
|
|
|
|
response.Message = "成功";
|
|
reply();
|
|
await ETTask.CompletedTask;
|
|
}
|
|
}
|
|
} |