Fixed HandsGui and added an icon to access worn inventories (#279)

* Fixed HandsGui children so that HandsGui is clickable

* Added TextureButton for opening Storage items

* Update ClientInventoryComponent.cs

Fixed HandleComponentState so that it only updates the inventory when there are changes.

* Implemented storage button on Inventory

Adds a small button on the bottom right of Storage items when inside the inventory. When the button is pressed it opens the Storage UI.
This commit is contained in:
ShadowCommander
2019-07-31 16:38:24 -07:00
committed by Pieter-Jan Briers
parent 1d9d01b355
commit 151d3a3672
8 changed files with 84 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using Content.Shared.GameObjects.Components.Inventory;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
@@ -13,10 +13,12 @@ namespace Content.Client.GameObjects
public BaseButton Button { get; }
public SpriteView SpriteView { get; }
public BaseButton StorageButton { get; }
public Action<BaseButton.ButtonEventArgs> OnPressed { get; set; }
public Action<BaseButton.ButtonEventArgs> OnStoragePressed { get; set; }
public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture)
public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture, Texture storageTexture)
{
Slot = slot;
@@ -25,7 +27,7 @@ namespace Content.Client.GameObjects
AddChild(Button = new TextureButton
{
TextureNormal = texture,
Scale = (2, 2),
Scale = (2, 2)
});
Button.OnPressed += e => OnPressed?.Invoke(e);
@@ -35,6 +37,17 @@ namespace Content.Client.GameObjects
MouseFilter = MouseFilterMode.Ignore,
Scale = (2, 2)
});
AddChild(StorageButton = new TextureButton
{
TextureNormal = storageTexture,
Scale = (0.75f, 0.75f),
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
SizeFlagsVertical = SizeFlags.ShrinkEnd,
Visible = false
});
StorageButton.OnPressed += e => OnStoragePressed?.Invoke(e);
}
}
}