Make character inventory slightly nicer.

This commit is contained in:
Pieter-Jan Briers 2018-09-19 19:06:30 +02:00
parent 74541e23a4
commit 2b026daf67
1 changed files with 10 additions and 5 deletions

View File

@ -225,7 +225,8 @@ namespace Content.Client.GameObjects
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);
@ -240,8 +241,10 @@ namespace Content.Client.GameObjects
var button = InventorySlots[slot];
button.EntityUid = entity.Uid;
button.GetChild<Button>("Button").OnPressed += RemoveFromInventory;
button.GetChild<Button>("Button").OnPressed -= AddToInventory;
var theButton = button.GetChild<Button>("Button");
theButton.OnPressed += RemoveFromInventory;
theButton.OnPressed -= AddToInventory;
theButton.Text = "";
//Gets entity sprite and assigns it to button texture
if (entity.TryGetComponent(out ISpriteComponent sprite))
@ -273,8 +276,10 @@ namespace Content.Client.GameObjects
var button = InventorySlots[slot];
button.GetChild<SpriteView>("SpriteView").Sprite = null;
button.EntityUid = EntityUid.Invalid;
button.GetChild<Button>("Button").OnPressed -= RemoveFromInventory;
button.GetChild<Button>("Button").OnPressed += AddToInventory;
var theButton = button.GetChild<Button>("Button");
theButton.OnPressed -= RemoveFromInventory;
theButton.OnPressed += AddToInventory;
theButton.Text = SlotNames[slot];
}
private void RemoveFromInventory(BaseButton.ButtonEventArgs args)