From b4cbe248b5ee96eacf14d6e079d1e0bee9415aaf Mon Sep 17 00:00:00 2001 From: Trest <144359854+trest100@users.noreply.github.com> Date: Thu, 21 Nov 2024 13:14:18 +0300 Subject: [PATCH 1/6] [PORT]Health Analyzer update (#925) * Fuck * Update HealthAnalyzerSystem.cs * Update medical-scanner-component.ftl * Update HealthAnalyzerWindow.xaml.cs * Update health-analyzer-component.ftl * fix --- .../UI/HealthAnalyzerBoundUserInterface.cs | 31 ++- .../UI/HealthAnalyzerWindow.xaml | 222 ++++++++++++++++-- .../UI/HealthAnalyzerWindow.xaml.cs | 123 ++++++++-- .../Medical/HealthAnalyzerSystem.cs | 77 +++++- .../HealthAnalyzerScannedUserMessage.cs | 12 +- .../components/health-analyzer-component.ftl | 2 +- .../components/medical-scanner-component.ftl | 1 + 7 files changed, 398 insertions(+), 70 deletions(-) diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs index baea03c8923..649e3fcc941 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerBoundUserInterface.cs @@ -1,6 +1,7 @@ using Content.Shared.MedicalScanner; +using Content.Shared.Backmen.Targeting; using JetBrains.Annotations; -using Robust.Client.UserInterface; +using Robust.Client.GameObjects; namespace Content.Client.HealthAnalyzer.UI { @@ -17,10 +18,13 @@ public HealthAnalyzerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owne protected override void Open() { base.Open(); - - _window = this.CreateWindow(); - - _window.Title = EntMan.GetComponent(Owner).EntityName; + _window = new HealthAnalyzerWindow + { + Title = EntMan.GetComponent(Owner).EntityName, + }; + _window.OnClose += Close; + _window.OnBodyPartSelected += SendBodyPartMessage; + _window.OpenCentered(); } protected override void ReceiveMessage(BoundUserInterfaceMessage message) @@ -33,5 +37,22 @@ protected override void ReceiveMessage(BoundUserInterfaceMessage message) _window.Populate(cast); } + + private void SendBodyPartMessage(TargetBodyPart? part, EntityUid target) => SendMessage(new HealthAnalyzerPartMessage(EntMan.GetNetEntity(target), part ?? null)); + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + + if (_window != null) + { + _window.OnClose -= Close; + _window.OnBodyPartSelected -= SendBodyPartMessage; + } + + _window?.Dispose(); + } } } diff --git a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml index aae8785b1fe..0a0b5ac89e7 100644 --- a/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml +++ b/Content.Client/HealthAnalyzer/UI/HealthAnalyzerWindow.xaml @@ -1,8 +1,8 @@ - + MinWidth="350">