From 8f8a400ccb62d5ddf5b55776243460289f9a253b Mon Sep 17 00:00:00 2001 From: vitellaryjr <43586575+vitellaryjr@users.noreply.github.com> Date: Sun, 29 Sep 2024 10:18:26 -0700 Subject: [PATCH] offset --- Code/RoomNameController.cs | 3 +++ Code/RoomNameDisplay.cs | 9 ++++++--- Code/RoomNameTrigger.cs | 3 +++ Loenn/entities/room_name.lua | 1 + Loenn/lang/en_gb.lang | 2 ++ Loenn/triggers/roomnametrigger.lua | 1 + 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Code/RoomNameController.cs b/Code/RoomNameController.cs index 6baf674..7f8ebe0 100644 --- a/Code/RoomNameController.cs +++ b/Code/RoomNameController.cs @@ -23,6 +23,7 @@ public class RoomNameController : Entity private float lineAmt; private float timer; private float scale; + private float yOffset; public RoomNameController(EntityData data, Vector2 offset) : base(data.Position + offset) { @@ -32,6 +33,7 @@ public RoomNameController(EntityData data, Vector2 offset) : base(data.Position lineColor = data.Attr("outlineColor", "000000FF"); lineAmt = data.Float("outlineThickness", 0f); scale = data.Float("scale", 1f); + yOffset = data.Float("offset", 0f); timer = data.Float("disappearTimer", -1f); } @@ -42,6 +44,7 @@ public override void Awake(Scene scene) display.SetName(Name); display.SetColor(textColor, bgColor, lineColor, lineAmt); display.SetTimer(Math.Max(timer, 0f)); + display.nextOffset = yOffset; display.scale = scale; } } diff --git a/Code/RoomNameDisplay.cs b/Code/RoomNameDisplay.cs index cc4d242..204a43d 100644 --- a/Code/RoomNameDisplay.cs +++ b/Code/RoomNameDisplay.cs @@ -18,6 +18,8 @@ public class RoomNameDisplay : Entity private float textLerp; private string text; private string nextText; + private float yOffset; + public float nextOffset; public Color bgColor; public Color textColor; @@ -84,6 +86,7 @@ public override void Update() { text = nextText; outline = nextOutline; + yOffset = nextOffset; } } @@ -105,20 +108,20 @@ public override void Update() public override void Render() { base.Render(); - var y = Calc.LerpClamp(1080f, 1080f - (48f * scale), Ease.CubeOut(drawLerp)); + var y = Calc.LerpClamp(1080f, 1080f - (48f * scale) + yOffset, Ease.CubeOut(drawLerp)); Color bgC = bgColor; if (colorLerp < 1f) { bgC = Color.Lerp(bgColorStart, bgColor, colorLerp); } - Draw.Rect(-2f, y, 1920f + 4f, (48f * scale) + 2f, bgC); + Draw.Rect(-2f, y, 1920f + 4f, (1080f - y) + 2f, bgC); if (text != "") { Color textC = textColor; if (colorLerp < 1f) { textC = Color.Lerp(textColorStart, textColor, colorLerp); } - var texty = Calc.LerpClamp(1080f, 1080f - (48f * scale), Ease.CubeOut(Calc.Min(textLerp, drawLerp))); + var texty = Calc.LerpClamp(1080f, 1080f - (48f * scale) + yOffset, Ease.CubeOut(Calc.Min(textLerp, drawLerp))); if (outline > 0f) { ActiveFont.DrawOutline(text, new Vector2(960, texty - 6f), new Vector2(0.5f, 0f), new Vector2(scale, scale), textC, outline, lineColor); diff --git a/Code/RoomNameTrigger.cs b/Code/RoomNameTrigger.cs index d723e68..a479606 100644 --- a/Code/RoomNameTrigger.cs +++ b/Code/RoomNameTrigger.cs @@ -24,6 +24,7 @@ public class RoomNameTrigger : Trigger private bool oneUse; private bool instant; private float scale; + private float yOffset; public RoomNameTrigger(EntityData data, Vector2 offset) : base(data, offset) { @@ -33,6 +34,7 @@ public RoomNameTrigger(EntityData data, Vector2 offset) : base(data, offset) lineColor = data.Attr("outlineColor", "000000FF"); lineAmt = data.Float("outlineThickness", 0f); scale = data.Float("scale", 1f); + yOffset = data.Float("offset", 0f); timer = data.Float("disappearTimer", -1f); oneUse = data.Bool("oneUse", false); @@ -46,6 +48,7 @@ public override void OnEnter(Player player) display.SetName(Name); display.SetColor(textColor, bgColor, lineColor, lineAmt); display.SetTimer(Math.Max(timer, 0f)); + display.nextOffset = yOffset; display.scale = scale; if (instant) { diff --git a/Loenn/entities/room_name.lua b/Loenn/entities/room_name.lua index 5f209a5..b9cb54c 100644 --- a/Loenn/entities/room_name.lua +++ b/Loenn/entities/room_name.lua @@ -14,6 +14,7 @@ roomName.placements = { outlineColor = "000000FF", outlineThickness = 0, scale = 1, + offset = 0, } } } diff --git a/Loenn/lang/en_gb.lang b/Loenn/lang/en_gb.lang index e3d9b31..6b946de 100644 --- a/Loenn/lang/en_gb.lang +++ b/Loenn/lang/en_gb.lang @@ -306,6 +306,7 @@ entities.vitellary/roomname.attributes.description.textColor=The color of the ro entities.vitellary/roomname.attributes.description.outlineColor=The color of the text's outline, if it has one. entities.vitellary/roomname.attributes.description.outlineThickness=The size of the text's outline. 0 means it won't have one. entities.vitellary/roomname.attributes.description.scale=The scale multiplier of the room name. +entities.vitellary/roomname.attributes.description.offset=Vertical offset of the room name. Negative values make it higher. entities.vitellary/roomname.attributes.description.disappearTimer=The amount of time until the room name goes away. Negative values means the text won't disappear. # Remote Trigger @@ -408,6 +409,7 @@ triggers.vitellary/roomnametrigger.attributes.description.textColor=The color of triggers.vitellary/roomnametrigger.attributes.description.outlineColor=The color of the text's outline, if it has one. triggers.vitellary/roomnametrigger.attributes.description.outlineThickness=The size of the text's outline. 0 means it won't have one. triggers.vitellary/roomnametrigger.attributes.description.scale=The scale multiplier of the room name. +triggers.vitellary/roomnametrigger.attributes.description.offset=Vertical offset of the room name. Negative values make it higher. triggers.vitellary/roomnametrigger.attributes.description.disappearTimer=The amount of time until the room name goes away. Negative values means the text won't disappear. triggers.vitellary/roomnametrigger.attributes.description.oneUse=Whether the trigger should only apply once. triggers.vitellary/roomnametrigger.attributes.description.instant=Whether the text and colors should instantly appear, rather than easing in. diff --git a/Loenn/triggers/roomnametrigger.lua b/Loenn/triggers/roomnametrigger.lua index abe9040..89b4990 100644 --- a/Loenn/triggers/roomnametrigger.lua +++ b/Loenn/triggers/roomnametrigger.lua @@ -15,6 +15,7 @@ roomNameTrigger.placements = { scale = 1, oneUse = false, instant = false, + offset = 0, } } }