From d414ea55f56385e47b7dac46438ec01d57b6d647 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Fri, 31 Aug 2018 08:52:48 +0200 Subject: [PATCH] APC GUI. (#107) --- Content.Client/Content.Client.csproj | 1 + .../Components/Power/ApcBoundUserInterface.cs | 75 ++++++ .../Components/Power/ApcComponent.cs | 88 ++++++- .../Components/Power/PowerDebugTool.cs | 18 +- .../Power/PowerProviderComponent.cs | 73 +++++- .../GameObjects/Components/Power/Powernet.cs | 160 +++++++++--- .../Components/Power/SharedApcComponent.cs | 40 +++ Resources/Prototypes/Entities/Power.yml | 4 + Resources/Scenes/Power/Apc.tscn | 230 ++++++++++++++++++ engine | 2 +- 10 files changed, 632 insertions(+), 59 deletions(-) create mode 100644 Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs create mode 100644 Resources/Scenes/Power/Apc.tscn diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 0c2993fad1..0e49cf09d5 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -70,6 +70,7 @@ + diff --git a/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs new file mode 100644 index 0000000000..9307b50b26 --- /dev/null +++ b/Content.Client/GameObjects/Components/Power/ApcBoundUserInterface.cs @@ -0,0 +1,75 @@ +using System; +using Content.Shared.GameObjects.Components.Power; +using SS14.Client.GameObjects.Components.UserInterface; +using SS14.Client.UserInterface.Controls; +using SS14.Client.UserInterface.CustomControls; +using SS14.Shared.GameObjects.Components.UserInterface; +using SS14.Shared.Utility; + +namespace Content.Client.GameObjects.Components.Power +{ + public class ApcBoundUserInterface : BoundUserInterface + { + private SS14Window _window; + private BaseButton _breakerButton; + private Label _externalPowerStateLabel; + private ProgressBar _chargeBar; + + protected override void Open() + { + base.Open(); + + _window = new ApcWindow(); + _window.OnClose += Close; + _breakerButton = _window.Contents.GetChild("Rows/Breaker/Breaker"); + _breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage()); + _externalPowerStateLabel = _window.Contents.GetChild