Skip to content

Commit

Permalink
Merge branch 'uncreated-networking-cleanup' of https://github.com/Unc…
Browse files Browse the repository at this point in the history
…reatedStaff/UncreatedWarfare into uncreated-networking-cleanup
  • Loading branch information
DanielWillett committed Jan 5, 2025
2 parents f5cf71f + 56c02f3 commit 46dbfa7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion UncreatedWarfare/Squads/UI/PlayerSquadHUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Uncreated.Warfare.Squads.UI;
public class PlayerSquadHUD : UnturnedUI, IEventListener<SquadMemberJoined>, IEventListener<SquadMemberLeft>
{
public UnturnedLabel SquadName { get; } = new UnturnedLabel("PlayerSquadName");
public UnturnedLabel SquadNumber { get; } = new UnturnedLabel("PlayerSquadName/PlayerSquadNumber");
public UnturnedLabel[] SquadMembers { get; } = ElementPatterns.CreateArray<UnturnedLabel>("PlayerSquadMember_{0}", 1, to: 6);

public PlayerSquadHUD(AssetConfiguration assetConfig, ILoggerFactory loggerFactory)
Expand All @@ -37,7 +38,8 @@ private void UpdateForSquad(Squad squad)
}
private void UpdateForPlayer(WarfarePlayer player, Squad squad)
{
SquadName.SetText(player, $"{squad.Name.ToUpper()} {squad.Members.Count}/{Squad.MaxMembers}");
SquadName.SetText(player, $"{squad.Name} {squad.Members.Count}/{Squad.MaxMembers}");
SquadNumber.SetText(player, squad.TeamIdentificationNumber.ToString());
for (int i = 0; i < SquadMembers.Length; i++)
{
UnturnedLabel element = SquadMembers[i];
Expand Down
4 changes: 4 additions & 0 deletions UncreatedWarfare/Squads/UI/SquadMenuUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private void SendSquadDetail(SquadMenuElement element, Squad squad, WarfarePlaye
{
element.Root.Show(player);
element.SquadName.SetText(player, squad.Name);
element.SquadNumber.SetText(player, squad.TeamIdentificationNumber.ToString());
element.MemberCount.SetText(player, $"{squad.Members.Count}/{Squad.MaxMembers}");

element.SquadJoinLeaveButton.Enable(player);
Expand Down Expand Up @@ -194,6 +195,9 @@ public class SquadMenuElement
[Pattern("", Root = true, CleanJoin = '_')]
public UnturnedUIElement Root { get; set; }

[Pattern("Number", Mode = FormatMode.Format)]
public UnturnedLabel SquadNumber { get; set; }

[Pattern("Name", Mode = FormatMode.Format)]
public UnturnedLabel SquadName { get; set; }

Expand Down

0 comments on commit 46dbfa7

Please sign in to comment.