diff --git a/Assets/Resources/Fgui/Common/Common_fui.bytes b/Assets/Resources/Fgui/Common/Common_fui.bytes index 39ae1c184..e7f06c164 100644 Binary files a/Assets/Resources/Fgui/Common/Common_fui.bytes and b/Assets/Resources/Fgui/Common/Common_fui.bytes differ diff --git a/Assets/Resources/Fgui/Shop/Shop_fui.bytes b/Assets/Resources/Fgui/Shop/Shop_fui.bytes index 044b38329..ecc227018 100644 Binary files a/Assets/Resources/Fgui/Shop/Shop_fui.bytes and b/Assets/Resources/Fgui/Shop/Shop_fui.bytes differ diff --git a/Assets/Scripts/UI/Binders/CommonBinder.cs b/Assets/Scripts/UI/Binders/CommonBinder.cs index f2a69153c..408e47da7 100644 --- a/Assets/Scripts/UI/Binders/CommonBinder.cs +++ b/Assets/Scripts/UI/Binders/CommonBinder.cs @@ -9,6 +9,7 @@ namespace NBF public static void BindAll() { UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu)); + UIObjectFactory.SetPackageItemExtension(ListTitleItem.URL, typeof(ListTitleItem)); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/Binders/ShopBinder.cs b/Assets/Scripts/UI/Binders/ShopBinder.cs index e76fbeb9a..ed1ebec53 100644 --- a/Assets/Scripts/UI/Binders/ShopBinder.cs +++ b/Assets/Scripts/UI/Binders/ShopBinder.cs @@ -8,6 +8,7 @@ namespace NBF { public static void BindAll() { + UIObjectFactory.SetPackageItemExtension(ShopGearItem.URL, typeof(ShopGearItem)); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/ListTitleItem.Designer.cs b/Assets/Scripts/UI/ListTitleItem.Designer.cs new file mode 100644 index 000000000..f568b9ea2 --- /dev/null +++ b/Assets/Scripts/UI/ListTitleItem.Designer.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/ListTitleItem.Designer.cs.meta b/Assets/Scripts/UI/ListTitleItem.Designer.cs.meta new file mode 100644 index 000000000..755046038 --- /dev/null +++ b/Assets/Scripts/UI/ListTitleItem.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 8042079334b43394ca275c4a2189dbfb \ No newline at end of file diff --git a/Assets/Scripts/UI/ListTitleItem.cs b/Assets/Scripts/UI/ListTitleItem.cs new file mode 100644 index 000000000..7a570fe41 --- /dev/null +++ b/Assets/Scripts/UI/ListTitleItem.cs @@ -0,0 +1,15 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class ListTitleItem : GComponent + { + private void OnInited() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/ListTitleItem.cs.meta b/Assets/Scripts/UI/ListTitleItem.cs.meta new file mode 100644 index 000000000..b6211f138 --- /dev/null +++ b/Assets/Scripts/UI/ListTitleItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d1c42293e0f4ae546ba4419aa2ed199c \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/FishingShopPanel.cs b/Assets/Scripts/UI/Shops/FishingShopPanel.cs index 7b0c6529b..cfc683f6f 100644 --- a/Assets/Scripts/UI/Shops/FishingShopPanel.cs +++ b/Assets/Scripts/UI/Shops/FishingShopPanel.cs @@ -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 _data = new List(); + 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) diff --git a/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs new file mode 100644 index 000000000..726c5f1a9 --- /dev/null +++ b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs.meta b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs.meta new file mode 100644 index 000000000..738a7ce60 --- /dev/null +++ b/Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f1c9e707edc525b419a4d8469675a653 \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/ShopGearItem.cs b/Assets/Scripts/UI/Shops/ShopGearItem.cs new file mode 100644 index 000000000..68884d10d --- /dev/null +++ b/Assets/Scripts/UI/Shops/ShopGearItem.cs @@ -0,0 +1,15 @@ +// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 + +using UnityEngine; +using FairyGUI; +using NBC; + +namespace NBF +{ + public partial class ShopGearItem : GButton + { + private void OnInited() + { + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/UI/Shops/ShopGearItem.cs.meta b/Assets/Scripts/UI/Shops/ShopGearItem.cs.meta new file mode 100644 index 000000000..23d31ebb1 --- /dev/null +++ b/Assets/Scripts/UI/Shops/ShopGearItem.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 88f8461d076edc549bc841c01f0e42a3 \ No newline at end of file diff --git a/FGUIProject/assets/Common/Com/Items/ListTitleItem.xml b/FGUIProject/assets/Common/Com/Items/ListTitleItem.xml new file mode 100644 index 000000000..e896adae7 --- /dev/null +++ b/FGUIProject/assets/Common/Com/Items/ListTitleItem.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/FGUIProject/assets/Common/CommonMenu.xml b/FGUIProject/assets/Common/CommonMenu.xml index 5d0c39b5f..5666b0455 100644 --- a/FGUIProject/assets/Common/CommonMenu.xml +++ b/FGUIProject/assets/Common/CommonMenu.xml @@ -2,7 +2,8 @@ - + + @@ -10,12 +11,20 @@ - - - - + + - - + + + + + + + + + + + + \ No newline at end of file diff --git a/FGUIProject/assets/Common/package.xml b/FGUIProject/assets/Common/package.xml index cb4a426a5..30be1fa69 100644 --- a/FGUIProject/assets/Common/package.xml +++ b/FGUIProject/assets/Common/package.xml @@ -114,6 +114,7 @@ + \ No newline at end of file diff --git a/FGUIProject/assets/Shop/FishingShopPanel.xml b/FGUIProject/assets/Shop/FishingShopPanel.xml index 78bf8bbe6..bdf5c48c7 100644 --- a/FGUIProject/assets/Shop/FishingShopPanel.xml +++ b/FGUIProject/assets/Shop/FishingShopPanel.xml @@ -1,13 +1,18 @@ - + + + - - - + + + + + + @@ -33,7 +38,7 @@ - + diff --git a/FGUIProject/assets/Shop/TestItem.xml b/FGUIProject/assets/Shop/ShopGearItem.xml similarity index 100% rename from FGUIProject/assets/Shop/TestItem.xml rename to FGUIProject/assets/Shop/ShopGearItem.xml diff --git a/FGUIProject/assets/Shop/TitleItem.xml b/FGUIProject/assets/Shop/TitleItem.xml deleted file mode 100644 index fbb943f1d..000000000 --- a/FGUIProject/assets/Shop/TitleItem.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/FGUIProject/assets/Shop/package.xml b/FGUIProject/assets/Shop/package.xml index 85ff93e31..456635e3a 100644 --- a/FGUIProject/assets/Shop/package.xml +++ b/FGUIProject/assets/Shop/package.xml @@ -9,8 +9,7 @@ - - + \ No newline at end of file diff --git a/FGUIProject/settings/whoot/146ra2lqoome9.json b/FGUIProject/settings/whoot/146ra2lqoome9.json new file mode 100644 index 000000000..248f41442 --- /dev/null +++ b/FGUIProject/settings/whoot/146ra2lqoome9.json @@ -0,0 +1 @@ +{"url":"ui://146ra2lqoome9","name":"ShopGearItem","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}} \ No newline at end of file diff --git a/FGUIProject/settings/whoot/6hgkvlauoomea.json b/FGUIProject/settings/whoot/6hgkvlauoomea.json new file mode 100644 index 000000000..db5406667 --- /dev/null +++ b/FGUIProject/settings/whoot/6hgkvlauoomea.json @@ -0,0 +1 @@ +{"url":"ui://6hgkvlauoomea","name":"ListTitleItem","scriptType":"component","isCustomName":false,"customName":"","annotation":"","member":{}} \ No newline at end of file