设置相关功能脚本呢
This commit is contained in:
37
Assets/Scripts/UI/Home/SettingItem.Designer.cs
generated
37
Assets/Scripts/UI/Home/SettingItem.Designer.cs
generated
@@ -1,37 +0,0 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
|
||||
using FairyGUI;
|
||||
using FairyGUI.Utils;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class SettingItem
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7pe9z88";
|
||||
|
||||
public Controller style;
|
||||
public GImage back;
|
||||
public GTextField TextName;
|
||||
public GTextField TextInfo;
|
||||
public GSlider Slider;
|
||||
public BtnInputControl BtnPrev;
|
||||
public BtnInputControl BtnNext;
|
||||
|
||||
public override void ConstructFromXML(XML xml)
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
style = GetController("style");
|
||||
back = (GImage)GetChild("back");
|
||||
TextName = (GTextField)GetChild("TextName");
|
||||
TextInfo = (GTextField)GetChild("TextInfo");
|
||||
Slider = (GSlider)GetChild("Slider");
|
||||
BtnPrev = (BtnInputControl)GetChild("BtnPrev");
|
||||
BtnNext = (BtnInputControl)GetChild("BtnNext");
|
||||
OnInited();
|
||||
UILanguage.TrySetComponentLanguage(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a99a3eda0b402314e998ff820ebb5b4d
|
||||
@@ -1,38 +0,0 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class SettingItem : GButton
|
||||
{
|
||||
public string TitleKey;
|
||||
public string DescriptionKey;
|
||||
|
||||
private void OnInited()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetData(FieldInfo field, object value)
|
||||
{
|
||||
var titleAttribute = field.GetAttribute<TitleAttribute>();
|
||||
if (titleAttribute != null)
|
||||
{
|
||||
TitleKey = titleAttribute.Title;
|
||||
}
|
||||
|
||||
var descriptionAttribute = field.GetAttribute<DescriptionAttribute>();
|
||||
if (descriptionAttribute != null)
|
||||
{
|
||||
DescriptionKey = descriptionAttribute.Description;
|
||||
}
|
||||
|
||||
TextName.text = Lan.Get(TitleKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80e8fd431260afb49a8f82e2b17ad93d
|
||||
32
Assets/Scripts/UI/Home/SettingPanel.Designer.cs
generated
32
Assets/Scripts/UI/Home/SettingPanel.Designer.cs
generated
@@ -1,32 +0,0 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址: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"}; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bd9a89782b28a342b84154c6ca06d32
|
||||
@@ -1,94 +0,0 @@
|
||||
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public partial class SettingPanel : UIPanel
|
||||
{
|
||||
public override string UIPackName => "Main";
|
||||
public override string UIResName => "SettingPanel";
|
||||
|
||||
private List<TabListSettingData> tabList = new List<TabListSettingData>();
|
||||
|
||||
private object _currentSettingsObject;
|
||||
|
||||
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];
|
||||
_currentSettingsObject = tabListData.SettingsObject;
|
||||
ResetSettingList();
|
||||
}
|
||||
|
||||
|
||||
private void ResetSettingList()
|
||||
{
|
||||
List.RemoveChildrenToPool();
|
||||
if (_currentSettingsObject == null) return;
|
||||
var fields = _currentSettingsObject.GetType().GetFields();
|
||||
foreach (var field in fields)
|
||||
{
|
||||
if (List.AddItemFromPool() is SettingItem item)
|
||||
{
|
||||
item.SetData(field, _currentSettingsObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnHide()
|
||||
{
|
||||
base.OnHide();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9daadae7a1573774cb1b07ea9dc5b077
|
||||
Reference in New Issue
Block a user