make filled inventory slots blank (#27150)
* blank filled slots * Update InventoryTemplatePrototype.cs
This commit is contained in:
@@ -251,6 +251,7 @@ namespace Content.Client.Inventory
|
||||
public string SlotGroup => SlotDef.SlotGroup;
|
||||
public string SlotDisplayName => SlotDef.DisplayName;
|
||||
public string TextureName => "Slots/" + SlotDef.TextureName;
|
||||
public string FullTextureName => SlotDef.FullTextureName;
|
||||
|
||||
public SlotData(SlotDefinition slotDef, ContainerSlot? container = null, bool highlighted = false,
|
||||
bool blocked = false)
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Content.Client.Inventory
|
||||
|
||||
if (entity == null)
|
||||
{
|
||||
button.SpriteView.SetEntity(null);
|
||||
button.SetEntity(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ namespace Content.Client.Inventory
|
||||
else
|
||||
return;
|
||||
|
||||
button.SpriteView.SetEntity(viewEnt);
|
||||
button.SetEntity(viewEnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Content.Client.UserInterface.Controls
|
||||
public SlotButton(SlotData slotData)
|
||||
{
|
||||
ButtonTexturePath = slotData.TextureName;
|
||||
FullButtonTexturePath = slotData.FullTextureName;
|
||||
Blocked = slotData.Blocked;
|
||||
Highlight = slotData.Highlighted;
|
||||
StorageTexturePath = "Slots/back";
|
||||
|
||||
@@ -15,11 +15,12 @@ namespace Content.Client.UserInterface.Controls
|
||||
public TextureRect ButtonRect { get; }
|
||||
public TextureRect BlockedRect { get; }
|
||||
public TextureRect HighlightRect { get; }
|
||||
public SpriteView SpriteView { get; }
|
||||
public SpriteView HoverSpriteView { get; }
|
||||
public TextureButton StorageButton { get; }
|
||||
public CooldownGraphic CooldownDisplay { get; }
|
||||
|
||||
private SpriteView SpriteView { get; }
|
||||
|
||||
public EntityUid? Entity => SpriteView.Entity;
|
||||
|
||||
private bool _slotNameSet;
|
||||
@@ -68,7 +69,18 @@ namespace Content.Client.UserInterface.Controls
|
||||
set
|
||||
{
|
||||
_buttonTexturePath = value;
|
||||
ButtonRect.Texture = Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
|
||||
UpdateButtonTexture();
|
||||
}
|
||||
}
|
||||
|
||||
private string? _fullButtonTexturePath;
|
||||
public string? FullButtonTexturePath
|
||||
{
|
||||
get => _fullButtonTexturePath;
|
||||
set
|
||||
{
|
||||
_fullButtonTexturePath = value;
|
||||
UpdateButtonTexture();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +209,21 @@ namespace Content.Client.UserInterface.Controls
|
||||
HoverSpriteView.SetEntity(null);
|
||||
}
|
||||
|
||||
public void SetEntity(EntityUid? ent)
|
||||
{
|
||||
SpriteView.SetEntity(ent);
|
||||
UpdateButtonTexture();
|
||||
}
|
||||
|
||||
private void UpdateButtonTexture()
|
||||
{
|
||||
var fullTexture = Theme.ResolveTextureOrNull(_fullButtonTexturePath);
|
||||
var texture = Entity.HasValue && fullTexture != null
|
||||
? fullTexture.Texture
|
||||
: Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
|
||||
ButtonRect.Texture = texture;
|
||||
}
|
||||
|
||||
private void OnButtonPressed(GUIBoundKeyEventArgs args)
|
||||
{
|
||||
Pressed?.Invoke(args, this);
|
||||
@@ -229,8 +256,8 @@ namespace Content.Client.UserInterface.Controls
|
||||
base.OnThemeUpdated();
|
||||
|
||||
StorageButton.TextureNormal = Theme.ResolveTextureOrNull(_storageTexturePath)?.Texture;
|
||||
ButtonRect.Texture = Theme.ResolveTextureOrNull(_buttonTexturePath)?.Texture;
|
||||
HighlightRect.Texture = Theme.ResolveTextureOrNull(_highlightTexturePath)?.Texture;
|
||||
UpdateButtonTexture();
|
||||
}
|
||||
|
||||
EntityUid? IEntityControl.UiEntity => Entity;
|
||||
|
||||
@@ -120,12 +120,12 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
|
||||
|
||||
if (_entities.TryGetComponent(hand.HeldEntity, out VirtualItemComponent? virt))
|
||||
{
|
||||
handButton.SpriteView.SetEntity(virt.BlockingEntity);
|
||||
handButton.SetEntity(virt.BlockingEntity);
|
||||
handButton.Blocked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
handButton.SpriteView.SetEntity(hand.HeldEntity);
|
||||
handButton.SetEntity(hand.HeldEntity);
|
||||
handButton.Blocked = false;
|
||||
}
|
||||
}
|
||||
@@ -171,12 +171,12 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
|
||||
|
||||
if (_entities.TryGetComponent(entity, out VirtualItemComponent? virt))
|
||||
{
|
||||
hand.SpriteView.SetEntity(virt.BlockingEntity);
|
||||
hand.SetEntity(virt.BlockingEntity);
|
||||
hand.Blocked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hand.SpriteView.SetEntity(entity);
|
||||
hand.SetEntity(entity);
|
||||
hand.Blocked = false;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public sealed class HandsUIController : UIController, IOnStateEntered<GameplaySt
|
||||
if (hand == null)
|
||||
return;
|
||||
|
||||
hand.SpriteView.SetEntity(null);
|
||||
hand.SetEntity(null);
|
||||
if (_playerHandsComponent?.ActiveHand?.Name == name)
|
||||
HandsGui?.UpdatePanelEntity(null);
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
if (_strippingWindow?.InventoryButtons.GetButton(update.Name) is { } inventoryButton)
|
||||
{
|
||||
inventoryButton.SpriteView.SetEntity(entity);
|
||||
inventoryButton.SetEntity(entity);
|
||||
inventoryButton.StorageButton.Visible = showStorage;
|
||||
}
|
||||
|
||||
@@ -426,12 +426,12 @@ public sealed class InventoryUIController : UIController, IOnStateEntered<Gamepl
|
||||
|
||||
if (_entities.TryGetComponent(entity, out VirtualItemComponent? virtb))
|
||||
{
|
||||
button.SpriteView.SetEntity(virtb.BlockingEntity);
|
||||
button.SetEntity(virtb.BlockingEntity);
|
||||
button.Blocked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.SpriteView.SetEntity(entity);
|
||||
button.SetEntity(entity);
|
||||
button.Blocked = false;
|
||||
button.StorageButton.Visible = showStorage;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@ public sealed partial class SlotDefinition
|
||||
{
|
||||
[DataField("name", required: true)] public string Name { get; private set; } = string.Empty;
|
||||
[DataField("slotTexture")] public string TextureName { get; private set; } = "pocket";
|
||||
/// <summary>
|
||||
/// The texture displayed in a slot when it has an item inside of it.
|
||||
/// </summary>
|
||||
[DataField] public string FullTextureName { get; private set; } = "SlotBackground";
|
||||
[DataField("slotFlags")] public SlotFlags SlotFlags { get; private set; } = SlotFlags.PREVENTEQUIP;
|
||||
[DataField("showInWindow")] public bool ShowInWindow { get; private set; } = true;
|
||||
[DataField("slotGroup")] public string SlotGroup { get; private set; } = "Default";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
displayName: ID
|
||||
- name: id
|
||||
slotTexture: id
|
||||
fullTextureName: template_small
|
||||
slotFlags: IDCARD
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
displayName: Head
|
||||
- name: id
|
||||
slotTexture: id
|
||||
fullTextureName: template_small
|
||||
slotFlags: IDCARD
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -64,6 +65,7 @@
|
||||
displayName: ID
|
||||
- name: belt
|
||||
slotTexture: belt
|
||||
fullTextureName: template_small
|
||||
slotFlags: BELT
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -72,6 +74,7 @@
|
||||
displayName: Belt
|
||||
- name: back
|
||||
slotTexture: back
|
||||
fullTextureName: template_small
|
||||
slotFlags: BACK
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -81,6 +84,7 @@
|
||||
|
||||
- name: pocket4
|
||||
slotTexture: web
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -89,6 +93,7 @@
|
||||
displayName: Pocket 4
|
||||
- name: pocket3
|
||||
slotTexture: web
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -104,6 +109,7 @@
|
||||
displayName: Suit
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -114,6 +120,7 @@
|
||||
stripHidden: true
|
||||
- name: pocket2
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
displayName: Head
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -65,6 +66,7 @@
|
||||
stripHidden: true
|
||||
- name: pocket2
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -84,6 +86,7 @@
|
||||
displayName: Suit Storage
|
||||
- name: belt
|
||||
slotTexture: belt
|
||||
fullTextureName: template_small
|
||||
slotFlags: BELT
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
displayName: Head
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -66,6 +67,7 @@
|
||||
stripHidden: true
|
||||
- name: pocket2
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -85,6 +87,7 @@
|
||||
displayName: Suit Storage
|
||||
- name: id
|
||||
slotTexture: id
|
||||
fullTextureName: template_small
|
||||
slotFlags: IDCARD
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -94,6 +97,7 @@
|
||||
displayName: ID
|
||||
- name: belt
|
||||
slotTexture: belt
|
||||
fullTextureName: template_small
|
||||
slotFlags: BELT
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -102,6 +106,7 @@
|
||||
displayName: Belt
|
||||
- name: back
|
||||
slotTexture: back
|
||||
fullTextureName: template_small
|
||||
slotFlags: BACK
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
slots:
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -12,6 +13,7 @@
|
||||
stripHidden: true
|
||||
- name: pocket2
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
displayName: Head
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -72,6 +73,7 @@
|
||||
stripHidden: true
|
||||
- name: pocket2
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -91,6 +93,7 @@
|
||||
displayName: Suit Storage
|
||||
- name: id
|
||||
slotTexture: id
|
||||
fullTextureName: template_small
|
||||
slotFlags: IDCARD
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -100,6 +103,7 @@
|
||||
displayName: ID
|
||||
- name: belt
|
||||
slotTexture: belt
|
||||
fullTextureName: template_small
|
||||
slotFlags: BELT
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -108,6 +112,7 @@
|
||||
displayName: Belt
|
||||
- name: back
|
||||
slotTexture: back
|
||||
fullTextureName: template_small
|
||||
slotFlags: BACK
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
- name: belt
|
||||
slotTexture: belt
|
||||
fullTextureName: template_small
|
||||
slotFlags: BELT
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
@@ -47,6 +48,7 @@
|
||||
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
@@ -60,6 +62,7 @@
|
||||
slots:
|
||||
- name: pocket1
|
||||
slotTexture: pocket
|
||||
fullTextureName: template_small
|
||||
slotFlags: POCKET
|
||||
slotGroup: MainHotbar
|
||||
stripTime: 3
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
displayName: Jumpsuit
|
||||
- name: id
|
||||
slotTexture: id
|
||||
fullTextureName: template_small
|
||||
slotFlags: IDCARD
|
||||
slotGroup: SecondHotbar
|
||||
stripTime: 6
|
||||
|
||||
BIN
Resources/Textures/Interface/Ashen/template_small.png
Normal file
BIN
Resources/Textures/Interface/Ashen/template_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Resources/Textures/Interface/Minimalist/template_small.png
Normal file
BIN
Resources/Textures/Interface/Minimalist/template_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 240 B |
BIN
Resources/Textures/Interface/Retro/template_small.png
Normal file
BIN
Resources/Textures/Interface/Retro/template_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 B |
Reference in New Issue
Block a user