2021-12-30 22:56:10 +01:00
|
|
|
|
using Content.Client.HUD;
|
|
|
|
|
|
using Content.Client.Items.UI;
|
2021-06-09 22:19:39 +02:00
|
|
|
|
using Content.Shared.Hands.Components;
|
2020-07-25 15:11:16 +02:00
|
|
|
|
using Robust.Client.Graphics;
|
2020-10-28 10:16:40 +01:00
|
|
|
|
using Robust.Client.UserInterface.Controls;
|
2020-07-25 15:11:16 +02:00
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
|
namespace Content.Client.Hands
|
2020-07-25 15:11:16 +02:00
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
|
public sealed class HandButton : ItemSlotButton
|
2020-07-25 15:11:16 +02:00
|
|
|
|
{
|
2021-01-20 00:32:44 -08:00
|
|
|
|
private bool _activeHand;
|
|
|
|
|
|
private bool _highlighted;
|
|
|
|
|
|
|
2021-12-30 22:56:10 +01:00
|
|
|
|
public HandButton(int size, string textureName, string storageTextureName, IGameHud gameHud, Texture blockedTexture, HandLocation location) : base(size, textureName, storageTextureName, gameHud)
|
2020-07-25 15:11:16 +02:00
|
|
|
|
{
|
|
|
|
|
|
Location = location;
|
2020-10-28 10:16:40 +01:00
|
|
|
|
|
|
|
|
|
|
AddChild(Blocked = new TextureRect
|
|
|
|
|
|
{
|
|
|
|
|
|
Texture = blockedTexture,
|
|
|
|
|
|
TextureScale = (2, 2),
|
|
|
|
|
|
MouseFilter = MouseFilterMode.Stop,
|
|
|
|
|
|
Visible = false
|
|
|
|
|
|
});
|
2020-07-25 15:11:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public HandLocation Location { get; }
|
2020-10-28 10:16:40 +01:00
|
|
|
|
public TextureRect Blocked { get; }
|
2021-01-20 00:32:44 -08:00
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
}
|
2020-07-25 15:11:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|