17 lines
665 B
C#
17 lines
665 B
C#
namespace ET.Client
|
|
{
|
|
[MessageHandler(SceneType.Main)]
|
|
[FriendOf(typeof(BagComponent))]
|
|
public class Item_ItemInfoHandler : MessageHandler<Scene, Item_ItemInfo>
|
|
{
|
|
protected override async ETTask Run(Scene scene, Item_ItemInfo message)
|
|
{
|
|
BagComponent comp = scene.GetComponent<BagComponent>() ?? scene.AddComponent<BagComponent>();
|
|
comp.ItemMap[message.item.itemIndex] = message.item;
|
|
comp.NewItemSet.Add(message.item.itemIndex);
|
|
EventSystem.Instance.Publish(scene, new ItemChangedEvent { ItemIndex = message.item.itemIndex });
|
|
await ETTask.CompletedTask;
|
|
}
|
|
}
|
|
}
|