fix units

This commit is contained in:
Firerise9402 2023-08-17 14:52:04 -04:00
parent 0e3b02855d
commit 4ff3ba8dfc
2 changed files with 10 additions and 9 deletions

View file

@ -715,8 +715,8 @@ namespace HeavenStudio
),
new GameAction("scale letterbox", "Scale Letterbox", 1f, true, new List<Param>()
{
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("valA", new EntityTypes.Float(0, 200, 100), "Scale Letterbox X"),
new Param("valB", new EntityTypes.Float(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")
}

View file

@ -16,6 +16,7 @@ namespace HeavenStudio
{
[SerializeField] RectTransform canvas;
[SerializeField] GameObject overlayView;
[SerializeField] RectTransform parentView;
[SerializeField] Image ambientBg;
[SerializeField] GameObject ambientBgGO;
@ -247,14 +248,14 @@ namespace HeavenStudio
switch (e["axis"])
{
case (int) ViewAxis.X:
letterbox.x = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth;
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"], Mathf.Min(prog, 1f)) * AspectRatioHeight;
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"], Mathf.Min(prog, 1f)) * AspectRatioWidth;
float dy = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight;
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;
}
@ -264,13 +265,13 @@ namespace HeavenStudio
switch (e["axis"])
{
case (int) ViewAxis.X:
letterboxLast.x = e["valA"] * AspectRatioWidth;
letterboxLast.x = e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth;
break;
case (int) ViewAxis.Y:
letterboxLast.y = e["valB"] * AspectRatioHeight;
letterboxLast.y = e["valB"] * .01f * parentView.localScale.y * AspectRatioHeight;
break;
default:
letterboxLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1);
letterboxLast = new Vector3(e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth, e["valB"] * .01f * canvas.localScale.y * AspectRatioHeight, 1);
break;
}
}