首次提交
This commit is contained in:
55
Assets/Scripts/UI/Bag/BagPanel.cs
Normal file
55
Assets/Scripts/UI/Bag/BagPanel.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using NBF.Fishing2;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class BagPanel : UIPanel
|
||||
{
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
{
|
||||
ItemList.List.OnClickItem += OnClickItem;
|
||||
|
||||
List<TabItemData> tabItemList = new List<TabItemData>();
|
||||
|
||||
var dic = RoleModel.Instance.GetItemsByType();
|
||||
foreach (var (type, list) in dic)
|
||||
{
|
||||
TabItemData tabItem = new TabItemData
|
||||
{
|
||||
Key = type.ToString()
|
||||
};
|
||||
tabItem.Items.AddRange(list);
|
||||
tabItemList.Add(tabItem);
|
||||
}
|
||||
|
||||
ItemList.SetData(tabItemList, true, true);
|
||||
}
|
||||
|
||||
|
||||
private void OnClickItem(object item)
|
||||
{
|
||||
if (item is not BagItem bagItem) return;
|
||||
// ItemDetailsPanel.s
|
||||
ItemDetailsPanel.Show(bagItem.ItemInfo);
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
ItemList.List.OnClickItem -= OnClickItem;
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user