get that crap outta here (completely rewrites inventorysystem) (#5807)
* some work * equip: done unequip: todo * unequipping done & refactored events * workin * movin * reee namespaces * stun * mobstate * fixes * some work on events * removes serverside itemcomp & misc fixes * work * smol merge fix * ports template to prototype & finishes ui * moves relay & adds containerenumerator * actions & cuffs * my god what is actioncode * more fixes * im loosing my grasp on reality * more fixes * more work * explosions * yes * more work * more fixes * merge master & misc fixed because i forgot to commit before merging master * more fixes * fixes * moar * more work * moar fixes * suffixmap * more work on client * motivation low * no. no containers * mirroring client to server * fixes * move serverinvcomp * serverinventorycomponent is dead * gaming * only strippable & ai left... * only ai and richtext left * fixes ai * fixes * fixes sprite layers * more fixes * resolves optional * yes * stable™️ * fixes * moar fixes * moar * fix some tests * lmao * no comment * good to merge™️ * fixes build but for real * adresses some reviews * adresses some more reviews * nullables, yo * fixes lobbyscreen * timid refactor to differentiate actor & target * adresses more reviews * more * my god what a mess * removed the rest of duplicates * removed duplicate slotflags and renamed shoes to feet * removes another unused one * yes * fixes lobby & makes tryunequip return unequipped item * fixes * some funny renames * fixes * misc improvements to attemptevents * fixes * merge fixes Co-authored-by: Paul Ritter <ritter.paul1@gmail.com>
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
using System;
|
||||
using Content.Client.Cooldown;
|
||||
using Content.Client.HUD;
|
||||
using Content.Client.Items.Managers;
|
||||
using Content.Client.Stylesheets;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Items.UI
|
||||
{
|
||||
@@ -19,7 +22,7 @@ namespace Content.Client.Items.UI
|
||||
|
||||
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
||||
|
||||
public EntityUid Entity { get; set; }
|
||||
public EntityUid? Entity { get; set; }
|
||||
public TextureRect Button { get; }
|
||||
public SpriteView SpriteView { get; }
|
||||
public SpriteView HoverSpriteView { get; }
|
||||
@@ -35,19 +38,19 @@ namespace Content.Client.Items.UI
|
||||
|
||||
private readonly PanelContainer _highlightRect;
|
||||
|
||||
public string TextureName { get; set; }
|
||||
private string _textureName;
|
||||
private string _storageTextureName;
|
||||
|
||||
public ItemSlotButton(Texture texture, Texture storageTexture, string textureName)
|
||||
public ItemSlotButton(int size, string textureName, string storageTextureName, IGameHud gameHud)
|
||||
{
|
||||
_textureName = textureName;
|
||||
_storageTextureName = storageTextureName;
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
MinSize = (64, 64);
|
||||
|
||||
TextureName = textureName;
|
||||
MinSize = (size, size);
|
||||
|
||||
AddChild(Button = new TextureRect
|
||||
{
|
||||
Texture = texture,
|
||||
TextureScale = (2, 2),
|
||||
MouseFilter = MouseFilterMode.Stop
|
||||
});
|
||||
@@ -75,7 +78,6 @@ namespace Content.Client.Items.UI
|
||||
|
||||
AddChild(StorageButton = new TextureButton
|
||||
{
|
||||
TextureNormal = storageTexture,
|
||||
Scale = (0.75f, 0.75f),
|
||||
HorizontalAlignment = HAlignment.Right,
|
||||
VerticalAlignment = VAlignment.Bottom,
|
||||
@@ -108,6 +110,14 @@ namespace Content.Client.Items.UI
|
||||
{
|
||||
Visible = false,
|
||||
});
|
||||
|
||||
RefreshTextures(gameHud);
|
||||
}
|
||||
|
||||
public void RefreshTextures(IGameHud gameHud)
|
||||
{
|
||||
Button.Texture = gameHud.GetHudTexture(_textureName);
|
||||
StorageButton.TextureNormal = gameHud.GetHudTexture(_storageTextureName);
|
||||
}
|
||||
|
||||
protected override void EnteredTree()
|
||||
|
||||
Reference in New Issue
Block a user