fix all parsing of enums, removed the "special case" for eases

update to latest Jukebox
This commit is contained in:
minenice55
2023-06-13 21:21:13 -04:00
parent 6105bb4f64
commit 9b24ac4838
91 changed files with 282 additions and 286 deletions

View File

@ -111,17 +111,13 @@ namespace HeavenStudio
{
try
{
if (type == typeof(Util.EasingFunction.Ease) && (pType == typeof(string) || pType == typeof(int) || pType == typeof(long)))
if (type.IsEnum)
{
if (pType == typeof(int) || pType == typeof(long) || pType == typeof(Jukebox.EasingFunction.Ease))
{
e[propertyName] = (Util.EasingFunction.Ease)e[propertyName];
}
if (pType == typeof(string))
e.dynamicData[propertyName] = (int)Enum.Parse(type, (string)e[propertyName]);
else
e[propertyName] = Enum.Parse(typeof(Util.EasingFunction.Ease), (string)e[propertyName]);
e.dynamicData[propertyName] = (int)e[propertyName];
}
else if (type.IsEnum)
e[propertyName] = (int)e[propertyName];
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
e[propertyName] = e[propertyName].ToObject(type);
else
@ -196,7 +192,7 @@ namespace HeavenStudio
e.dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val);
else if (type == typeof(EntityTypes.Float))
e.dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val);
else if (type.IsEnum && param.propertyName != "ease")
else if (type.IsEnum)
e.dynamicData.Add(param.propertyName, (int)param.parameter);
else
e.dynamicData.Add(param.propertyName, Convert.ChangeType(param.parameter, type));
@ -211,17 +207,13 @@ namespace HeavenStudio
e.dynamicData[param.propertyName] = (int)e[param.propertyName];
else if (type == typeof(EntityTypes.Float))
e.dynamicData[param.propertyName] = (float)e[param.propertyName];
else if (type == typeof(Util.EasingFunction.Ease) && (pType == typeof(string) || pType == typeof(int) || pType == typeof(long)))
{
if (pType == typeof(int) || pType == typeof(long) || pType == typeof(Jukebox.EasingFunction.Ease))
{
e.dynamicData[param.propertyName] = (Util.EasingFunction.Ease)e[param.propertyName];
}
else
e.dynamicData[param.propertyName] = Enum.Parse(typeof(Util.EasingFunction.Ease), (string)e[param.propertyName]);
}
else if (type.IsEnum)
e.dynamicData[param.propertyName] = (int)e[param.propertyName];
{
if (pType == typeof(string))
e.dynamicData[param.propertyName] = (int)Enum.Parse(type, (string)e[param.propertyName]);
else
e.dynamicData[param.propertyName] = (int)e[param.propertyName];
}
else if (pType == typeof(Newtonsoft.Json.Linq.JObject))
e.dynamicData[param.propertyName] = e[param.propertyName].ToObject(type);
else