Update submodule, UI fixes.
This commit is contained in:
@@ -114,13 +114,13 @@ namespace Content.Client.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HandleInventoryKeybind(BaseButton.ButtonEventArgs args, Slots slot)
|
||||
protected override void HandleInventoryKeybind(GUIBoundKeyEventArgs args, Slots slot)
|
||||
{
|
||||
if (!_inventoryButtons.TryGetValue(slot, out var buttons))
|
||||
return;
|
||||
if (!Owner.TryGetSlot(slot, out var item))
|
||||
return;
|
||||
if (_itemSlotManager.OnButtonPressed(args.Event, item))
|
||||
if (_itemSlotManager.OnButtonPressed(args, item))
|
||||
return;
|
||||
|
||||
base.HandleInventoryKeybind(args, slot);
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -62,39 +63,35 @@ namespace Content.Client.GameObjects
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void HandleInventoryKeybind(BaseButton.ButtonEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
protected virtual void HandleInventoryKeybind(GUIBoundKeyEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
{
|
||||
if (args.Event.CanFocus)
|
||||
if (args.Function == EngineKeyFunctions.UIClick)
|
||||
{
|
||||
UseItemOnInventory(args, slot);
|
||||
UseItemOnInventory(slot);
|
||||
}
|
||||
}
|
||||
|
||||
protected void AddToInventory(BaseButton.ButtonEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
protected void AddToInventory(GUIBoundKeyEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
{
|
||||
if (!args.Event.CanFocus)
|
||||
if (args.Function != EngineKeyFunctions.UIClick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
args.Button.Pressed = false;
|
||||
|
||||
Owner.SendEquipMessage(slot);
|
||||
}
|
||||
|
||||
protected void UseItemOnInventory(BaseButton.ButtonEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
protected void UseItemOnInventory(EquipmentSlotDefines.Slots slot)
|
||||
{
|
||||
args.Button.Pressed = false;
|
||||
|
||||
Owner.SendUseMessage(slot);
|
||||
}
|
||||
|
||||
protected void OpenStorage(BaseButton.ButtonEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
protected void OpenStorage(GUIBoundKeyEventArgs args, EquipmentSlotDefines.Slots slot)
|
||||
{
|
||||
if (!args.Event.CanFocus && args.Event.Function != ContentKeyFunctions.ActivateItemInWorld)
|
||||
if (args.Function != EngineKeyFunctions.UIClick && args.Function != ContentKeyFunctions.ActivateItemInWorld)
|
||||
{
|
||||
return;
|
||||
}
|
||||
args.Button.Pressed = false;
|
||||
|
||||
Owner.SendOpenStorageUIMessage(slot);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
version: 1 # Not used right now, whatever.
|
||||
binds:
|
||||
- function: UIClick
|
||||
type: state
|
||||
key: MouseLeft
|
||||
canFocus: true
|
||||
- function: Use
|
||||
type: state
|
||||
key: MouseLeft
|
||||
@@ -84,6 +88,7 @@ binds:
|
||||
- function: ActivateItemInWorld
|
||||
type: state
|
||||
key: E
|
||||
canFocus: true
|
||||
- function: ThrowItemInHand
|
||||
type: state
|
||||
key: MouseLeft
|
||||
|
||||
Submodule RobustToolbox updated: 51b87513ed...f54f4ffe52
Reference in New Issue
Block a user