设置。。。
This commit is contained in:
@@ -67,7 +67,8 @@ namespace NBF
|
||||
/// <summary>
|
||||
/// 质量等级 0 1 2 3
|
||||
/// </summary>
|
||||
[Title("Settings_Title_quality")] [Description("Settings_Description_quality")]
|
||||
// [Title("Settings_Title_quality")] [Description("Settings_Description_quality")]
|
||||
[Title("图像质量")] [Description("图像质量324234图像质量图像质量图像质量图像质量3434")]
|
||||
public QualityEnum QualityLevel = QualityEnum.High;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
public static string Get(string key)
|
||||
{
|
||||
if(Text == null) return key;
|
||||
return Text.Get(key);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace NBF
|
||||
{
|
||||
public static void BindAll()
|
||||
{
|
||||
UIObjectFactory.SetPackageItemExtension(SettingItem.URL, typeof(SettingItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace NBF
|
||||
{
|
||||
var tabData = tabList[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.title = tabData.Tab.Name;
|
||||
tabItem.title = Lan.Get(tabData.Tab.Name);
|
||||
listWidth += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace NBF
|
||||
{
|
||||
var tabData = subItems[i];
|
||||
var tabItem = List.AddItemFromPool().asButton;
|
||||
tabItem.title = tabData.Name;
|
||||
tabItem.title = Lan.Get(tabData.Name);
|
||||
width += tabItem.width;
|
||||
if (i > 0)
|
||||
{
|
||||
|
||||
37
Assets/Scripts/UI/Home/SettingItem.Designer.cs
generated
Normal file
37
Assets/Scripts/UI/Home/SettingItem.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
/**本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址: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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Home/SettingItem.Designer.cs.meta
Normal file
2
Assets/Scripts/UI/Home/SettingItem.Designer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a99a3eda0b402314e998ff820ebb5b4d
|
||||
38
Assets/Scripts/UI/Home/SettingItem.cs
Normal file
38
Assets/Scripts/UI/Home/SettingItem.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Home/SettingItem.cs.meta
Normal file
2
Assets/Scripts/UI/Home/SettingItem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80e8fd431260afb49a8f82e2b17ad93d
|
||||
@@ -3,6 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using NBC;
|
||||
using Unity.VisualScripting;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
@@ -13,6 +14,8 @@ namespace NBF
|
||||
|
||||
private List<TabListSettingData> tabList = new List<TabListSettingData>();
|
||||
|
||||
private object _currentSettingsObject;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
base.OnInit();
|
||||
@@ -50,20 +53,32 @@ namespace NBF
|
||||
private void ChangeTab(int index)
|
||||
{
|
||||
Log.Info($"Change tab index={index}");
|
||||
// var tabListData = _tabList[index];
|
||||
// _currentTab = tabListData;
|
||||
// SubMenu.SetTabs(_currentTab.SubTab);
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user