Files
Fishing2/Assets/Scripts/UI/Shops/FishingShopPanel.cs

73 lines
1.8 KiB
C#

// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using FairyGUI;
using NBC;
using NUnit.Framework;
using UnityEngine;
using UIPanel = NBC.UIPanel;
namespace NBF
{
public partial class FishingShopPanel : UIPanel
{
protected override void OnInit()
{
base.OnInit();
GoodsConfigHelper.Init();
}
protected override void OnShow()
{
ItemList.List.OnClickItem += OnClickItem;
InputManager.OnUICanceled += OnUICanceled;
UseBottomMenu();
List<TabItemData> tabItemList = GoodsConfigHelper.TabItemList;
ItemList.SetPanel(this);
ItemList.SetData(tabItemList, true, true);
}
private void OnUICanceled(string action)
{
if (!IsTop) return;
if (action == InputDef.UI.SubPrev)
{
}
else if (action == InputDef.UI.SubNext)
{
}
else if (action == InputDef.UI.Up)
{
}
else if (action == InputDef.UI.Down)
{
}
}
private void OnClickItem(object item)
{
if (item is not ShopGearItem gearItem) return;
// ItemDetailsPanel.s
// ItemDetailsPanel.Show(bagItem.ItemInfo);
ShopDetailsPanel.Show(gearItem.Config);
}
private void UseBottomMenu()
{
BottomMenu.Use(this);
}
protected override void OnHide()
{
InputManager.OnUICanceled -= OnUICanceled;
ItemList.List.OnClickItem -= OnClickItem;
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}