108 lines
2.7 KiB
C#
108 lines
2.7 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()
|
|
{
|
|
InputManager.Instance.On(this);
|
|
ItemList.List.OnClickItem += OnClickItem;
|
|
|
|
List<TabItemData> tabItemList = GoodsConfigHelper.TabItemList;
|
|
|
|
ItemList.SetData(tabItemList, true, true);
|
|
}
|
|
|
|
|
|
private void OnClickItem(object item)
|
|
{
|
|
if (item is not ShopGearItem gearItem) return;
|
|
// ItemDetailsPanel.s
|
|
// ItemDetailsPanel.Show(bagItem.ItemInfo);
|
|
ShopDetailsPanel.Show(gearItem.Config);
|
|
}
|
|
|
|
#region UI事件
|
|
|
|
[InputInvoke(InputDef.UI.Prev, UIInputButtonShowMode.MenuLeft)]
|
|
private void OnPrev()
|
|
{
|
|
ItemList.Menu.OnClickBtnPrev();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Next, UIInputButtonShowMode.MenuRight)]
|
|
private void OnNext()
|
|
{
|
|
ItemList.Menu.OnClickBtnNext();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Left, UIInputButtonShowMode.BottomLeft)]
|
|
private void OnLeft()
|
|
{
|
|
ItemList.List.Selector.Left();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Right, UIInputButtonShowMode.BottomLeft)]
|
|
private void OnRight()
|
|
{
|
|
ItemList.List.Selector.Right();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Up, UIInputButtonShowMode.BottomLeft)]
|
|
private void OnUp()
|
|
{
|
|
ItemList.List.Selector.Up();
|
|
// ChangeListSelected();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Down, UIInputButtonShowMode.BottomLeft)]
|
|
private void OnDown()
|
|
{
|
|
ItemList.List.Selector.Down();
|
|
}
|
|
|
|
[InputInvoke(InputDef.UI.Enter, UIInputButtonShowMode.BottomLeft, "查看")]
|
|
private void OnApplySettings()
|
|
{
|
|
var selectedItem = ItemList.List.Selector.SelectedItem;
|
|
if (selectedItem != null)
|
|
{
|
|
ItemList.List.InvokeClickItem(selectedItem);
|
|
}
|
|
}
|
|
|
|
|
|
[InputInvoke(InputDef.UI.Back, UIInputButtonShowMode.BottomRight)]
|
|
private void OnBack()
|
|
{
|
|
Hide();
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected override void OnHide()
|
|
{
|
|
ItemList.List.OnClickItem -= OnClickItem;
|
|
InputManager.Instance.Off(this);
|
|
}
|
|
|
|
protected override void OnDestroy()
|
|
{
|
|
base.OnDestroy();
|
|
}
|
|
}
|
|
} |