Change OpenUI into ToggleUI on the client side. (#2036)

This commit is contained in:
derek
2020-09-07 01:17:24 -07:00
committed by GitHub
parent 071a961d00
commit 204b50c201

View File

@@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Storage
base.OnAdd(); base.OnAdd();
Window = new StorageWindow() Window = new StorageWindow()
{StorageEntity = this, Title = Owner.Name}; { StorageEntity = this, Title = Owner.Name };
} }
public override void OnRemove() public override void OnRemove()
@@ -55,7 +55,7 @@ namespace Content.Client.GameObjects.Components.Storage
break; break;
//Opens the UI //Opens the UI
case OpenStorageUIMessage _: case OpenStorageUIMessage _:
OpenUI(); ToggleUI();
break; break;
case CloseStorageUIMessage _: case CloseStorageUIMessage _:
CloseUI(); CloseUI();
@@ -76,11 +76,14 @@ namespace Content.Client.GameObjects.Components.Storage
} }
/// <summary> /// <summary>
/// Opens the storage UI /// Opens the storage UI if closed. Closes it if opened.
/// </summary> /// </summary>
private void OpenUI() private void ToggleUI()
{ {
Window.Open(); if (Window.IsOpen)
Window.Close();
else
Window.Open();
} }
private void CloseUI() private void CloseUI()
@@ -107,8 +110,8 @@ namespace Content.Client.GameObjects.Components.Storage
private Label Information; private Label Information;
public ClientStorageComponent StorageEntity; public ClientStorageComponent StorageEntity;
private StyleBoxFlat _HoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.35f)}; private StyleBoxFlat _HoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.35f) };
private StyleBoxFlat _unHoveredBox = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.0f)}; private StyleBoxFlat _unHoveredBox = new StyleBoxFlat { BackgroundColor = Color.Black.WithAlpha(0.0f) };
protected override Vector2? CustomSize => (180, 320); protected override Vector2? CustomSize => (180, 320);