64 lines
2.5 KiB
C#
64 lines
2.5 KiB
C#
using ET;
|
|
using FairyGUI;
|
|
|
|
using Cal.DataTable;
|
|
using ET.EventType;
|
|
|
|
namespace ET
|
|
{
|
|
public class UpdateWornEquipUIEvent : AEvent<UpdateWornEquipUI>
|
|
{
|
|
public override async ETTask Run(UpdateWornEquipUI args)
|
|
{
|
|
var bagMapList = args.list;
|
|
if (bagMapList != null)
|
|
{
|
|
foreach (BagMap bagMap in bagMapList)
|
|
{
|
|
int index = bagMap.Index;
|
|
NetItem item = bagMap.NetItem;
|
|
//!添加数据
|
|
if (!ClientItemDataComponent.Instance.WornEquipDic.TryGetValue(index, out ClientItemData data))
|
|
{
|
|
data = EntityFactory.CreateWithParent<ClientItemData>(ClientItemDataComponent.Instance);
|
|
ClientItemDataComponent.Instance.WornEquipDic.Add(index, data);
|
|
}
|
|
data.ItemId = item.ItemId;
|
|
data.ItemType = item.ItemType;
|
|
data.Count = item.Count;
|
|
data.getSource = item.GetSource;
|
|
if (data.ItemType == ItemType.EquipItem)
|
|
{
|
|
//!装备赋值
|
|
data.Equip = new Equip(bagMap.EquipTransMessage);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!(FUIComponent.Instance.Get(FUIPackage.Character_CharacterUI) is FUI_CharacterUI characterUI)) return;
|
|
foreach (var kp in ClientItemDataComponent.Instance.WornEquipDic)
|
|
{
|
|
//!处理空格子
|
|
int index = kp.Key;
|
|
int atkListCount = characterUI.m_atkEquipList.numItems;
|
|
GButton btn = index < atkListCount ?
|
|
characterUI.m_atkEquipList.GetChildAt(index).asButton :
|
|
characterUI.m_commonEquipList.GetChildAt(index - atkListCount).asButton;
|
|
ClientItemData data = kp.Value;
|
|
//!显示
|
|
switch (data.ItemType)
|
|
{
|
|
default:
|
|
btn.icon = null;
|
|
btn.title = null;
|
|
break;
|
|
case ItemType.EquipItem:
|
|
EquipBase equipBase = DataTableHelper.Get<EquipBase>(data.ItemId);
|
|
btn.icon = UIPackage.GetItemURL(FUIPackage.Bag, equipBase.IconName.ToString());
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
} |