This commit is contained in:
2025-06-11 20:29:48 +08:00
15 changed files with 85 additions and 29 deletions

View File

@@ -0,0 +1,6 @@
namespace NBF.Setting
{
public abstract class ControllerOption : OptionBase
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 75e11d5298cd48718d39a3e2af82472f
timeCreated: 1749634909

View File

@@ -0,0 +1,6 @@
namespace NBF.Setting
{
public abstract class InputOption : OptionBase
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0df4bee5d9b54ada8be3757d7fe02e30
timeCreated: 1749634814

View File

@@ -0,0 +1,6 @@
namespace NBF.Setting
{
public abstract class KeyBoardOption : InputOption
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 509d2fb0106b42b79854cca29707207d
timeCreated: 1749634771

View File

@@ -7,7 +7,6 @@ namespace NBF.Setting
public interface IMultiOption : IOptionBase public interface IMultiOption : IOptionBase
{ {
List<string> GetOptionNames(); List<string> GetOptionNames();
string GetName();
} }
public abstract class MultiOption<T> : OptionBase, IMultiOption public abstract class MultiOption<T> : OptionBase, IMultiOption
@@ -22,10 +21,6 @@ namespace NBF.Setting
public List<string> GetOptionNames() => OptionTable.GetNames(); public List<string> GetOptionNames() => OptionTable.GetNames();
public string GetName()
{
return OptionTable.GetName(Value);
}
protected void SelectOption(T value, int defaultIndex = 0) protected void SelectOption(T value, int defaultIndex = 0)
{ {
@@ -59,5 +54,10 @@ namespace NBF.Setting
} }
public T GetSelectedOption() => OptionTable.GetValue(Value); public T GetSelectedOption() => OptionTable.GetValue(Value);
public override string GetDisplayString()
{
return OptionTable.GetName(Value);
}
} }
} }

View File

@@ -11,6 +11,7 @@ namespace NBF.Setting
void SetValue(int index); void SetValue(int index);
bool HaveNotApple(); bool HaveNotApple();
ISettings Root { get; } ISettings Root { get; }
string GetDisplayString();
} }
public abstract class OptionBase : IOptionBase public abstract class OptionBase : IOptionBase
@@ -51,6 +52,8 @@ namespace NBF.Setting
public ISettings Root { get; private set; } public ISettings Root { get; private set; }
public void Initialize(ISettings root) public void Initialize(ISettings root)
{ {
Root = root; Root = root;
@@ -81,6 +84,11 @@ namespace NBF.Setting
Value = DefaultValue; Value = DefaultValue;
} }
public virtual string GetDisplayString()
{
return GetValue().ToString();
}
public virtual int GetValue() public virtual int GetValue()
{ {
return Value; return Value;

View File

@@ -1,4 +1,7 @@
namespace NBF.Setting using System;
using System.Globalization;
namespace NBF.Setting
{ {
/// <summary> /// <summary>
/// 范围设置 /// 范围设置
@@ -16,5 +19,15 @@
else if (value < MinValue) value = MinValue; else if (value < MinValue) value = MinValue;
Value = value; Value = value;
} }
public override string GetDisplayString()
{
if (ShowRate > 0)
{
return Math.Round(GetValue() / (ShowRate * 1f), 1).ToString(CultureInfo.InvariantCulture);
}
return base.GetDisplayString();
}
} }
} }

View File

@@ -0,0 +1,7 @@
namespace NBF.Options.Input
{
public class InputAddBobSetting
{
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 673bfd453717403998342a57e58b9b3a
timeCreated: 1749634714

View File

@@ -1,7 +1,5 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 // 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System;
using System.Globalization;
using FairyGUI; using FairyGUI;
using NBC; using NBC;
using NBF.Setting; using NBF.Setting;
@@ -42,15 +40,6 @@ namespace NBF
private void SetShow() private void SetShow()
{ {
if (Option is IMultiOption multiOption)
{
TextInfo.text = multiOption.GetName();
}
else if (Option is RangeOption range)
{
Slider.value = range.GetValue();
}
UpdateValueText(); UpdateValueText();
} }
@@ -148,14 +137,12 @@ namespace NBF
{ {
if (Option is RangeOption range) if (Option is RangeOption range)
{ {
if (range.ShowRate > 0) Slider.value = range.GetValue();
{ TextSliderValue.text = range.GetDisplayString();
TextSliderValue.text = Math.Round(range.GetValue() / 10f, 1).ToString(CultureInfo.InvariantCulture); }
} else if (Option is IMultiOption multiOption)
else {
{ TextInfo.text = multiOption.GetDisplayString();
TextSliderValue.text = range.GetValue().ToString();
}
} }
} }
} }

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<component size="1920,1080" extention="Label">
<displayList>
<graph id="n13_j6rn" name="n13" xy="0,0" size="1920,1080" alpha="0.9" type="rect" lineSize="0" fillColor="#ff000000"/>
<text id="n14_j6rn" name="title" xy="941,483" size="36,35" fontSize="25" color="#ffffff" align="center" vAlign="middle" text="txt">
<relation target="" sidePair="center-center,middle-middle"/>
</text>
</displayList>
</component>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<component size="1920,1080" designImage="ui://hxr7rc7pe9z82" designImageAlpha="30"> <component size="1920,1080" extention="Label" designImage="ui://hxr7rc7pe9z82" designImageAlpha="30">
<displayList> <displayList>
<image id="n1_e9z8" name="back" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="1920,1080" color="#182128"> <image id="n1_e9z8" name="back" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="0,0" size="1920,1080" color="#182128">
<relation target="" sidePair="width-width,height-height"/> <relation target="" sidePair="width-width,height-height"/>
@@ -34,5 +34,6 @@
<image id="n12_e9z8" name="BottomLine" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="57,974" size="898,4" alpha="0.2" color="#5c748b"> <image id="n12_e9z8" name="BottomLine" src="kryob" fileName="Images/Square.png" pkg="6hgkvlau" xy="57,974" size="898,4" alpha="0.2" color="#5c748b">
<relation target="n10_e9z8" sidePair="bottom-bottom,rightext-right,leftext-left"/> <relation target="n10_e9z8" sidePair="bottom-bottom,rightext-right,leftext-left"/>
</image> </image>
<component id="n13_j6rn" name="Mask" src="j6rn18" fileName="Com/SettingMask.xml" xy="0,0"/>
</displayList> </displayList>
</component> </component>

View File

@@ -42,6 +42,7 @@
<component id="lvql15" name="MakePanel.xml" path="/" exported="true"/> <component id="lvql15" name="MakePanel.xml" path="/" exported="true"/>
<component id="lvql16" name="MapPanel.xml" path="/" exported="true"/> <component id="lvql16" name="MapPanel.xml" path="/" exported="true"/>
<component id="j6rn17" name="SettingSubTitleItem.xml" path="/Com/Items/" exported="true"/> <component id="j6rn17" name="SettingSubTitleItem.xml" path="/Com/Items/" exported="true"/>
<component id="j6rn18" name="SettingMask.xml" path="/Com/"/>
</resources> </resources>
<publish name="" path="../Assets/Resources/Fgui/Main" packageCount="2" genCode="true"/> <publish name="" path="../Assets/Resources/Fgui/Main" packageCount="2" genCode="true"/>
</packageDescription> </packageDescription>