fk
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -9,6 +9,7 @@ namespace NBF
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace NBF
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(ShopGearItem.URL, typeof(ShopGearItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Assets/Scripts/UI/ListTitleItem.Designer.cs
generated
Normal file
25
Assets/Scripts/UI/ListTitleItem.Designer.cs
generated
Normal file
@@ -0,0 +1,25 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ListTitleItem
|
||||
{
|
||||
public const string URL = "ui://6hgkvlauoomea";
|
||||
|
||||
public GImage back;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ListTitleItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/ListTitleItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8042079334b43394ca275c4a2189dbfb
|
||||
15
Assets/Scripts/UI/ListTitleItem.cs
Normal file
15
Assets/Scripts/UI/ListTitleItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ListTitleItem : GComponent
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/ListTitleItem.cs.meta
Normal file
2
Assets/Scripts/UI/ListTitleItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d1c42293e0f4ae546ba4419aa2ed199c
|
||||
@@ -1,21 +1,51 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using UIPanel = NBC.UIPanel;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class ListDataBase
|
||||
{
|
||||
public string title;
|
||||
}
|
||||
|
||||
public class ShopGearData : ListDataBase
|
||||
{
|
||||
}
|
||||
|
||||
public partial class FishingShopPanel : UIPanel
|
||||
{
|
||||
public override string UIPackName => "Shop";
|
||||
public override string UIResName => "FishingShopPanel";
|
||||
|
||||
private List<ListDataBase> _data = new List<ListDataBase>();
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
this.AutoAddClick(OnClick);
|
||||
Menu.OnClose += Hide;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
var data = new ListDataBase();
|
||||
data.title = "Title" + i;
|
||||
_data.Add(data);
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
var item = new ShopGearData();
|
||||
item.title = $"Item {i}-" + j;
|
||||
_data.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// List.SetVirtual();
|
||||
List.itemProvider = GetListItemResource;
|
||||
List.itemRenderer = OnRenderItem;
|
||||
List.numItems = _data.Count;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
@@ -23,6 +53,38 @@ namespace NBF
|
||||
base.OnShow();
|
||||
}
|
||||
|
||||
void OnRenderItem(int index, GObject obj)
|
||||
{
|
||||
if (obj is ListTitleItem titleItem)
|
||||
{
|
||||
titleItem.width = List.width - 60;
|
||||
titleItem.height = 47;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// obj.width = 224;
|
||||
// obj.height = 320;
|
||||
// }
|
||||
}
|
||||
|
||||
//根据索引的不同,返回不同的资源URL
|
||||
string GetListItemResource(int index)
|
||||
{
|
||||
var itemData = _data[index];
|
||||
|
||||
if (itemData is ShopGearData shopItem)
|
||||
{
|
||||
return ShopGearItem.URL;
|
||||
}
|
||||
|
||||
if (itemData is ListDataBase item)
|
||||
{
|
||||
return ListTitleItem.URL;
|
||||
}
|
||||
|
||||
return List.defaultItem;
|
||||
}
|
||||
|
||||
private void OnClick(GComponent btn)
|
||||
{
|
||||
// if (btn == BtnClose)
|
||||
|
||||
27
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
Normal file
27
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopGearItem
|
||||
{
|
||||
public const string URL = "ui://146ra2lqoome9";
|
||||
|
||||
public GGraph select;
|
||||
public GGraph over;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
select = (GGraph)GetChild("select");
|
||||
over = (GGraph)GetChild("over");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1c9e707edc525b419a4d8469675a653
|
||||
15
Assets/Scripts/UI/Shops/ShopGearItem.cs
Normal file
15
Assets/Scripts/UI/Shops/ShopGearItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class ShopGearItem : GButton
|
||||
{
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Shops/ShopGearItem.cs.meta
Normal file
2
Assets/Scripts/UI/Shops/ShopGearItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f8461d076edc549bc841c01f0e42a3
|
||||
Reference in New Issue
Block a user