79 lines
2.1 KiB
C#
79 lines
2.1 KiB
C#
using Cal.DataTable;
|
|
using FairyGUI;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace ET
|
|
{
|
|
public class StarSoulBagUIAwakeSyatem: AwakeSystem<StarSoulBagUI>
|
|
{
|
|
public override void Awake(StarSoulBagUI self)
|
|
{
|
|
self.Awake();
|
|
}
|
|
}
|
|
|
|
public class StarSoulBagUIDestroySyatem: DestroySystem<StarSoulBagUI>
|
|
{
|
|
public override void Destroy(StarSoulBagUI self)
|
|
{
|
|
self.Destroy();
|
|
}
|
|
}
|
|
|
|
public class StarSoulBagUI: Entity
|
|
{
|
|
public FUI_StarSoulBagUI ui;
|
|
private Scene zoneScene;
|
|
private StarSoulBag bag;
|
|
private bool isInit;
|
|
private EventCallback0 rollOverAction;
|
|
private ListComponent<long> idList;
|
|
public void Awake()
|
|
{
|
|
zoneScene = this.ZoneScene();
|
|
ui = GetParent<FUI_StarSoulBagUI>();
|
|
if (!this.isInit)
|
|
{
|
|
this.ui.m_slotList.SetVirtual();
|
|
// this.rollOverAction = this.OnRollOver;
|
|
this.ui.m_slotList.itemRenderer = OnItemRender;
|
|
}
|
|
AwakeAsync().Coroutine();
|
|
}
|
|
|
|
private async ETVoid AwakeAsync()
|
|
{
|
|
bag = this.zoneScene.GetComponent<StarSoulBag>();
|
|
ShowSlots();
|
|
await ETTask.CompletedTask;
|
|
}
|
|
|
|
private void ShowSlots()
|
|
{
|
|
idList = ListComponent<long>.Create();
|
|
idList.List.AddRange(bag.itemDic.Keys);
|
|
this.ui.m_slotList.numItems = bag.ItemCount;
|
|
this.ui.m_slotList.RefreshVirtualList();
|
|
}
|
|
|
|
private void OnItemRender(int index, GObject item)
|
|
{
|
|
var btn = item.asButton;
|
|
long id = idList.List[index];
|
|
btn.icon = null;
|
|
btn.onRollOver.Set(()=>OnRollOver(btn,id));
|
|
}
|
|
|
|
private void OnRollOver(GButton btn,long id)
|
|
{
|
|
TabHelper.SetTab(btn,()=>TabHelper.OpenStarSoulUI(this.bag, id));
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
idList.Dispose();
|
|
}
|
|
}
|
|
} |