diff --git a/Assets/Materials/3DGameRenderTex.mat b/Assets/Materials/3DGameRenderTex.mat index 78c4bc5a9..91a3f3c41 100644 --- a/Assets/Materials/3DGameRenderTex.mat +++ b/Assets/Materials/3DGameRenderTex.mat @@ -2,14 +2,15 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: 3DGameRenderTex m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 @@ -75,6 +76,7 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _AlphaClip: 0 - _Blend: 0 diff --git a/Assets/Materials/3DGameRenderTex.renderTexture b/Assets/Materials/3DGameRenderTex.renderTexture index 5bcfd6910..81e1211cb 100644 --- a/Assets/Materials/3DGameRenderTex.renderTexture +++ b/Assets/Materials/3DGameRenderTex.renderTexture @@ -13,12 +13,12 @@ RenderTexture: m_ForcedFallbackFormat: 4 m_DownscaleFallback: 0 m_IsAlphaChannelOptional: 0 - serializedVersion: 3 + serializedVersion: 5 m_Width: 1920 m_Height: 1080 m_AntiAliasing: 1 m_MipCount: -1 - m_DepthFormat: 2 + m_DepthStencilFormat: 92 m_ColorFormat: 8 m_MipMap: 0 m_GenerateMips: 1 @@ -36,3 +36,4 @@ RenderTexture: m_WrapW: 1 m_Dimension: 2 m_VolumeDepth: 1 + m_ShadowSamplingMode: 2 diff --git a/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab b/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab index 0456bb4ea..b7be96297 100644 --- a/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab +++ b/Assets/Resources/Prefabs/GameView/CamerasEditor.prefab @@ -90,9 +90,14 @@ MonoBehaviour: m_EditorClassIdentifier: canvas: {fileID: 1535126665250126034} overlayView: {fileID: 2482900817612876218} + parentView: {fileID: 0} + parent: {fileID: 0} ambientBg: {fileID: 5129120947114944961} ambientBgGO: {fileID: 269805006432045765} letterboxBgGO: {fileID: 3741076794236313655} + letterboxMask: {fileID: 0} + viewportTexture: {fileID: 0} + gameRenderTexture: {fileID: 0} camera: {fileID: 378821074852065722} --- !u!1 &269805006432045765 GameObject: diff --git a/Assets/Resources/Prefabs/GameView/CamerasGame.prefab b/Assets/Resources/Prefabs/GameView/CamerasGame.prefab index 15d46aab9..1e19701ee 100644 --- a/Assets/Resources/Prefabs/GameView/CamerasGame.prefab +++ b/Assets/Resources/Prefabs/GameView/CamerasGame.prefab @@ -227,9 +227,14 @@ MonoBehaviour: m_EditorClassIdentifier: canvas: {fileID: 1168123228960484818} overlayView: {fileID: 2814421364062256314} + parentView: {fileID: 0} + parent: {fileID: 0} ambientBg: {fileID: 4779885053979786433} ambientBgGO: {fileID: 487891016983371717} letterboxBgGO: {fileID: 3931965693507761463} + letterboxMask: {fileID: 0} + viewportTexture: {fileID: 0} + gameRenderTexture: {fileID: 0} camera: {fileID: 16338400879174842} --- !u!1 &487891016983371717 GameObject: diff --git a/Assets/Resources/Prefabs/GameView/OverlayTexMaterial.mat b/Assets/Resources/Prefabs/GameView/OverlayTexMaterial.mat index b0c1a08bb..191db926b 100644 --- a/Assets/Resources/Prefabs/GameView/OverlayTexMaterial.mat +++ b/Assets/Resources/Prefabs/GameView/OverlayTexMaterial.mat @@ -2,14 +2,15 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: OverlayTexMaterial m_Shader: {fileID: 4800000, guid: 0596a6838d78f624397b642817cf20bc, type: 3} - m_ShaderKeywords: + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 @@ -55,6 +56,7 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _BumpScale: 1 - _ColorMask: 15 diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 6ad4a3110..925c39fce 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -1673,6 +1673,11 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 58525995} m_CullTransparentMesh: 1 +--- !u!224 &66970446 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8512930684284350359, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} --- !u!1 &73172994 GameObject: m_ObjectHideFlags: 0 @@ -12210,7 +12215,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -50} + m_AnchoredPosition: {x: 0, y: -50.000015} m_SizeDelta: {x: -48, y: -148} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &572765323 @@ -13782,10 +13787,54 @@ PrefabInstance: 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: parent + value: + objectReference: {fileID: 1568335707} + - 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: parentView + value: + objectReference: {fileID: 1112762038} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: letterboxMask + value: + objectReference: {fileID: 2105509201} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: overlayCanvas + value: + objectReference: {fileID: 66970446} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: overlayTexture + value: + objectReference: {fileID: 631525715} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: viewportTexture + value: + objectReference: {fileID: 1638236456} + - target: {fileID: 4035854539513523048, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: gameRenderTexture + value: + objectReference: {fileID: 8400000, guid: da1c23fc8a9167c438d0d771189a6157, type: 2} + - target: {fileID: 4500092555783399993, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_ScreenMatchMode + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4820152107260776423, guid: 720073bc7682b1441bece7116681f72c, type: 3} propertyPath: m_RaycastTarget value: 0 @@ -13850,6 +13899,18 @@ 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} + - target: {fileID: 8925473620302868482, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8925473620302868482, guid: 720073bc7682b1441bece7116681f72c, type: 3} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 720073bc7682b1441bece7116681f72c, type: 3} --- !u!1 &631525710 stripped @@ -23635,9 +23696,14 @@ 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.9795, y: -17} + m_AnchoredPosition: {x: -408.97974, y: -17} m_SizeDelta: {x: -817.96, y: -46.29} m_Pivot: {x: 0.5, y: 0.5} +--- !u!224 &1112762038 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2077856143944097172, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} --- !u!1 &1121370303 GameObject: m_ObjectHideFlags: 0 @@ -24802,7 +24868,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: 118.49958} + m_AnchoredPosition: {x: 0, y: 118.49953} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!114 &1154875944 @@ -31634,7 +31700,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: -42.495087} + m_AnchoredPosition: {x: 0, y: -42.49511} m_SizeDelta: {x: 1440.022, y: -84.99} m_Pivot: {x: 0, y: 0.5} --- !u!114 &1527251881 @@ -33067,6 +33133,17 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1567318395} m_CullTransparentMesh: 1 +--- !u!114 &1568335707 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 4500092555783399993, guid: 720073bc7682b1441bece7116681f72c, type: 3} + m_PrefabInstance: {fileID: 631525709} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1575762741 GameObject: m_ObjectHideFlags: 0 @@ -33700,6 +33777,22 @@ 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!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 @@ -36924,7 +37017,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.98996} + m_AnchoredPosition: {x: 0, y: -84.989975} m_SizeDelta: {x: 320, y: -84.99} m_Pivot: {x: 0, y: 1} --- !u!1 &1852819572 @@ -40996,7 +41089,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: -42.495087} + m_AnchoredPosition: {x: 0, y: -42.49511} m_SizeDelta: {x: 1054, y: -84.99} m_Pivot: {x: 0, y: 0.5} --- !u!114 &2066632681 @@ -41597,6 +41690,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 4a6e61e91..5cc5b41e5 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,7 +713,40 @@ namespace HeavenStudio new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity") } ), - + /* kinda broken idk if its useful but its here + new GameAction("scale letterbox", "Scale Letterbox", 1f, true, new List() + { + new Param("valA", new EntityTypes.Integer(0, 200, 100), "Scale Letterbox X"), + new Param("valB", new EntityTypes.Integer(0, 200, 100), "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 GameAction("fit to screen", "Fit Game To Screen", 0.5f, false, new List() + { + new Param("toggle", false, "Toggle", "Toggle the game fitting to the screen.") + }, + delegate + { + StaticCamera.instance.UpdateFitToScreen(eventCaller.currentEntity["toggle"]); + } + ), + new GameAction("tile screen", "Tile Screen", 1f, true, new List() + { + new Param("valA", new EntityTypes.Float(1, 50, 1), "Tile Screen X"), + new Param("valB", new EntityTypes.Float(1, 50, 1), "Tile Screen Y"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to tile the screen in") + } + ), + new GameAction("pan tiles", "Pan Tiles", 1f, true, new List() + { + new Param("valA", new EntityTypes.Float(-50, 50, 0), "Pan Tiles X"), + new Param("valB", new EntityTypes.Float(-50, 50, 0), "Pan Tiles Y"), + new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to pan the tiles in") + } + ), new GameAction("pan window", "Move Window", 1f, true, new List() { new Param("valA", new EntityTypes.Float(-100, 200, 0), "Window X", "The Window's destination X coordinate. Can go off screen. Measured in percent from bottom left of screen."), diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index c3f4b7b32..ca3f17220 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -16,10 +16,14 @@ namespace HeavenStudio { [SerializeField] RectTransform canvas; [SerializeField] GameObject overlayView; + [SerializeField] RectTransform overlayCanvas; + [SerializeField] RectTransform parentView; [SerializeField] Image ambientBg; [SerializeField] GameObject ambientBgGO; [SerializeField] GameObject letterboxBgGO; + [SerializeField] RectTransform letterboxMask; + [SerializeField] RawImage viewportTexture; public static StaticCamera instance { get; private set; } public new Camera camera; @@ -37,18 +41,35 @@ namespace HeavenStudio private List panEvents = new(); private List scaleEvents = new(); private List rotationEvents = new(); + private List letterboxEvents = new(); + private List panTileEvents = new(); + private List tileScreenEvents = new(); + private List fitToScreenEvents = 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 defaultTilePan = new Vector3(0, 0, 0); + static Vector3 defaultScreenTile = new Vector3(1, 1, 1); + static bool defaultFitToScreen = false; 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 Vector3 tilePan; + private static Vector3 screenTile; + private static bool fitToScreen; private static Vector3 panLast; private static Vector3 scaleLast; private static float rotationLast; + private static Vector3 letterboxLast; + private static Vector3 tilePanLast; + private static Vector3 screenTileLast; private void Awake() { @@ -64,8 +85,12 @@ namespace HeavenStudio Reset(); panLast = defaultPan; + letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; + tilePanLast = defaultTilePan; + screenTileLast = defaultScreenTile; + fitToScreen = defaultFitToScreen; ToggleLetterboxBg(PersistentDataManager.gameSettings.letterboxBgEnable); ToggleLetterboxGlow(PersistentDataManager.gameSettings.letterboxFxEnable); @@ -78,26 +103,51 @@ 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" }); + fitToScreenEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "fit to screen" }); + panTileEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "pan tiles"}); + tileScreenEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "tile screen" }); panLast = defaultPan; + letterboxLast = defaultLetterbox; scaleLast = defaultScale; rotationLast = defaultRotation; - + tilePanLast = defaultTilePan; + screenTileLast = defaultScreenTile; + fitToScreen = defaultFitToScreen; + UpdatePan(); UpdateRotation(); UpdateScale(); + UpdateLetterbox(); + UpdateTilePan(); + UpdateScreenTile(); } // Update is called once per frame void Update() { + UpdateLetterbox(); UpdatePan(); UpdateRotation(); UpdateScale(); - + UpdateTilePan(); + UpdateScreenTile(); + canvas.localPosition = pan; canvas.eulerAngles = new Vector3(0, 0, rotation); + if(fitToScreen) + { + letterboxMask.localScale = new Vector3(parentView.sizeDelta.x/16, parentView.sizeDelta.y/9, 1); + overlayCanvas.localScale = new Vector3(parentView.sizeDelta.x/16, parentView.sizeDelta.y/9, 1); + } + else + { + letterboxMask.localScale = new Vector3(1, 1, 1); + overlayCanvas.localScale = new Vector3(1, 1, 1); + } canvas.localScale = scale; + viewportTexture.uvRect = new Rect(tilePan.x, tilePan.y, screenTile.x, screenTile.y); } private void UpdatePan() @@ -199,11 +249,143 @@ 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"] * .01f * parentView.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + letterbox.y = func(letterboxLast.y, e["valB"] * .01f * parentView.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; + break; + default: + float dx = func(letterboxLast.x, e["valA"] * .01f * parentView.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(letterboxLast.y, e["valB"] * .01f * parentView.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; + letterbox = new Vector3(dx, dy, 1); + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + letterboxLast.x = e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + letterboxLast.y = e["valB"] * .01f * parentView.localScale.y * AspectRatioHeight; + break; + default: + letterboxLast = new Vector3(e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth, e["valB"] * .01f * canvas.localScale.y * AspectRatioHeight, 1); + break; + } + } + } + } + + private void UpdateTilePan() + { + foreach (var e in panTileEvents) + { + 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: + tilePan.x = func(tilePanLast.x, e["valA"], Mathf.Min(prog, 1f)); + break; + case (int) ViewAxis.Y: + tilePan.y = func(tilePan.y, e["valB"], Mathf.Min(prog, 1f)); + break; + default: + float dx = func(tilePanLast.x, e["valA"], Mathf.Min(prog, 1f)); + float dy = func(tilePanLast.y, e["valB"], Mathf.Min(prog, 1f)); + tilePan = new Vector3(dx, dy, 0); + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + tilePanLast.x = e["valA"]; + break; + case (int) ViewAxis.Y: + tilePanLast.y = e["valB"]; + break; + default: + tilePanLast = new Vector3(e["valA"], e["valB"], 0); + break; + } + } + } + } + + private void UpdateScreenTile() + { + foreach (var e in tileScreenEvents) + { + 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: + screenTile.x = func(screenTileLast.x, e["valA"] * canvas.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + screenTile.y = func(screenTileLast.y, e["valB"] * canvas.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; + break; + default: + float dx = func(screenTileLast.x, e["valA"] * canvas.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(screenTileLast.y, e["valB"] * canvas.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; + screenTile = new Vector3(dx, dy, 1); + break; + } + } + if (prog > 1f) + { + switch (e["axis"]) + { + case (int) ViewAxis.X: + screenTileLast.x = e["valA"] * canvas.localScale.x * AspectRatioWidth; + break; + case (int) ViewAxis.Y: + screenTileLast.y = e["valB"] * canvas.localScale.y * AspectRatioHeight; + break; + default: + screenTileLast = new Vector3(e["valA"] * canvas.localScale.x * AspectRatioWidth, e["valB"] * canvas.localScale.y * AspectRatioHeight, 1); + break; + } + } + } + } + + public void UpdateFitToScreen(bool toggle) + { + fitToScreen = toggle; + } + public static void Reset() { pan = defaultPan; scale = defaultScale; rotation = defaultRotation; + letterbox = defaultLetterbox; + tilePan = defaultTilePan; + screenTile = defaultScreenTile; + fitToScreen = defaultFitToScreen; } public void ToggleOverlayView(bool toggle)