diff --git a/Content.Client/ADT/ApathySystem.cs b/Content.Client/ADT/ApathySystem.cs new file mode 100644 index 0000000000..f1c2bff109 --- /dev/null +++ b/Content.Client/ADT/ApathySystem.cs @@ -0,0 +1,49 @@ +using Content.Shared.Drugs; +using Robust.Client.Graphics; +using Robust.Client.Player; +using Robust.Shared.Player; +using Content.Shared.Alert; +using Content.Client.UserInterface.Systems.DamageOverlays; +using Content.Shared.ADT; + +namespace Content.Client.ADT; + +public sealed class ApathySystem : EntitySystem +{ + [Dependency] private readonly IPlayerManager _player = default!; + [Dependency] private readonly AlertsSystem _alertsSystem = default!; + public static string ApathyKey = "Apathy"; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(OnShutdown); + SubscribeLocalEvent(OnPlayerAttached); + SubscribeLocalEvent(OnPlayerDetached); + + } + + private void OnInit(EntityUid uid, ApathyComponent component, ComponentInit args) + { + if (_player.LocalPlayer?.ControlledEntity == uid) + _alertsSystem.ShowAlert(uid, component.Alert); + } + + private void OnShutdown(EntityUid uid, ApathyComponent component, ComponentShutdown args) + { + if (_player.LocalPlayer?.ControlledEntity == uid) + _alertsSystem.ClearAlert(uid, component.Alert); + } + + private void OnPlayerAttached(EntityUid uid, ApathyComponent component, LocalPlayerAttachedEvent args) + { + _alertsSystem.ShowAlert(uid, component.Alert); + } + + private void OnPlayerDetached(EntityUid uid, ApathyComponent component, LocalPlayerDetachedEvent args) + { + _alertsSystem.ClearAlert(uid, component.Alert); + } +} diff --git a/Content.Client/ADT/BoomBox/UI/BoomBoxBoundUi.cs b/Content.Client/ADT/BoomBox/UI/BoomBoxBoundUi.cs new file mode 100644 index 0000000000..db3a6057ba --- /dev/null +++ b/Content.Client/ADT/BoomBox/UI/BoomBoxBoundUi.cs @@ -0,0 +1,67 @@ +using Content.Shared.BoomBox; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.ADT.BoomBox.UI; + +[UsedImplicitly] +public sealed class BoomBoxBoundUi : BoundUserInterface +{ + [ViewVariables] + private BoomBoxWindow? _window; + + public BoomBoxBoundUi(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _window = new BoomBoxWindow(); + _window.OpenCentered(); + + _window.OnClose += Close; + _window.MinusVolButtonPressed += OnMinusVolButtonPressed; + _window.PlusVolButtonPressed += OnPlusVolButtonPressed; + _window.StartButtonPressed += OnStartButtonPressed; + _window.StopButtonPressed += OnStopButtonPressed; + } + + private void OnMinusVolButtonPressed() + { + SendMessage(new BoomBoxMinusVolMessage()); + } + + private void OnPlusVolButtonPressed() + { + SendMessage(new BoomBoxPlusVolMessage()); + } + + private void OnStartButtonPressed() + { + SendMessage(new BoomBoxStartMessage()); + } + + private void OnStopButtonPressed() + { + SendMessage(new BoomBoxStopMessage()); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + + if (_window == null || state is not BoomBoxUiState cast) + return; + + _window.UpdateState(cast); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (disposing) + _window?.Dispose(); + } +} diff --git a/Content.Client/ADT/BoomBox/UI/BoomBoxWindow.xaml b/Content.Client/ADT/BoomBox/UI/BoomBoxWindow.xaml new file mode 100644 index 0000000000..a3653d0557 --- /dev/null +++ b/Content.Client/ADT/BoomBox/UI/BoomBoxWindow.xaml @@ -0,0 +1,25 @@ + + + +