Make character inventory slightly nicer.
This commit is contained in:
@@ -225,7 +225,8 @@ namespace Content.Client.GameObjects
|
|||||||
|
|
||||||
if (SlotNames.ContainsKey(slot))
|
if (SlotNames.ContainsKey(slot))
|
||||||
{
|
{
|
||||||
newbutton.GetChild<Button>("Button").Text = SlotNames[slot];
|
var button = newbutton.GetChild<Button>("Button");
|
||||||
|
button.Text = button.ToolTip = SlotNames[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
GridContainer.AddChild(newbutton);
|
GridContainer.AddChild(newbutton);
|
||||||
@@ -240,8 +241,10 @@ namespace Content.Client.GameObjects
|
|||||||
var button = InventorySlots[slot];
|
var button = InventorySlots[slot];
|
||||||
|
|
||||||
button.EntityUid = entity.Uid;
|
button.EntityUid = entity.Uid;
|
||||||
button.GetChild<Button>("Button").OnPressed += RemoveFromInventory;
|
var theButton = button.GetChild<Button>("Button");
|
||||||
button.GetChild<Button>("Button").OnPressed -= AddToInventory;
|
theButton.OnPressed += RemoveFromInventory;
|
||||||
|
theButton.OnPressed -= AddToInventory;
|
||||||
|
theButton.Text = "";
|
||||||
|
|
||||||
//Gets entity sprite and assigns it to button texture
|
//Gets entity sprite and assigns it to button texture
|
||||||
if (entity.TryGetComponent(out ISpriteComponent sprite))
|
if (entity.TryGetComponent(out ISpriteComponent sprite))
|
||||||
@@ -273,8 +276,10 @@ namespace Content.Client.GameObjects
|
|||||||
var button = InventorySlots[slot];
|
var button = InventorySlots[slot];
|
||||||
button.GetChild<SpriteView>("SpriteView").Sprite = null;
|
button.GetChild<SpriteView>("SpriteView").Sprite = null;
|
||||||
button.EntityUid = EntityUid.Invalid;
|
button.EntityUid = EntityUid.Invalid;
|
||||||
button.GetChild<Button>("Button").OnPressed -= RemoveFromInventory;
|
var theButton = button.GetChild<Button>("Button");
|
||||||
button.GetChild<Button>("Button").OnPressed += AddToInventory;
|
theButton.OnPressed -= RemoveFromInventory;
|
||||||
|
theButton.OnPressed += AddToInventory;
|
||||||
|
theButton.Text = SlotNames[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveFromInventory(BaseButton.ButtonEventArgs args)
|
private void RemoveFromInventory(BaseButton.ButtonEventArgs args)
|
||||||
|
|||||||
Reference in New Issue
Block a user