设置。。。

This commit is contained in:
bob
2025-05-29 18:26:40 +08:00
parent f421288244
commit 7bed0ec316
14 changed files with 108 additions and 9 deletions

View File

@@ -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>

View File

@@ -21,6 +21,7 @@
public static string Get(string key)
{
if(Text == null) return key;
return Text.Get(key);
}

View File

@@ -8,6 +8,7 @@ namespace NBF
{
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(SettingItem.URL, typeof(SettingItem));
}
}
}

View File

@@ -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)
{

View File

@@ -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)
{

View 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a99a3eda0b402314e998ff820ebb5b4d

View 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);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 80e8fd431260afb49a8f82e2b17ad93d

View File

@@ -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()

View File

@@ -11,7 +11,7 @@
<component id="n3_e9z8" name="Introduce" src="e9z89" fileName="Com/IntroduceTag.xml" xy="1011,178" size="874,789">
<relation target="" sidePair="right-right,top-top,bottomext-bottom"/>
</component>
<list id="n10_e9z8" name="List" xy="48,174" size="943,792" overflow="scroll" scrollBarFlags="4" clipSoftness="10,10" lineGap="10" defaultItem="ui://hxr7rc7pe9z88">
<list id="n10_e9z8" name="List" xy="48,174" size="943,792" overflow="scroll" scrollBarFlags="4" clipSoftness="10,10" lineGap="10" defaultItem="ui://hxr7rc7pe9z88" autoClearItems="true">
<relation target="" sidePair="left-left,top-top,rightext-right,bottomext-bottom"/>
<item/>
<item/>

View File

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

View File

@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAnisotropicFiltering_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F1e_003F2a11d679_003FAnisotropicFiltering_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAttributeUsageAttribute_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5a41d6b7189842eca409fd0b1c3e3dcf17bf78_003F87_003F656e3c96_003FAttributeUsageAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ABindingFlags_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5a41d6b7189842eca409fd0b1c3e3dcf17bf78_003Fa8_003F57a4f791_003FBindingFlags_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACursor_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003Fd0_003F709b15ec_003FCursor_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFullScreenMode_002Ecs_002Fl_003AC_0021_003FUsers_003Fbob_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F7c_003F0044d980_003FFullScreenMode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIconAttribute_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F6a_003F44c4467c_003FIconAttribute_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>