rokojori_action_library/Runtime/App/Settings/NumberSetting/NumberAppSetting.cs

48 lines
820 B
C#

using Godot;
using System.Collections.Generic;
namespace Rokojori
{
[Tool]
[GlobalClass]
public abstract partial class NumberAppSetting:AppSetting
{
[Export]
public LocalizedString prefix;
[Export]
public float min = 0;
[Export]
public float max = 1;
[Export]
public float defaultValue = 0.5f;
[Export]
public int steps = -1;
[Export]
public float stepSize = -1;
[Export]
public UIFloatValueMode.DecimialPoints decimialPoints = UIFloatValueMode.DecimialPoints.Int;
[Export]
public LocalizedString suffix;
public float NormalizeValue( float v )
{
return MathX.Normalize( v, min, max );
}
public override string GetDefaultValue()
{
return JSON.StringifyObject( defaultValue );
}
}
}