From cc577966c12c3aa3816e72b774ea779c65fb1949 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Sun, 21 Aug 2022 20:50:19 -0400 Subject: [PATCH] further work attempt at fixing colour deserialization, not working --- Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs | 14 +++++++------- Assets/Scripts/GameCamera.cs | 4 ++-- Assets/Scripts/Games/Global/Flash.cs | 2 +- Assets/Scripts/Games/Spaceball/Spaceball.cs | 2 +- .../EventSelector/EventPropertyPrefab.cs | 4 ++-- Assets/Scripts/LevelEditor/Timeline/Timeline.cs | 2 +- Assets/Scripts/Util/EntityTypes.cs | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs index 899901ae..36b3c004 100644 --- a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs +++ b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs @@ -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 }, diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index f4d57538..49c224aa 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -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)); diff --git a/Assets/Scripts/Games/Global/Flash.cs b/Assets/Scripts/Games/Global/Flash.cs index 94c145b0..1271caee 100644 --- a/Assets/Scripts/Games/Global/Flash.cs +++ b/Assets/Scripts/Games/Global/Flash.cs @@ -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"]); } } } diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs index 1e9bb08c..e54a1171 100644 --- a/Assets/Scripts/Games/Spaceball/Spaceball.cs +++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs @@ -206,7 +206,7 @@ namespace HeavenStudio.Games else currentZoomCamDistance = dist; - lastEase = allCameraEvents[currentZoomIndex]["ease"]; + lastEase = (EasingFunction.Ease) allCameraEvents[currentZoomIndex]["ease"]; } } diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs index 03d3a3cb..5713b0aa 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs @@ -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]; diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 4057ff08..e3a7eba9 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -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) { diff --git a/Assets/Scripts/Util/EntityTypes.cs b/Assets/Scripts/Util/EntityTypes.cs index 2a800ee9..5dd37692 100644 --- a/Assets/Scripts/Util/EntityTypes.cs +++ b/Assets/Scripts/Util/EntityTypes.cs @@ -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 }; }