Correctly clear inventory UI when HumanInventoryInterfaceController detaches.

Fixes #405
This commit is contained in:
Pieter-Jan Briers
2019-10-25 11:48:41 +02:00
parent 8a6751711a
commit 3a0856505d

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Storage;
using Content.Client.Utility;
using JetBrains.Annotations;
@@ -113,12 +114,17 @@ namespace Content.Client.GameObjects
}
foreach (var button in buttons)
{
ClearButton(button);
}
}
private void ClearButton(InventoryButton button)
{
button.SpriteView.Sprite = null;
button.OnPressed = AddToInventory;
button.StorageButton.Visible = false;
}
}
public override void PlayerAttached()
{
@@ -132,6 +138,11 @@ namespace Content.Client.GameObjects
base.PlayerDetached();
GameHud.InventoryQuickButtonContainer.RemoveChild(_quickButtonsContainer);
foreach (var button in _inventoryButtons.Values.SelectMany(l => l))
{
ClearButton(button);
}
}
private class HumanInventoryWindow : SS14Window