修改按键绑定

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

@@ -1,4 +1,7 @@
namespace NBF.Setting
using System;
using System.Globalization;
namespace NBF.Setting
{
/// <summary>
/// 范围设置
@@ -9,12 +12,22 @@
public abstract int MaxValue { get; }
public virtual int ShowRate => 0;
public override void SetValue(int value)
{
if (value > MaxValue) value = MaxValue;
else if (value < MinValue) value = MinValue;
Value = value;
}
public override string GetDisplayString()
{
if (ShowRate > 0)
{
return Math.Round(GetValue() / (ShowRate * 1f), 1).ToString(CultureInfo.InvariantCulture);
}
return base.GetDisplayString();
}
}
}