diff --git a/Content.Client/Points/PointSystem.cs b/Content.Client/Points/PointSystem.cs new file mode 100644 index 0000000000..f41c4b09ab --- /dev/null +++ b/Content.Client/Points/PointSystem.cs @@ -0,0 +1,58 @@ +using Content.Client.CharacterInfo; +using Content.Client.Message; +using Content.Shared.Points; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Shared.GameStates; + +namespace Content.Client.Points; + +/// +public sealed class PointSystem : SharedPointSystem +{ + [Dependency] private readonly CharacterInfoSystem _characterInfo = default!; + + /// + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(OnGetCharacterInfoControls); + } + + private void OnHandleState(EntityUid uid, PointManagerComponent component, ref ComponentHandleState args) + { + if (args.Current is not PointManagerComponentState state) + return; + + component.Points = new(state.Points); + component.Scoreboard = state.Scoreboard; + _characterInfo.RequestCharacterInfo(); + } + + private void OnGetCharacterInfoControls(ref CharacterInfoSystem.GetCharacterInfoControlsEvent ev) + { + foreach (var point in EntityQuery()) + { + var box = new BoxContainer + { + Margin = new Thickness(5), + Orientation = BoxContainer.LayoutOrientation.Vertical + }; + + var title = new RichTextLabel + { + HorizontalAlignment = Control.HAlignment.Center + }; + title.SetMarkup(Loc.GetString("point-scoreboard-header")); + + var text = new RichTextLabel(); + text.SetMessage(point.Scoreboard); + + box.AddChild(title); + box.AddChild(text); + ev.Controls.Add(box); + } + } +} diff --git a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs index a09b458685..71a06d58ee 100644 --- a/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs +++ b/Content.Client/UserInterface/Systems/Character/CharacterUIController.cs @@ -109,6 +109,7 @@ public sealed class CharacterUIController : UIController, IOnStateEntered -