Skip to content

Commit

Permalink
Merge pull request #73 from CommunalHelper/room-name
Browse files Browse the repository at this point in the history
i hope im done with these changes
  • Loading branch information
vitellaryjr authored Sep 29, 2024
2 parents 12e2429 + 8f8a400 commit 6a8f14a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Code/RoomNameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
}
Expand All @@ -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;
}
}
Expand Down
9 changes: 6 additions & 3 deletions Code/RoomNameDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -84,6 +86,7 @@ public override void Update()
{
text = nextText;
outline = nextOutline;
yOffset = nextOffset;
}
}

Expand All @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions Code/RoomNameTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand All @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions Loenn/entities/room_name.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ roomName.placements = {
outlineColor = "000000FF",
outlineThickness = 0,
scale = 1,
offset = 0,
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Loenn/lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions Loenn/triggers/roomnametrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ roomNameTrigger.placements = {
scale = 1,
oneUse = false,
instant = false,
offset = 0,
}
}
}
Expand Down

0 comments on commit 6a8f14a

Please sign in to comment.