1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2026-03-31 17:07:16 +08:00

work in progress

This commit is contained in:
2025-05-27 02:04:12 +08:00
parent f956032596
commit b566256748
4 changed files with 82 additions and 2 deletions

View File

@@ -248,6 +248,22 @@ public class MyWindow : ManualBehaviour
public override int Max => max;
}
public class RangeValueWithMultiplierMapper<T>(int min, int max, T multiplier) : ValueMapper<T>
{
public override int Min => min;
public override int Max => max;
public override T IndexToValue(int index)
{
return (T)Convert.ChangeType((float)index * (float)Convert.ChangeType(multiplier, typeof(float)), typeof(T));
}
public override int ValueToIndex(T value)
{
return Mathf.RoundToInt((float)Convert.ChangeType(value, typeof(float)) / (float)Convert.ChangeType(multiplier, typeof(float)));
}
}
private class ArrayMapper<T> : ValueMapper<T>
{
private readonly T[] _values;