Code structure cleanup. (2)
This commit is contained in:
27
Assets/Cryville/Crtr/Config/UI/PVPNumber.cs
Normal file
27
Assets/Cryville/Crtr/Config/UI/PVPNumber.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
namespace Cryville.Crtr.Config.UI {
|
||||
public class PVPNumber : PVPNumberBase {
|
||||
protected override void OnValueUpdated() {
|
||||
base.OnValueUpdated();
|
||||
if (Range != null && Range.Length == 2) {
|
||||
var min = (double)Range[0];
|
||||
var max = (double)Range[1];
|
||||
var value = Convert.ToDouble(RawValue);
|
||||
if (value < min) {
|
||||
value = min;
|
||||
RawValue = value;
|
||||
}
|
||||
else if (value > max) {
|
||||
value = max;
|
||||
RawValue = value;
|
||||
}
|
||||
SetRatio((float)((value - min) / (max - min)));
|
||||
}
|
||||
}
|
||||
protected override double GetValue(double ratio, float deltaTime, double min, double max) {
|
||||
// if (LogarithmicMode) throw new NotImplementedException();
|
||||
return (1 - ratio) * min + ratio * max;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user