2021-05-01 22:06:12 +08:00
|
|
|
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;
|
2021-05-02 01:19:35 +08:00
|
|
|
btn.icon = UIPackage.GetItemURL(FUIPackage.Bag,"120651");
|
|
|
|
btn.onRollOver.Set(()=>OnRollOver(btn,index));
|
2021-05-01 22:06:12 +08:00
|
|
|
}
|
|
|
|
|
2021-05-02 01:19:35 +08:00
|
|
|
private void OnRollOver(GButton btn,int index)
|
2021-05-01 22:06:12 +08:00
|
|
|
{
|
2021-05-02 01:19:35 +08:00
|
|
|
long id = idList.List[index];
|
2021-05-01 22:06:12 +08:00
|
|
|
TabHelper.SetTab(btn,()=>TabHelper.OpenStarSoulUI(this.bag, id));
|
|
|
|
}
|
2021-05-02 01:19:35 +08:00
|
|
|
public void ReFresh()
|
|
|
|
{
|
|
|
|
idList.Dispose();
|
|
|
|
AwakeAsync().Coroutine();
|
|
|
|
}
|
2021-05-01 22:06:12 +08:00
|
|
|
|
|
|
|
public void Destroy()
|
|
|
|
{
|
|
|
|
idList.Dispose();
|
|
|
|
}
|
2021-05-02 01:19:35 +08:00
|
|
|
|
2021-05-01 22:06:12 +08:00
|
|
|
}
|
|
|
|
}
|