Added TextureButton for opening Storage items
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Client.Utility;
|
using Content.Client.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.Interfaces.GameObjects.Components;
|
using Robust.Client.Interfaces.GameObjects.Components;
|
||||||
@@ -52,7 +52,8 @@ namespace Content.Client.GameObjects
|
|||||||
void AddButton(out InventoryButton variable, Slots slot, string textureName)
|
void AddButton(out InventoryButton variable, Slots slot, string textureName)
|
||||||
{
|
{
|
||||||
var texture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
|
var texture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
|
||||||
variable = new InventoryButton(slot, texture)
|
var storageTexture = _resourceCache.GetTexture($"/Textures/UserInterface/Inventory/back.png");
|
||||||
|
variable = new InventoryButton(slot, texture, storageTexture)
|
||||||
{
|
{
|
||||||
OnPressed = AddToInventory
|
OnPressed = AddToInventory
|
||||||
};
|
};
|
||||||
@@ -152,7 +153,8 @@ namespace Content.Client.GameObjects
|
|||||||
void AddButton(Slots slot, string textureName, Vector2 position)
|
void AddButton(Slots slot, string textureName, Vector2 position)
|
||||||
{
|
{
|
||||||
var texture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
|
var texture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/{textureName}.png");
|
||||||
var button = new InventoryButton(slot, texture)
|
var storageTexture = resourceCache.GetTexture($"/Textures/UserInterface/Inventory/back.png");
|
||||||
|
var button = new InventoryButton(slot, texture, storageTexture)
|
||||||
{
|
{
|
||||||
Position = position
|
Position = position
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Shared.GameObjects.Components.Inventory;
|
using Content.Shared.GameObjects.Components.Inventory;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -16,7 +16,7 @@ namespace Content.Client.GameObjects
|
|||||||
|
|
||||||
public Action<BaseButton.ButtonEventArgs> OnPressed { get; set; }
|
public Action<BaseButton.ButtonEventArgs> OnPressed { get; set; }
|
||||||
|
|
||||||
public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture)
|
public InventoryButton(EquipmentSlotDefines.Slots slot, Texture texture, Texture storageTexture)
|
||||||
{
|
{
|
||||||
Slot = slot;
|
Slot = slot;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ namespace Content.Client.GameObjects
|
|||||||
AddChild(Button = new TextureButton
|
AddChild(Button = new TextureButton
|
||||||
{
|
{
|
||||||
TextureNormal = texture,
|
TextureNormal = texture,
|
||||||
Scale = (2, 2),
|
Scale = (2, 2)
|
||||||
});
|
});
|
||||||
|
|
||||||
Button.OnPressed += e => OnPressed?.Invoke(e);
|
Button.OnPressed += e => OnPressed?.Invoke(e);
|
||||||
@@ -35,6 +35,15 @@ namespace Content.Client.GameObjects
|
|||||||
MouseFilter = MouseFilterMode.Ignore,
|
MouseFilter = MouseFilterMode.Ignore,
|
||||||
Scale = (2, 2)
|
Scale = (2, 2)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddChild(Button = new TextureButton
|
||||||
|
{
|
||||||
|
TextureNormal = storageTexture,
|
||||||
|
Scale = (0.75f, 0.75f),
|
||||||
|
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
|
||||||
|
SizeFlagsVertical = SizeFlags.ShrinkEnd,
|
||||||
|
Visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user