修改按键绑定
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user