Add mouse sensitivity cvar, devconfig.cfg
This commit is contained in:
@@ -45,13 +45,18 @@ internal struct ConsoleVariable
|
||||
{
|
||||
if (field != null)
|
||||
return (string)field.GetValue(null);
|
||||
if (setter != null)
|
||||
if (getter != null)
|
||||
return (string)getter.Invoke(null, null);
|
||||
}
|
||||
else if (type == typeof(float))
|
||||
{
|
||||
if (field != null)
|
||||
return field.GetValue(null).ToString();
|
||||
if (getter != null)
|
||||
return (string)getter.Invoke(null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("cvar is not type of string");
|
||||
}
|
||||
throw new Exception($"Unsupported console variable type '{type.FullName}'");
|
||||
|
||||
throw new Exception("GetValueString no field or getter specified");
|
||||
}
|
||||
@@ -66,6 +71,15 @@ internal struct ConsoleVariable
|
||||
else if (setter != null)
|
||||
setter.Invoke(null, new object[] { value });
|
||||
}
|
||||
else if (type == typeof(float))
|
||||
{
|
||||
if (!float.TryParse(value, out var floatValue))
|
||||
return;
|
||||
if (field != null)
|
||||
field.SetValue(null, floatValue);
|
||||
else if (setter != null)
|
||||
setter.Invoke(null, new object[] { floatValue });
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Unsupported type for SetValue: " + type.Name);
|
||||
|
||||
Reference in New Issue
Block a user