// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖 using System.Collections.Generic; using FairyGUI; using NBC; using NUnit.Framework; using UIPanel = NBC.UIPanel; namespace NBF { public class ShopGearData { public string title; public int type; public int subType; } public partial class FishingShopPanel : UIPanel { protected override void OnInit() { base.OnInit(); this.AutoAddClick(OnClick); IsShowCursor = true; var testData = new List(); for (int i = 0; i < 10; i++) { for (int j = 20; j < 25; j++) { var item = new ShopGearData { type = i, subType = j }; testData.Add(item); } } ItemList.SetData(testData); } protected override void OnShow() { base.OnShow(); UseBottomMenu(); } private void UseBottomMenu() { BottomMenu.Use(this); } private void OnClickItem(object item) { if (item is not ShopGearItem shopGearItem) return; Log.Info($"click item ={shopGearItem.GearData.title}"); } private void OnClick(GComponent btn) { // if (btn == BtnClose) // { // Hide(); // } } protected override void OnDestroy() { base.OnDestroy(); } } }