切换标签页

This commit is contained in:
xmac
2025-05-23 18:10:56 +08:00
parent 0c44f985ec
commit d6327c7946
21 changed files with 54 additions and 24 deletions

View File

@@ -13,8 +13,6 @@ namespace NBF
private readonly List<object> _listData = new List<object>();
public event Action<object> OnClickItem;
public int SelectedIndex => List.selectedIndex;
private void OnInited()
{
@@ -23,21 +21,22 @@ namespace NBF
List.onClickItem.Add(OnClickListItem);
}
public void SetListData(List<object> listData)
public void SetListData(List<object> listData,ListSelectionMode selectionMode = ListSelectionMode.Single)
{
_listData.Clear();
foreach (var obj in listData)
{
_listData.Add(obj);
}
List.selectionMode = selectionMode;
List.numItems = _listData.Count;
List.ScrollToView(0);
}
void OnClickListItem(EventContext context)
{
Debug.Log($"con={context.data} nm={context.sender}");
OnClickItem?.Invoke(null);
OnClickItem?.Invoke(context.data);
}
void OnRenderItem(int index, GObject obj)

View File

@@ -35,6 +35,8 @@ namespace NBF
}
Menu.OnTabChange += ChangeTab;
List.OnClickItem += OnClickItem;
}
protected override void OnShow()
@@ -51,6 +53,13 @@ namespace NBF
List.SetListData(listData.ListData);
}
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)

View File

@@ -7,7 +7,7 @@
</text>
<image id="n4_fcfg" name="n4" src="kryob" fileName="Images/Square.png" xy="33,44" size="33,2">
<gearDisplay controller="button" pages="3"/>
<relation target="" sidePair="bottom-bottom,rightext-right,leftext-left"/>
<relation target="" sidePair="center-center,bottom-bottom"/>
</image>
</displayList>
<Button mode="Radio"/>

View File

@@ -4,7 +4,7 @@
<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="title" xy="0,0" size="51,34" fontSize="24" color="#ffffff" text="标题"/>
<text id="n7_oome" name="title" xy="0,0" size="55,36" fontSize="26" color="#ffffff" text="标题"/>
</displayList>
<Button/>
</component>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="260,43">
<displayList>
<image id="n8_drkw" name="n8" src="fcfggn" fileName="Images/button/button_square_5.png" xy="0,0" size="259,43" alpha="0.3"/>
<text id="n10_drkw" name="n10" xy="46,6" size="206,32" fontSize="20" color="#7888a0" autoSize="none" text="" input="true" prompt="输入要查找内容..."/>
<image id="n11_drkw" name="n11" src="fcfgg7" fileName="Images/icon_common_38.png" xy="8,5" size="32,32" alpha="0.6"/>
</displayList>
</component>

View File

@@ -4,15 +4,15 @@
<component id="ips61" name="MessageBox.xml" path="/" exported="true"/>
<component id="isq98" name="LoadingProgress.xml" path="/Com/Progress/" exported="true"/>
<component id="isq99" name="ProgressBar.xml" path="/Com/"/>
<component id="isq9a" name="BtnCommon.xml" path="/Com/" exported="true"/>
<component id="isq9a" name="BtnCommon.xml" path="/Com/Buttons/" exported="true"/>
<image id="kryob" name="Square.png" path="/Images/" exported="true" scale="9grid" scale9grid="1,1,1,0"/>
<component id="kryoc" name="GreenProgress.xml" path="/Com/Progress/" exported="true"/>
<component id="sqnkd" name="GMPanel.xml" path="/" exported="true"/>
<component id="sqnke" name="InputDef.xml" path="/Com/"/>
<component id="sqnkf" name="ButtonDef.xml" path="/Com/"/>
<component id="sqnkg" name="ComboBox1_item.xml" path="/Com/"/>
<component id="sqnkh" name="ComboBox1_popup.xml" path="/Com/"/>
<component id="sqnki" name="ComboBox1.xml" path="/Com/" exported="true"/>
<component id="sqnkf" name="ButtonDef.xml" path="/Com/Buttons/"/>
<component id="sqnkg" name="ComboBox1_item.xml" path="/Com/ComboBox/"/>
<component id="sqnkh" name="ComboBox1_popup.xml" path="/Com/ComboBox/"/>
<component id="sqnki" name="ComboBox1.xml" path="/Com/ComboBox/" exported="true"/>
<font id="gkm7v" name="AlibabaPuHuiTi-3-Bold.ttf" path="/Font/" exported="true" renderMode="" samplePointSize="16"/>
<font id="gkm7w" name="AlibabaPuHuiTi-3-Medium.ttf" path="/Font/" exported="true" renderMode="" samplePointSize="16"/>
<font id="gkm7x" name="AlibabaPuHuiTi-3-Regular.ttf" path="/Font/" exported="true" renderMode="" samplePointSize="16"/>
@@ -65,8 +65,8 @@
<image id="fcfgfj" name="op-tent.png" path="/Icon/交互/" exported="true"/>
<image id="fcfgfk" name="op-door.png" path="/Icon/交互/" exported="true"/>
<image id="fcfgfl" name="op-boat.png" path="/Icon/交互/" exported="true"/>
<component id="tmu81k" name="TextTag.xml" path="/Com/" exported="true"/>
<component id="fcfgfm" name="TextCenterTag.xml" path="/Com/" exported="true"/>
<component id="tmu81k" name="TextTag.xml" path="/Com/Tags/" exported="true"/>
<component id="fcfgfm" name="TextCenterTag.xml" path="/Com/Tags/" exported="true"/>
<image id="fcfgfn" name="op-bank.png" path="/Icon/交互/" exported="true"/>
<image id="fcfgfo" name="op-oven.png" path="/Icon/交互/" exported="true"/>
<image id="fcfgfp" name="op-wharf.png" path="/Icon/交互/" exported="true"/>
@@ -91,16 +91,16 @@
<image id="fcfggd" name="icon_store_22.png" path="/Images/" exported="true"/>
<image id="fcfgge" name="icon_store_4.png" path="/Images/" exported="true"/>
<component id="fcfggf" name="CurrencyIcon.xml" path="/Com/"/>
<component id="fcfggh" name="CurrencyTag1.xml" path="/Com/"/>
<component id="fcfggi" name="CurrencyTag2.xml" path="/Com/"/>
<component id="fcfggj" name="BtnIcon2.xml" path="/Com/Buttons/"/>
<image id="fcfggk" name="button_square_2.png" path="/Images/button/" scale="9grid" scale9grid="32,32,64,64"/>
<image id="fcfggl" name="button_square_3.png" path="/Images/button/"/>
<image id="fcfggm" name="button_square_4.png" path="/Images/button/"/>
<image id="fcfggn" name="button_square_5.png" path="/Images/button/"/>
<image id="fcfggo" name="button_square_6.png" path="/Images/button/"/>
<image id="fcfggp" name="button_square_7.png" path="/Images/button/"/>
<component id="fcfggq" name="CurrencyGroup.xml" path="/Com/" exported="true"/>
<component id="fcfggh" name="CurrencyTag1.xml" path="/Com/Items/"/>
<component id="fcfggi" name="CurrencyTag2.xml" path="/Com/Items/"/>
<component id="fcfggj" name="BtnIcon2.xml" path="/Com/Buttons/" exported="true"/>
<image id="fcfggk" name="button_square_2.png" path="/Images/button/" exported="true" scale="9grid" scale9grid="13,16,103,94"/>
<image id="fcfggl" name="button_square_3.png" path="/Images/button/" exported="true"/>
<image id="fcfggm" name="button_square_4.png" path="/Images/button/" exported="true"/>
<image id="fcfggn" name="button_square_5.png" path="/Images/button/" exported="true" scale="9grid" scale9grid="9,9,102,108"/>
<image id="fcfggo" name="button_square_6.png" path="/Images/button/" exported="true" scale="9grid" scale9grid="20,18,94,92"/>
<image id="fcfggp" name="button_square_7.png" path="/Images/button/" exported="true" scale="9grid" scale9grid="25,23,79,85"/>
<component id="fcfggq" name="CurrencyGroup.xml" path="/Com/Tags/" exported="true"/>
<image id="fcfg9" name="20250521000344_1.jpg" path="/效果图/"/>
<component id="fcfggr" name="CommonMenu.xml" path="/" exported="true"/>
<component id="fcfggs" name="ButtonTab.xml" path="/Com/Buttons/" exported="true"/>
@@ -116,6 +116,7 @@
<component id="oomei" name="VerticalroScrollBar_grip.xml" path="/Com/ScrollBar/"/>
<component id="oomea" name="ListTitleItem.xml" path="/Com/Items/" exported="true"/>
<component id="drkwh1" name="ClassifyList.xml" path="/Com/" exported="true"/>
<component id="drkwa" name="SearchTag.xml" path="/Com/Tags/" exported="true"/>
</resources>
<publish name="" path="../Assets/Resources/Fgui/Common" packageCount="2" genCode="true"/>
</packageDescription>

View File

@@ -13,5 +13,8 @@
<component id="n6_drkw" name="List" src="drkwh1" fileName="Com/ClassifyList.xml" pkg="6hgkvlau" xy="374,162" size="1532,914">
<relation target="" sidePair="left-left,top-top,rightext-right,bottomext-bottom"/>
</component>
<component id="n8_drkw" name="n8" src="drkwa" fileName="Com/Tags/SearchTag.xml" pkg="6hgkvlau" xy="83,174"/>
<component id="n11_drkw" name="n11" src="oomea" fileName="Com/Items/ListTitleItem.xml" pkg="6hgkvlau" xy="84,232" size="259,47"/>
<component id="n12_drkw" name="n12" src="drkwb" fileName="SelectTextItem.xml" xy="90,287"/>
</displayList>
</component>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="251,32" extention="Button">
<controller name="button" pages="2,up,3,down,4,over,5,selectedOver,6,disabled,7,selectedDisabled" selected="0"/>
<displayList>
<text id="n12_drkw" name="title" xy="33,0" size="218,32" fontSize="22" color="#ffffff" autoSize="none" text="标题二"/>
</displayList>
<Button/>
</component>

View File

@@ -10,6 +10,7 @@
<image id="fcfg6" name="食品店.jpg" path="/x效果图/"/>
<component id="fcfg8" name="FishingShopPanel.xml" path="/" exported="true"/>
<component id="oome9" name="ShopGearItem.xml" path="/" exported="true"/>
<component id="drkwb" name="SelectTextItem.xml" path="/"/>
</resources>
<publish name="" path="../Assets/Resources/Fgui/Shop" packageCount="2" genCode="true"/>
</packageDescription>

View File

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