Files
tbd-station-14/Content.Client/UserInterface/HandButton.cs
ike709 69dbb9f654 HUD Themes (#3774)
* HUD Themes

* Prototypes

* field

* oops

* ugh

* Fixes

* Update Content.Client/UserInterface/GameHud.cs

Co-authored-by: ike709 <sparebytes@protonmail.com>
2021-04-12 00:43:53 +02:00

47 lines
1.3 KiB
C#

using Content.Shared.GameObjects.Components.Items;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface
{
public class HandButton : ItemSlotButton
{
private bool _activeHand;
private bool _highlighted;
public HandButton(Texture texture, Texture storageTexture, string textureName, Texture blockedTexture, HandLocation location) : base(texture, storageTexture, textureName)
{
Location = location;
AddChild(Blocked = new TextureRect
{
Texture = blockedTexture,
TextureScale = (2, 2),
MouseFilter = MouseFilterMode.Stop,
Visible = false
});
}
public HandLocation Location { get; }
public TextureRect Blocked { get; }
public void SetActiveHand(bool active)
{
_activeHand = active;
UpdateHighlight();
}
public override void Highlight(bool highlight)
{
_highlighted = highlight;
UpdateHighlight();
}
private void UpdateHighlight()
{
// always stay highlighted if active
base.Highlight(_activeHand || _highlighted);
}
}
}