25 lines
728 B
C#
25 lines
728 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace Cryville.Crtr.Config.UI {
|
|
public class PVPNumber : PVPNumberBase {
|
|
[SerializeField]
|
|
RectTransform m_on;
|
|
|
|
protected override void OnValueUpdated() {
|
|
base.OnValueUpdated();
|
|
if (Range == null || Range.Length != 2) return;
|
|
var min = (double)Range[0];
|
|
var max = (double)Range[1];
|
|
var value = Convert.ToDouble(RawValue);
|
|
float ratio = (float)((value - min) / (max - min));
|
|
SetRatio(ratio);
|
|
m_on.anchorMax = new Vector2(ratio, m_on.anchorMax.y);
|
|
}
|
|
protected override double GetValue(double ratio, float deltaTime, double min, double max) {
|
|
// if (LogarithmicMode) throw new NotImplementedException();
|
|
return (1 - ratio) * min + ratio * max;
|
|
}
|
|
}
|
|
}
|