r2mods/ilspy_dump/ror2_csproj/RoR2.ConVar/FloatConVar.cs

25 lines
556 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.ConVar;
public class FloatConVar : BaseConVar
{
public float value { get; protected set; }
public FloatConVar(string name, ConVarFlags flags, string defaultValue, string helpText)
: base(name, flags, defaultValue, helpText)
{
}
public override void SetString(string newValue)
{
if (TextSerialization.TryParseInvariant(newValue, out float result) && !float.IsNaN(result) && !float.IsInfinity(result))
{
value = result;
}
}
public override string GetString()
{
return TextSerialization.ToStringInvariant(value);
}
}