44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
|
using System;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
[ActorMessageHandler]
|
|||
|
public class C2M_GetOtherUserBagHandler: AMActorLocationRpcHandler<Unit, C2M_GetOtherUserBag, M2C_GetOtherUserBag>
|
|||
|
{
|
|||
|
protected override async ETTask Run(Unit unit, C2M_GetOtherUserBag request, M2C_GetOtherUserBag 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;
|
|||
|
}
|
|||
|
|
|||
|
Bag bag = await UnitHelper.Query<Bag>(unit.DomainZone(),request.userId);
|
|||
|
foreach (Item item in bag.ItemDic.Values)
|
|||
|
{
|
|||
|
if (item.IsEmpty) continue;
|
|||
|
BagMap bagMap = new BagMap
|
|||
|
{
|
|||
|
Index = item.index,
|
|||
|
NetItem = new NetItem(item)
|
|||
|
};
|
|||
|
if (item.ItemType == ItemType.EquipItem)
|
|||
|
{
|
|||
|
bagMap.EquipTransMessage = new EquipTransMessage(item.data.As<EquipItem>());
|
|||
|
}
|
|||
|
response.BagMapList.Add(bagMap);
|
|||
|
}
|
|||
|
reply();
|
|||
|
await ETTask.CompletedTask;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|