further work

attempt at fixing colour deserialization, not working
This commit is contained in:
minenice55 2022-08-21 20:50:19 -04:00
parent f209b2fd17
commit cc577966c1
7 changed files with 17 additions and 17 deletions

View file

@ -198,14 +198,14 @@ namespace HeavenStudio
{ "type5", entity.type5 },
{ "type6", entity.type6 },
{ "ease", entity.ease },
{ "ease", (int) entity.ease },
{ "colorA", entity.colorA },
{ "colorB", entity.colorB },
{ "colorC", entity.colorC },
{ "colorD", entity.colorD },
{ "colorE", entity.colorE },
{ "colorF", entity.colorF },
{ "colorA", (EntityTypes.SerializableColor) entity.colorA },
{ "colorB", (EntityTypes.SerializableColor) entity.colorB },
{ "colorC", (EntityTypes.SerializableColor) entity.colorC },
{ "colorD", (EntityTypes.SerializableColor) entity.colorD },
{ "colorE", (EntityTypes.SerializableColor) entity.colorE },
{ "colorF", (EntityTypes.SerializableColor) entity.colorF },
{ "text1", entity.text1 },
{ "text2", entity.text2 },

View file

@ -125,7 +125,7 @@ namespace HeavenStudio
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(e["ease"]);
EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]);
float dx = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f));
float dy = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f));
float dz = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f));
@ -145,7 +145,7 @@ namespace HeavenStudio
float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (prog >= 0f)
{
EasingFunction.Function func = EasingFunction.GetEasingFunction(e["ease"]);
EasingFunction.Function func = EasingFunction.GetEasingFunction((EasingFunction.Ease) e["ease"]);
float dx = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f));
float dy = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f));
float dz = func(-rotEluerLast.z, e["valC"], Mathf.Min(prog, 1f));

View file

@ -92,7 +92,7 @@ namespace HeavenStudio.Games.Global
endCol = new Color(colB.r, colB.g, colB.b, startEntity["valB"]);
}
SetFade(startEntity.beat, startEntity.length, startCol, endCol, startEntity["ease"]);
SetFade(startEntity.beat, startEntity.length, startCol, endCol, (EasingFunction.Ease) startEntity["ease"]);
}
}
}

View file

@ -206,7 +206,7 @@ namespace HeavenStudio.Games
else
currentZoomCamDistance = dist;
lastEase = allCameraEvents[currentZoomIndex]["ease"];
lastEase = (EasingFunction.Ease) allCameraEvents[currentZoomIndex]["ease"];
}
}

View file

@ -120,10 +120,10 @@ namespace HeavenStudio.Editor
);
break;
case Color _:
case EntityTypes.SerializableColor _:
case Color _:
colorPreview.colorPicker.onColorChanged += _ =>
parameterManager.entity[propertyName] = colorPreview.colorPicker.color;
parameterManager.entity[propertyName] = new EntityTypes.SerializableColor { Color = colorPreview.colorPicker.color };
Color paramCol = parameterManager.entity[propertyName];

View file

@ -594,7 +594,7 @@ namespace HeavenStudio.Editor.Track
}
else if (propertyType == typeof(Color))
{
returnVal = new EntityTypes.SerializableColor{ Color = (Color)ep[i].parameter };
returnVal = new EntityTypes.SerializableColor { Color = (UnityEngine.Color) ep[i].parameter };
}
else if (propertyType.IsEnum)
{

View file

@ -43,20 +43,20 @@ namespace HeavenStudio
public class SerializableColor
{
public float[] colorStore = new float[4] { 1F, 1F, 1F, 1F };
public Color Color
public UnityEngine.Color Color
{
get { return new Color(colorStore[0], colorStore[1], colorStore[2], colorStore[3]); }
set { colorStore = new float[4] { value.r, value.g, value.b, value.a }; }
}
//makes this class usable as Color, Color normalColor = mySerializableColor;
public static implicit operator Color(SerializableColor instance)
public static implicit operator UnityEngine.Color(SerializableColor instance)
{
return instance.Color;
}
//makes this class assignable by Color, SerializableColor myColor = Color.white;
public static implicit operator SerializableColor(Color color)
public static implicit operator SerializableColor(UnityEngine.Color color)
{
return new SerializableColor { Color = color };
}