From d0220611bbb9ac1b1b86dab8c99e0073d3f21911 Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Sat, 12 Aug 2023 12:26:08 -0400 Subject: [PATCH 1/5] stuffs --- Assets/Scenes/Editor.unity | 69 ++++++++++++++++++++++ Assets/Scripts/Minigames.cs | 10 +++- Assets/Scripts/StaticCamera.cs | 102 ++++++++++++++++++++++++++++++++- 3 files changed, 177 insertions(+), 4 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 9a3a381a8..e460d2904 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -13774,14 +13774,34 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_ConstrainProportionsScale + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3558106557710386107, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_BlockingMask.m_Bits value: 0 objectReference: {fileID: 0} + - target: {fileID: 3741076794236313655, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 3788593923839736097, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_RaycastTarget value: 0 objectReference: {fileID: 0} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: maskObj + value: + objectReference: {fileID: 2105509200} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: canvasObj + value: + objectReference: {fileID: 1638236449} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: letterboxMask + value: + objectReference: {fileID: 2105509201} - target: {fileID: 4820152107260776423, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_RaycastTarget value: 0 @@ -33660,6 +33680,45 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1637160319} m_CullTransparentMesh: 1 +--- !u!1 &1638236449 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2464883521749415129, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} +--- !u!1818360610 &1638236453 +ScaleConstraint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1638236449} + m_Enabled: 1 + m_Weight: 1 + m_ScaleAtRest: {x: 1, y: 1, z: 1} + m_ScaleOffset: {x: 1, y: 1, z: 1} + m_AffectScalingX: 1 + m_AffectScalingY: 1 + m_AffectScalingZ: 1 + m_IsContraintActive: 1 + m_IsLocked: 1 + m_Sources: [] +--- !u!1818360608 &1638236454 +PositionConstraint: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1638236449} + m_Enabled: 1 + m_Weight: 1 + m_TranslationAtRest: {x: 0, y: 0, z: 0} + m_TranslationOffset: {x: 0, y: 0, z: 0} + m_AffectTranslationX: 1 + m_AffectTranslationY: 1 + m_AffectTranslationZ: 1 + m_IsContraintActive: 0 + m_IsLocked: 0 + m_Sources: [] --- !u!1 &1647324172 GameObject: m_ObjectHideFlags: 0 @@ -41557,6 +41616,16 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2098678239} m_CullTransparentMesh: 1 +--- !u!1 &2105509200 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7051539713125569525, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} +--- !u!224 &2105509201 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8925473620302868482, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} --- !u!1 &2125404435 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 9c91392f4..d662b30db 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -706,7 +706,6 @@ namespace HeavenStudio new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the viewport in" ) } ), - new GameAction("screen shake", "Screen Shake", 1f, true, new List() { @@ -714,6 +713,15 @@ namespace HeavenStudio new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity") } ), + new GameAction("scale letterbox", "Scale Letterbox", 1f, true, new List() + { + new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Letterbox X"), + new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Letterbox Y"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in"), + new Param("toggle", true, "Mirror scaling", "Mirror the scaling of the letterbox via scaling the minigame as well.") + } + ), new GameAction("display textbox", "Display Textbox", 1f, true, new List() { diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index c3f4b7b32..04407add8 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -20,6 +20,8 @@ namespace HeavenStudio [SerializeField] Image ambientBg; [SerializeField] GameObject ambientBgGO; [SerializeField] GameObject letterboxBgGO; + [SerializeField] RectTransform letterboxMask; + [SerializeField] GameObject maskObj; public static StaticCamera instance { get; private set; } public new Camera camera; @@ -37,18 +39,27 @@ namespace HeavenStudio private List panEvents = new(); private List scaleEvents = new(); private List rotationEvents = new(); + private List letterboxEvents = new(); static Vector3 defaultPan = new Vector3(0, 0, 0); static Vector3 defaultScale = new Vector3(1, 1, 1); static float defaultRotation = 0; + static Vector3 defaultLetterbox = new Vector3(1, 1, 1); private static Vector3 pan; private static Vector3 scale; private static float rotation; + private static Vector3 letterbox; + private static Vector3 panInv; + private static Vector3 scaleInv; + + private static bool toggle; + private Transform[] children = null; private static Vector3 panLast; private static Vector3 scaleLast; private static float rotationLast; + private static Vector3 letterboxLast; private void Awake() { @@ -64,11 +75,16 @@ namespace HeavenStudio Reset(); panLast = defaultPan; + letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; ToggleLetterboxBg(PersistentDataManager.gameSettings.letterboxBgEnable); ToggleLetterboxGlow(PersistentDataManager.gameSettings.letterboxFxEnable); + /* + children = new Transform[ maskObj.transform.childCount ]; + foreach(Transform T in transform) + children.add(T);*/ } public void OnBeatChanged(double beat) @@ -78,26 +94,54 @@ namespace HeavenStudio panEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "pan view" }); scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale view" }); rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate view" }); + letterboxEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale letterbox" }); panLast = defaultPan; + letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; - + UpdatePan(); UpdateRotation(); UpdateScale(); + UpdateLetterbox(); } // Update is called once per frame void Update() { + UpdateLetterbox(); UpdatePan(); UpdateRotation(); UpdateScale(); - + canvas.localPosition = pan; - canvas.eulerAngles = new Vector3(0, 0, rotation); canvas.localScale = scale; + canvas.eulerAngles = new Vector3(0, 0, rotation); + //if(!toggle)canvas.localPosition = panInv; + //if(!toggle)canvas.localScale = scaleInv; + if(!toggle) + { + //canvas.transform.SetParent(null); dont do that + letterboxMask.localScale = letterbox; + canvas.transform.localScale = scale; + //letterboxMask.localScale = letterbox; + + } //heyo future me FIX THIS MESS PLEASEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + + //canvas.localScale = canvas.InverseTransformDirection(scaleInv); + /*if(!toggle) + { + canvas.localPosition = canvas.InverseTransformVector(panInv); + + canvas.eulerAngles = canvas.TransformVector(new Vector3(0, 0, rotation)); + toggle = true; + }else{ + canvas.localPosition = pan; + canvas.localScale = scale; + canvas.eulerAngles = new Vector3(0, 0, rotation); + } + */ } private void UpdatePan() @@ -199,11 +243,63 @@ namespace HeavenStudio } } + private void UpdateLetterbox() + { + foreach (var e in letterboxEvents) + { + float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + if (prog >= 0f) + { + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); + switch (e["axis"]) + { + case (int) ViewAxis.X: + letterbox.x = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + panInv = pan; + scaleInv = scale; + toggle = e["toggle"]; + break; + case (int) ViewAxis.Y: + letterbox.y = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + panInv = pan; + scaleInv = scale; + toggle = e["toggle"]; + break; + default: + float dx = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + letterbox = new Vector3(dx, dy, 1); + panInv = pan; + scaleInv = scale; + toggle = e["toggle"]; + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + letterboxLast.x = e["valA"] * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + letterboxLast.y = e["valB"] * AspectRatioHeight; + break; + default: + letterboxLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1); + break; + } + } + } + } + public static void Reset() { pan = defaultPan; scale = defaultScale; rotation = defaultRotation; + letterbox = defaultLetterbox; + toggle = true; } public void ToggleOverlayView(bool toggle) From 3c2a867f3f63e429625b42dc4e3650b14a804fd9 Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:43:03 -0400 Subject: [PATCH 2/5] i did another funny --- Assets/Scenes/Editor.unity | 54 +++--------- Assets/Scripts/Minigames.cs | 19 +++- Assets/Scripts/StaticCamera.cs | 153 ++++++++++++++++++++++++--------- 3 files changed, 141 insertions(+), 85 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index e460d2904..10937c2bb 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -6402,7 +6402,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 194, y: 0} + m_AnchoredPosition: {x: 194.00002, y: 0} m_SizeDelta: {x: 40, y: 40} m_Pivot: {x: 0, y: 0.5} --- !u!114 &285739500 @@ -13774,6 +13774,14 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 0} m_Modifications: + - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_SizeDelta.x + value: 1728 + objectReference: {fileID: 0} + - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_SizeDelta.y + value: 972 + objectReference: {fileID: 0} - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_ConstrainProportionsScale value: 0 @@ -15753,7 +15761,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 100, y: 0} + m_AnchoredPosition: {x: 100.000015, y: 0} m_SizeDelta: {x: 40, y: 40} m_Pivot: {x: 0, y: 0.5} --- !u!114 &689781278 @@ -24782,7 +24790,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 129.94975} + m_AnchoredPosition: {x: 0, y: 105.87459} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -33259,7 +33267,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1292844878} m_HandleRect: {fileID: 1292844877} m_Direction: 2 - m_Value: 1 + m_Value: 0 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -33685,40 +33693,6 @@ GameObject: m_CorrespondingSourceObject: {fileID: 2464883521749415129, guid: 720073bc7682b1441bece7116681f72c, type: 3} m_PrefabInstance: {fileID: 631525709} m_PrefabAsset: {fileID: 0} ---- !u!1818360610 &1638236453 -ScaleConstraint: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1638236449} - m_Enabled: 1 - m_Weight: 1 - m_ScaleAtRest: {x: 1, y: 1, z: 1} - m_ScaleOffset: {x: 1, y: 1, z: 1} - m_AffectScalingX: 1 - m_AffectScalingY: 1 - m_AffectScalingZ: 1 - m_IsContraintActive: 1 - m_IsLocked: 1 - m_Sources: [] ---- !u!1818360608 &1638236454 -PositionConstraint: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1638236449} - m_Enabled: 1 - m_Weight: 1 - m_TranslationAtRest: {x: 0, y: 0, z: 0} - m_TranslationOffset: {x: 0, y: 0, z: 0} - m_AffectTranslationX: 1 - m_AffectTranslationY: 1 - m_AffectTranslationZ: 1 - m_IsContraintActive: 0 - m_IsLocked: 0 - m_Sources: [] --- !u!1 &1647324172 GameObject: m_ObjectHideFlags: 0 @@ -36943,7 +36917,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -84.98999} + m_AnchoredPosition: {x: 0, y: -84.98996} m_SizeDelta: {x: 320, y: -84.99} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 @@ -41664,7 +41638,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 147, y: 0} + m_AnchoredPosition: {x: 147.00002, y: 0} m_SizeDelta: {x: 40, y: 40} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2125404437 diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index d662b30db..ec9091277 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -718,8 +718,23 @@ namespace HeavenStudio new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Letterbox X"), new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Letterbox Y"), new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), - new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in"), - new Param("toggle", true, "Mirror scaling", "Mirror the scaling of the letterbox via scaling the minigame as well.") + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in") + } + ), + new GameAction("complex pan", "Scale Viewport(Complex)", 1f, true, new List() + { + new Param("valA", new EntityTypes.Float(-50, 50, 1), "Pan Viewport X"), + new Param("valB", new EntityTypes.Float(-50, 50, 1), "Pan Viewport Y"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to pan the viewport in") + } + ), + new GameAction("complex scale", "Scale Viewport(Complex)", 1f, true, new List() + { + new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Viewport X"), + new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Viewport Y"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the viewport in") } ), diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index 04407add8..86d25be85 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -21,7 +21,7 @@ namespace HeavenStudio [SerializeField] GameObject ambientBgGO; [SerializeField] GameObject letterboxBgGO; [SerializeField] RectTransform letterboxMask; - [SerializeField] GameObject maskObj; + [SerializeField] RawImage viewportTexture; public static StaticCamera instance { get; private set; } public new Camera camera; @@ -40,11 +40,15 @@ namespace HeavenStudio private List scaleEvents = new(); private List rotationEvents = new(); private List letterboxEvents = new(); + private List complexPanEvents = new(); + private List complexScaleEvents = new(); static Vector3 defaultPan = new Vector3(0, 0, 0); static Vector3 defaultScale = new Vector3(1, 1, 1); static float defaultRotation = 0; static Vector3 defaultLetterbox = new Vector3(1, 1, 1); + static Vector3 defaultComplexPan = new Vector3(0, 0, 0); + static Vector3 defaultComplexScale = new Vector3(1, 1, 1); private static Vector3 pan; private static Vector3 scale; @@ -52,14 +56,15 @@ namespace HeavenStudio private static Vector3 letterbox; private static Vector3 panInv; private static Vector3 scaleInv; - - private static bool toggle; - private Transform[] children = null; + private static Vector3 complexPan; + private static Vector3 complexScale; private static Vector3 panLast; private static Vector3 scaleLast; private static float rotationLast; private static Vector3 letterboxLast; + private static Vector3 complexPanLast; + private static Vector3 complexScaleLast; private void Awake() { @@ -78,13 +83,11 @@ namespace HeavenStudio letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; + complexPanLast = defaultComplexPan; + complexScaleLast = defaultComplexScale; ToggleLetterboxBg(PersistentDataManager.gameSettings.letterboxBgEnable); ToggleLetterboxGlow(PersistentDataManager.gameSettings.letterboxFxEnable); - /* - children = new Transform[ maskObj.transform.childCount ]; - foreach(Transform T in transform) - children.add(T);*/ } public void OnBeatChanged(double beat) @@ -95,16 +98,22 @@ namespace HeavenStudio scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale view" }); rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate view" }); letterboxEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale letterbox" }); + complexPanEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "complex pan"}); + complexScaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "complex scale" }); panLast = defaultPan; letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; + complexPanLast = defaultComplexPan; + complexScaleLast = defaultComplexScale; UpdatePan(); UpdateRotation(); UpdateScale(); UpdateLetterbox(); + UpdateComplexPan(); + UpdatecomplexScale(); } // Update is called once per frame @@ -114,34 +123,18 @@ namespace HeavenStudio UpdatePan(); UpdateRotation(); UpdateScale(); + UpdateComplexPan(); + UpdatecomplexScale(); canvas.localPosition = pan; - canvas.localScale = scale; canvas.eulerAngles = new Vector3(0, 0, rotation); - //if(!toggle)canvas.localPosition = panInv; - //if(!toggle)canvas.localScale = scaleInv; - if(!toggle) - { - //canvas.transform.SetParent(null); dont do that - letterboxMask.localScale = letterbox; - canvas.transform.localScale = scale; - //letterboxMask.localScale = letterbox; - - } //heyo future me FIX THIS MESS PLEASEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - - //canvas.localScale = canvas.InverseTransformDirection(scaleInv); - /*if(!toggle) - { - canvas.localPosition = canvas.InverseTransformVector(panInv); - - canvas.eulerAngles = canvas.TransformVector(new Vector3(0, 0, rotation)); - toggle = true; - }else{ - canvas.localPosition = pan; - canvas.localScale = scale; - canvas.eulerAngles = new Vector3(0, 0, rotation); - } - */ + letterboxMask.localScale = letterbox; + scaleInv = scale; + scaleInv.x /= letterbox.x; + scaleInv.y /= letterbox.y; + scaleInv.z /= letterbox.z; + canvas.localScale = scaleInv; + viewportTexture.uvRect = new Rect(complexPan.x, complexPan.y, complexScale.x, complexScale.y); } private void UpdatePan() @@ -255,23 +248,14 @@ namespace HeavenStudio { case (int) ViewAxis.X: letterbox.x = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; - panInv = pan; - scaleInv = scale; - toggle = e["toggle"]; break; case (int) ViewAxis.Y: letterbox.y = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; - panInv = pan; - scaleInv = scale; - toggle = e["toggle"]; break; default: float dx = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; float dy = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; letterbox = new Vector3(dx, dy, 1); - panInv = pan; - scaleInv = scale; - toggle = e["toggle"]; break; } } @@ -293,13 +277,96 @@ namespace HeavenStudio } } + private void UpdateComplexPan() + { + foreach (var e in complexPanEvents) + { + float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + if (prog >= 0f) + { + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); + switch (e["axis"]) + { + case (int) ViewAxis.X: + complexPan.x = func(complexPanLast.x, e["valA"], Mathf.Min(prog, 1f)); + break; + case (int) ViewAxis.Y: + complexPan.y = func(complexPan.y, e["valB"], Mathf.Min(prog, 1f)); + break; + default: + float dx = func(complexPanLast.x, e["valA"], Mathf.Min(prog, 1f)); + float dy = func(complexPanLast.y, e["valB"], Mathf.Min(prog, 1f)); + complexPan = new Vector3(dx, dy, 0); + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + complexPanLast.x = e["valA"]; + break; + case (int) ViewAxis.Y: + complexPanLast.y = e["valB"]; + break; + default: + complexPanLast = new Vector3(e["valA"], e["valB"], 0); + break; + } + } + } + } + + private void UpdatecomplexScale() + { + foreach (var e in complexScaleEvents) + { + float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + if (prog >= 0f) + { + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); + switch (e["axis"]) + { + case (int) ViewAxis.X: + complexScale.x = func(complexScaleLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + complexScale.y = func(complexScaleLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + break; + default: + float dx = func(complexScaleLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(complexScaleLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + complexScale = new Vector3(dx, dy, 1); + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + complexScaleLast.x = e["valA"] * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + complexScaleLast.y = e["valB"] * AspectRatioHeight; + break; + default: + complexScaleLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1); + break; + } + } + } + } + public static void Reset() { pan = defaultPan; scale = defaultScale; rotation = defaultRotation; letterbox = defaultLetterbox; - toggle = true; + complexPan = defaultComplexPan; + complexScale = defaultComplexScale; } public void ToggleOverlayView(bool toggle) From 42439769d4fc8c638790ffeb7251fdedefcad4ec Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:08:02 -0400 Subject: [PATCH 3/5] fix --- Assets/Scenes/Editor.unity | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 10937c2bb..6d08de9a7 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -13776,11 +13776,11 @@ PrefabInstance: m_Modifications: - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_SizeDelta.x - value: 1728 + value: 16 objectReference: {fileID: 0} - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_SizeDelta.y - value: 972 + value: 9 objectReference: {fileID: 0} - target: {fileID: 1535126665250126034, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_ConstrainProportionsScale From 13f476546b00a8e9a0a54f2b687d5a20c867fd97 Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Sat, 12 Aug 2023 16:07:27 -0400 Subject: [PATCH 4/5] value changes --- Assets/Scenes/Editor.unity | 15 +++++++++++++++ Assets/Scripts/Minigames.cs | 6 +++--- Assets/Scripts/StaticCamera.cs | 14 +++++++------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 6d08de9a7..ba17b519d 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -13810,6 +13810,10 @@ PrefabInstance: propertyPath: letterboxMask value: objectReference: {fileID: 2105509201} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: viewportTexture + value: + objectReference: {fileID: 1638236456} - target: {fileID: 4820152107260776423, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_RaycastTarget value: 0 @@ -33693,6 +33697,17 @@ GameObject: m_CorrespondingSourceObject: {fileID: 2464883521749415129, guid: 720073bc7682b1441bece7116681f72c, type: 3} m_PrefabInstance: {fileID: 631525709} m_PrefabAsset: {fileID: 0} +--- !u!114 &1638236456 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 647613278910435637, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1638236449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1647324172 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index ec9091277..c03f0e345 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -721,7 +721,7 @@ namespace HeavenStudio new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in") } ), - new GameAction("complex pan", "Scale Viewport(Complex)", 1f, true, new List() + new GameAction("complex pan", "Pan Viewport(Complex)", 1f, true, new List() { new Param("valA", new EntityTypes.Float(-50, 50, 1), "Pan Viewport X"), new Param("valB", new EntityTypes.Float(-50, 50, 1), "Pan Viewport Y"), @@ -731,8 +731,8 @@ namespace HeavenStudio ), new GameAction("complex scale", "Scale Viewport(Complex)", 1f, true, new List() { - new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Viewport X"), - new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Viewport Y"), + new Param("valA", new EntityTypes.Float(0, 200, 100), "Scale Viewport X"), + new Param("valB", new EntityTypes.Float(0, 200, 100), "Scale Viewport Y"), new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the viewport in") } diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index 86d25be85..8c1f5b480 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -329,14 +329,14 @@ namespace HeavenStudio switch (e["axis"]) { case (int) ViewAxis.X: - complexScale.x = func(complexScaleLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + complexScale.x = func(complexScaleLast.x, e["valA"] * .01f, Mathf.Min(prog, 1f)) * AspectRatioWidth; break; case (int) ViewAxis.Y: - complexScale.y = func(complexScaleLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + complexScale.y = func(complexScaleLast.y, e["valB"] * .01f, Mathf.Min(prog, 1f)) * AspectRatioHeight; break; default: - float dx = func(complexScaleLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; - float dy = func(complexScaleLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + float dx = func(complexScaleLast.x, e["valA"] * .01f, Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(complexScaleLast.y, e["valB"] * .01f, Mathf.Min(prog, 1f)) * AspectRatioHeight; complexScale = new Vector3(dx, dy, 1); break; } @@ -346,13 +346,13 @@ namespace HeavenStudio switch (e["axis"]) { case (int) ViewAxis.X: - complexScaleLast.x = e["valA"] * AspectRatioWidth; + complexScaleLast.x = e["valA"] * .01f * AspectRatioWidth; break; case (int) ViewAxis.Y: - complexScaleLast.y = e["valB"] * AspectRatioHeight; + complexScaleLast.y = e["valB"] * .01f * AspectRatioHeight; break; default: - complexScaleLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1); + complexScaleLast = new Vector3(e["valA"] * .01f * AspectRatioWidth, e["valB"] * .01f * AspectRatioHeight, 1); break; } } From 0e3b02855d7dfd77ea5160810ae55b8f3e033580 Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:57:50 -0400 Subject: [PATCH 5/5] test --- Assets/Scenes/Editor.unity | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index ba17b519d..decf3b269 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -13878,6 +13878,10 @@ PrefabInstance: propertyPath: m_RaycastTarget value: 0 objectReference: {fileID: 0} + - target: {fileID: 8925473620302868482, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_SizeDelta.x + value: 16 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 720073bc7682b1441bece7116681f72c, type: 3} --- !u!1 &631525710 stripped @@ -20101,7 +20105,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1589389272} m_HandleRect: {fileID: 1589389271} m_Direction: 2 - m_Value: 0 + m_Value: 1 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -23627,7 +23631,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -408.9796, y: -17} + m_AnchoredPosition: {x: -408.97968, y: -17} m_SizeDelta: {x: -817.96, y: -46.29} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1121370303 @@ -24794,7 +24798,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: 0, y: 105.87459} + m_AnchoredPosition: {x: 0, y: 103.92639} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944