修改设置界面

This commit is contained in:
bob
2025-05-29 18:03:24 +08:00
parent cdcb007d6d
commit f421288244
306 changed files with 41744 additions and 612 deletions

View File

@@ -11,6 +11,7 @@ namespace NBF
{
public const string URL = "ui://6hgkvlaufcfggr";
public Controller showType;
public GList List;
public GButton BtnUserHead;
public BtnInputControl BtnPrev;
@@ -20,6 +21,7 @@ namespace NBF
{
base.ConstructFromXML(xml);
showType = GetController("showType");
List = (GList)GetChild("List");
BtnUserHead = (GButton)GetChild("BtnUserHead");
BtnPrev = (BtnInputControl)GetChild("BtnPrev");

View File

@@ -39,25 +39,25 @@ namespace NBF
}
}
public void SetTabs(List<TabListData> tabList, int selectIndex = 0)
public void SetTabs<T>(List<T> tabList, int selectIndex = 0) where T : TabListData
{
List.RemoveChildrenToPool();
var width = 0f;
var listWidth = 0f;
for (int i = 0; i < tabList.Count; i++)
{
var tabData = tabList[i];
var tabItem = List.AddItemFromPool().asButton;
tabItem.title = tabData.Tab.Name;
width += tabItem.width;
listWidth += tabItem.width;
if (i > 0)
{
width += List.columnGap;
listWidth += List.columnGap;
}
}
Log.Info($"Set tab index={List.selectedIndex}");
List.selectedIndex = selectIndex;
List.width = width;
List.width = listWidth;
OnClickItem();
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1f016abb75434032bce35085f1e55639
timeCreated: 1748509254

View File

@@ -0,0 +1,32 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
using System.Collections.Generic;
namespace NBF
{
/// <summary> </summary>
public partial class SettingPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
[AutoFind(Name = "back")]
public GImage back;
[AutoFind(Name = "Menu")]
public CommonMenu Menu;
[AutoFind(Name = "TextTitle")]
public GTextField TextTitle;
[AutoFind(Name = "Introduce")]
public GComponent Introduce;
[AutoFind(Name = "List")]
public GList List;
[AutoFind(Name = "BottomMenu")]
public BottomMenu BottomMenu;
[AutoFind(Name = "BottomLine")]
public GImage BottomLine;
public override string[] GetDependPackages(){ return new string[] {"Common"}; }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5bd9a89782b28a342b84154c6ca06d32

View File

@@ -0,0 +1,79 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using NBC;
namespace NBF
{
public partial class SettingPanel : UIPanel
{
public override string UIPackName => "Main";
public override string UIResName => "SettingPanel";
private List<TabListSettingData> tabList = new List<TabListSettingData>();
protected override void OnInit()
{
base.OnInit();
IsShowCursor = true;
TabListSettingData tabInput = new TabListSettingData();
tabInput.Tab = new TabItemData();
tabInput.Tab.Name = "键盘和鼠标";
tabList.Add(tabInput);
TabListSettingData tabCtrl = new TabListSettingData();
tabCtrl.Tab = new TabItemData();
tabCtrl.Tab.Name = "控制器";
tabList.Add(tabCtrl);
TabListSettingData tabVideo = new TabListSettingData();
tabVideo.Tab = new TabItemData();
tabVideo.Tab.Name = "视频";
tabVideo.SettingsObject = GameSettings.Instance.UseSettings;
tabList.Add(tabVideo);
TabListSettingData tabSound = new TabListSettingData();
tabSound.Tab = new TabItemData();
tabSound.Tab.Name = "音频和语言";
tabList.Add(tabSound);
Menu.OnTabChange += ChangeTab;
}
protected override void OnShow()
{
Menu.SetTabs(tabList);
}
private void ChangeTab(int index)
{
Log.Info($"Change tab index={index}");
// var tabListData = _tabList[index];
// _currentTab = tabListData;
// SubMenu.SetTabs(_currentTab.SubTab);
}
private void Reset()
{
}
private void Save()
{
}
protected override void OnHide()
{
base.OnHide();
}
protected override void OnDestroy()
{
base.OnDestroy();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9daadae7a1573774cb1b07ea9dc5b077

View File

@@ -17,8 +17,8 @@ namespace NBF
public override string UIPackName => "Shop";
public override string UIResName => "FishingShopPanel";
private List<TabListData> _tabList = new List<TabListData>();
private TabListData _currentTab;
private List<TabListAndSubListData> _tabList = new List<TabListAndSubListData>();
private TabListAndSubListData _currentTab;
protected override void OnInit()
{
@@ -28,7 +28,7 @@ namespace NBF
for (int i = 0; i < 10; i++)
{
var itemData = new TabListData();
var itemData = new TabListAndSubListData();
itemData.AddTestData(i);
_tabList.Add(itemData);
}