From e40b775f7c3c36eef1c72dd0355062ec714733a8 Mon Sep 17 00:00:00 2001 From: moneyl <8206401+Moneyl@users.noreply.github.com> Date: Thu, 16 May 2019 13:22:55 -0400 Subject: [PATCH] Added properties for several ui controls to ApcWindow By PJBs suggestion. Cleaner to do this instead of repeatedly calling GetChild. Also changed ApcBoundUserInterface._window from an SS14Window to an ApcWindow to avoid extra type casting. --- .../Components/Power/ApcBoundUserInterface.cs | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs index 335963310c..06f74127a2 100644 --- a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs +++ b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs @@ -1,5 +1,6 @@ using System; using Content.Shared.GameObjects.Components.Power; +using NJsonSchema.Validation; using OpenTK.Graphics.OpenGL4; using Robust.Client.GameObjects.Components.UserInterface; using Robust.Client.Interfaces.Graphics; @@ -14,7 +15,7 @@ namespace Content.Client.GameObjects.Components.Power { public class ApcBoundUserInterface : BoundUserInterface { - private SS14Window _window; + private ApcWindow _window; private BaseButton _breakerButton; private Label _externalPowerStateLabel; private ProgressBar _chargeBar; @@ -30,11 +31,11 @@ namespace Content.Client.GameObjects.Components.Power _window.OnClose += Close; _window.AddToScreen(); - _breakerButton = _window.Contents.GetChild("Rows/Breaker/Breaker"); + _breakerButton = _window.BreakerButton; _breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage()); - _externalPowerStateLabel = _window.Contents.GetChild