diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 4fce48ae2..a68c646e0 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -840,40 +840,6 @@ 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 ca3f17220..1617dff1f 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -41,28 +41,14 @@ 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; @@ -85,12 +71,8 @@ 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); @@ -103,51 +85,26 @@ 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() @@ -249,143 +206,11 @@ 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)