Update submodule, UI fixes.
This commit is contained in:
@@ -57,10 +57,10 @@ namespace Content.Client.UserInterface
|
||||
|
||||
AddChild(hBox);
|
||||
|
||||
_leftButton.OnPressed += args => HandKeyBindDown(args.Event, HandNameLeft);
|
||||
_leftButton.OnStoragePressed += args => _OnStoragePressed(args.Event, HandNameLeft);
|
||||
_rightButton.OnPressed += args => HandKeyBindDown(args.Event, HandNameRight);
|
||||
_rightButton.OnStoragePressed += args => _OnStoragePressed(args.Event, HandNameRight);
|
||||
_leftButton.OnPressed += args => HandKeyBindDown(args, HandNameLeft);
|
||||
_leftButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameLeft);
|
||||
_rightButton.OnPressed += args => HandKeyBindDown(args, HandNameRight);
|
||||
_rightButton.OnStoragePressed += args => _OnStoragePressed(args, HandNameRight);
|
||||
|
||||
// Active hand
|
||||
_leftButton.AddChild(ActiveHandRect = new TextureRect
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -8,26 +10,26 @@ namespace Content.Client.GameObjects
|
||||
{
|
||||
public sealed class ItemSlotButton : MarginContainer
|
||||
{
|
||||
public BaseButton Button { get; }
|
||||
public TextureRect Button { get; }
|
||||
public SpriteView SpriteView { get; }
|
||||
public BaseButton StorageButton { get; }
|
||||
public TextureRect CooldownCircle { get; }
|
||||
|
||||
public Action<BaseButton.ButtonEventArgs> OnPressed { get; set; }
|
||||
public Action<BaseButton.ButtonEventArgs> OnStoragePressed { get; set; }
|
||||
public Action<GUIBoundKeyEventArgs> OnPressed { get; set; }
|
||||
public Action<GUIBoundKeyEventArgs> OnStoragePressed { get; set; }
|
||||
|
||||
public ItemSlotButton(Texture texture, Texture storageTexture)
|
||||
{
|
||||
CustomMinimumSize = (64, 64);
|
||||
|
||||
AddChild(Button = new TextureButton
|
||||
AddChild(Button = new TextureRect
|
||||
{
|
||||
TextureNormal = texture,
|
||||
Scale = (2, 2),
|
||||
EnableAllKeybinds = true
|
||||
Texture = texture,
|
||||
TextureScale = (2, 2),
|
||||
MouseFilter = MouseFilterMode.Stop
|
||||
});
|
||||
|
||||
Button.OnPressed += OnButtonPressed;
|
||||
Button.OnKeyBindDown += OnButtonPressed;
|
||||
|
||||
AddChild(SpriteView = new SpriteView
|
||||
{
|
||||
@@ -42,9 +44,16 @@ namespace Content.Client.GameObjects
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
|
||||
SizeFlagsVertical = SizeFlags.ShrinkEnd,
|
||||
Visible = false,
|
||||
EnableAllKeybinds = true
|
||||
});
|
||||
|
||||
StorageButton.OnKeyBindDown += args =>
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
OnButtonPressed(args);
|
||||
}
|
||||
};
|
||||
|
||||
StorageButton.OnPressed += OnStorageButtonPressed;
|
||||
|
||||
AddChild(CooldownCircle = new TextureRect
|
||||
@@ -57,20 +66,20 @@ namespace Content.Client.GameObjects
|
||||
});
|
||||
}
|
||||
|
||||
private void OnButtonPressed(BaseButton.ButtonEventArgs args)
|
||||
private void OnButtonPressed(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
OnPressed?.Invoke(args);
|
||||
}
|
||||
|
||||
private void OnStorageButtonPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
if (args.Event.Function == EngineKeyFunctions.Use)
|
||||
if (args.Event.Function == EngineKeyFunctions.UIClick)
|
||||
{
|
||||
OnStoragePressed?.Invoke(args);
|
||||
OnStoragePressed?.Invoke(args.Event);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnPressed?.Invoke(args);
|
||||
OnPressed?.Invoke(args.Event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user