修改按键绑定

This commit is contained in:
bob
2025-06-11 18:06:26 +08:00
parent 5996d3563c
commit 3889c0f731
17 changed files with 85 additions and 35 deletions

View File

@@ -7,14 +7,13 @@ namespace NBF.Setting
public interface IMultiOption : IOptionBase
{
List<string> GetOptionNames();
string GetName();
}
public abstract class MultiOption<T> : OptionBase, IMultiOption
{
protected OptionTable<T> OptionTable = new OptionTable<T>();
protected void AddOption(string name, T value)
{
OptionTable.Add(name, value);
@@ -22,11 +21,7 @@ namespace NBF.Setting
public List<string> GetOptionNames() => OptionTable.GetNames();
public string GetName()
{
return OptionTable.GetName(Value);
}
protected void SelectOption(T value, int defaultIndex = 0)
{
SetValue(TryGetIndex(value, out var index) ? index : defaultIndex);
@@ -59,5 +54,10 @@ namespace NBF.Setting
}
public T GetSelectedOption() => OptionTable.GetValue(Value);
public override string GetDisplayString()
{
return OptionTable.GetName(Value);
}
}
}