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