From 204b50c201794362c29a0864ea8b1894c9aae09d Mon Sep 17 00:00:00 2001 From: derek Date: Mon, 7 Sep 2020 01:17:24 -0700 Subject: [PATCH] Change OpenUI into ToggleUI on the client side. (#2036) --- .../Storage/ClientStorageComponent.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs index 4c5d5dce36..2cf1b964c4 100644 --- a/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs +++ b/Content.Client/GameObjects/Components/Storage/ClientStorageComponent.cs @@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Storage base.OnAdd(); Window = new StorageWindow() - {StorageEntity = this, Title = Owner.Name}; + { StorageEntity = this, Title = Owner.Name }; } public override void OnRemove() @@ -55,7 +55,7 @@ namespace Content.Client.GameObjects.Components.Storage break; //Opens the UI case OpenStorageUIMessage _: - OpenUI(); + ToggleUI(); break; case CloseStorageUIMessage _: CloseUI(); @@ -76,11 +76,14 @@ namespace Content.Client.GameObjects.Components.Storage } /// - /// Opens the storage UI + /// Opens the storage UI if closed. Closes it if opened. /// - private void OpenUI() + private void ToggleUI() { - Window.Open(); + if (Window.IsOpen) + Window.Close(); + else + Window.Open(); } private void CloseUI() @@ -107,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Storage private Label Information; public ClientStorageComponent StorageEntity; - private StyleBoxFlat _HoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.35f)}; - private StyleBoxFlat _unHoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.0f)}; + private StyleBoxFlat _HoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.35f) }; + private StyleBoxFlat _unHoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.0f) }; protected override Vector2? CustomSize => (180, 320);