This commit is contained in:
2025-05-23 00:26:58 +08:00
parent 2ca8eac832
commit 4b7a6b1dc8
22 changed files with 194 additions and 22 deletions

View File

@@ -9,6 +9,7 @@ namespace NBF
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem));
}
}
}

View File

@@ -8,6 +8,7 @@ namespace NBF
{
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(ShopGearItem.URL, typeof(ShopGearItem));
}
}
}

View 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8042079334b43394ca275c4a2189dbfb

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class ListTitleItem : GComponent
{
private void OnInited()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d1c42293e0f4ae546ba4419aa2ed199c

View File

@@ -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)

View 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f1c9e707edc525b419a4d8469675a653

View File

@@ -0,0 +1,15 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class ShopGearItem : GButton
{
private void OnInited()
{
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 88f8461d076edc549bc841c01f0e42a3

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="638,47">
<displayList>
<image id="n9_oome" name="back" src="kryob" fileName="Images/Square.png" xy="3,45" size="635,2" alpha="0.3">
<relation target="" sidePair="width-width"/>
</image>
<text id="n7_oome" name="n7" xy="0,0" size="51,34" fontSize="24" color="#ffffff" text="标题"/>
</displayList>
</component>

View File

@@ -2,7 +2,8 @@
<component size="1920,140" extention="Label" designImage="ui://6hgkvlaufcfgh0" designImageAlpha="0">
<displayList>
<image id="n1_fcfg" name="LongLine" src="kryob" fileName="Images/Square.png" xy="0,137" size="1920,2" alpha="0.3"/>
<list id="n2_fcfg" name="List" xy="268,93" pivot="0.5,0.5" size="1383,46" layout="row" scroll="horizontal" defaultItem="ui://6hgkvlaufcfggs" align="center" vAlign="bottom">
<list id="n2_fcfg" name="List" xy="220,93" pivot="0.5,0.5" size="1479,46" layout="row" scroll="horizontal" defaultItem="ui://6hgkvlaufcfggs" align="center" vAlign="bottom">
<relation target="" sidePair="center-center,bottom-bottom"/>
<item/>
<item/>
<item/>
@@ -10,12 +11,20 @@
<item/>
<item/>
</list>
<text id="n4_fcfg" name="title" xy="916,19" pivot="0.5,0.5" size="87,56" font="ui://6hgkvlaugkm7v" fontSize="42" color="#ffffff" align="center" vAlign="middle" shadowColor="#2f406b" shadowOffset="2,2" text="标题"/>
<component id="n5_fcfg" name="Head" src="fcfgfu" fileName="Com/UserTopHead.xml" xy="41,21"/>
<text id="n6_fcfg" name="TextName" xy="158,62" size="135,39" fontSize="28" color="#7888a0" text="Bob.Song">
<relation target="n4_fcfg" sidePair="left-left,top-top"/>
<text id="n4_fcfg" name="title" xy="916,19" pivot="0.5,0.5" size="87,56" font="ui://6hgkvlaugkm7v" fontSize="42" color="#ffffff" align="center" vAlign="middle" strokeColor="#000000" text="标题">
<relation target="" sidePair="center-center,middle-middle"/>
</text>
<component id="n8_fcfg" name="Currency" src="fcfggq" fileName="Com/CurrencyGroup.xml" xy="1653,33"/>
<component id="n9_fcfg" name="BtnClose" src="fcfggb" fileName="Com/Buttons/BtnClose.xml" xy="1867,33"/>
<component id="n5_fcfg" name="Head" src="fcfgfu" fileName="Com/UserTopHead.xml" xy="41,21">
<relation target="" sidePair="left-left,top-top"/>
</component>
<text id="n6_fcfg" name="TextName" xy="158,62" size="135,39" fontSize="28" color="#7888a0" text="Bob.Song">
<relation target="" sidePair="left-left,top-top"/>
</text>
<component id="n8_fcfg" name="Currency" src="fcfggq" fileName="Com/CurrencyGroup.xml" xy="1653,33">
<relation target="" sidePair="middle-middle,right-right"/>
</component>
<component id="n9_fcfg" name="BtnClose" src="fcfggb" fileName="Com/Buttons/BtnClose.xml" xy="1867,33">
<relation target="" sidePair="middle-middle,right-right"/>
</component>
</displayList>
</component>

View File

@@ -114,6 +114,7 @@
<image id="fcfgh0" name="20250521222909_1.jpg" path="/效果图/"/>
<component id="oomej" name="VerticalroScrollBar.xml" path="/Com/ScrollBar/" exported="true"/>
<component id="oomei" name="VerticalroScrollBar_grip.xml" path="/Com/ScrollBar/"/>
<component id="oomea" name="ListTitleItem.xml" path="/Com/Items/" exported="true"/>
</resources>
<publish name="" path="../Assets/Resources/Fgui/Common" packageCount="2" genCode="true"/>
</packageDescription>

View File

@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1920,1080" designImage="ui://146ra2lqfcfg6" designImageAlpha="0">
<displayList>
<image id="n2_fcfg" name="back" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="1920,1080" color="#0a1123"/>
<image id="n2_fcfg" name="back" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="1920,1080" color="#0a1123">
<relation target="" sidePair="width-width,height-height"/>
</image>
<component id="n3_fcfg" name="Menu" src="fcfggr" fileName="CommonMenu.xml" pkg="6hgkvlau" xy="0,0">
<relation target="" sidePair="width-width,center-center,top-top"/>
</component>
<image id="n4_oome" name="divisionLine" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="355,176" size="2,800" alpha="0.2"/>
<list id="n5_oome" name="List" xy="365,164" size="1534,904" layout="flow_hz" selectionMode="multiple" overflow="scroll" scrollBarFlags="4" margin="10,10,0,0" clipSoftness="10,10" lineGap="30" colGap="30" defaultItem="ui://146ra2lqoome9" align="center" autoClearItems="true" foldInvisibleItems="true">
<item url="ui://146ra2lqoomea"/>
<image id="n4_oome" name="divisionLine" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="355,176" size="2,800" alpha="0.2">
<relation target="" sidePair="left-left,top-top,bottomext-bottom"/>
</image>
<list id="n5_oome" name="List" xy="365,164" size="1534,904" layout="flow_hz" selectionMode="multiple" overflow="scroll" scrollBarFlags="4" margin="10,10,0,0" scrollBarRes="ui://6hgkvlauoomej," clipSoftness="10,10" lineGap="30" colGap="30" defaultItem="ui://146ra2lqoome9" align="center" autoClearItems="true" foldInvisibleItems="true">
<relation target="" sidePair="left-left,top-top,bottom-bottom,rightext-right"/>
<item url="ui://6hgkvlauoomea"/>
<item/>
<item/>
<item/>
@@ -33,7 +38,7 @@
<item/>
<item/>
<item/>
<item url="ui://146ra2lqoomea"/>
<item url="ui://6hgkvlauoomea"/>
<item/>
<item/>
<item/>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1457,47">
<displayList>
<text id="n7_oome" name="n7" xy="0,0" size="51,34" fontSize="24" color="#ffffff" text="标题"/>
<image id="n9_oome" name="n9" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="3,45" size="1454,2" alpha="0.3"/>
</displayList>
</component>

View File

@@ -9,8 +9,7 @@
<image id="fcfg5" name="咖啡店.jpg" path="/x效果图/"/>
<image id="fcfg6" name="食品店.jpg" path="/x效果图/"/>
<component id="fcfg8" name="FishingShopPanel.xml" path="/" exported="true"/>
<component id="oome9" name="TestItem.xml" path="/"/>
<component id="oomea" name="TitleItem.xml" path="/"/>
<component id="oome9" name="ShopGearItem.xml" path="/" exported="true"/>
</resources>
<publish name="" path="../Assets/Resources/Fgui/Shop" packageCount="2" genCode="true"/>
</packageDescription>

View File

@@ -0,0 +1 @@
{"url":"ui://146ra2lqoome9","name":"ShopGearItem","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}}

View File

@@ -0,0 +1 @@
{"url":"ui://6hgkvlauoomea","name":"ListTitleItem","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}}