cleaned Inventory ui
This commit is contained in:
@@ -6,6 +6,7 @@ namespace Babushka.scripts.CSharp.Common.Inventory;
|
||||
public partial class InventoryUi : Control
|
||||
{
|
||||
private GridContainer _slots;
|
||||
private Control _slotsMover;
|
||||
private InventoryInstance _playerInventory;
|
||||
private Control _slotSelect;
|
||||
|
||||
@@ -16,10 +17,17 @@ public partial class InventoryUi : Control
|
||||
private bool _inventoryExtended = false;
|
||||
private Tween? _inventoryExtensionTween;
|
||||
|
||||
[Export]
|
||||
private float _inventoryClosedOffset = 0f;
|
||||
|
||||
[Export]
|
||||
private float _inventoryOpenedOffset = 200f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GD.Print("Ready inventory ui");
|
||||
_slots = GetNode<GridContainer>("SlotsContainer/Slots");
|
||||
_slots = GetNode<GridContainer>("SlotsContainer/SlotsMover/Slots");
|
||||
_slotsMover = GetNode<Control>("SlotsContainer/SlotsMover");
|
||||
_playerInventory = InventoryManager.Instance.playerInventory;
|
||||
_slotSelect = GetNode<Control>("SlotsContainer/SlotSelectContainer/Selector");
|
||||
PopulateSlots();
|
||||
@@ -134,7 +142,7 @@ public partial class InventoryUi : Control
|
||||
_inventoryExtensionTween = GetTree().CreateTween();
|
||||
_slotSelect.Hide();
|
||||
_inventoryExtensionTween
|
||||
.TweenProperty(_slots, "offset_bottom", -100, 0.4)
|
||||
.TweenProperty(_slotsMover, "offset_bottom", _inventoryOpenedOffset, 0.4)
|
||||
.SetTrans(Tween.TransitionType.Quad)
|
||||
.SetEase(Tween.EaseType.Out);
|
||||
}
|
||||
@@ -144,7 +152,7 @@ public partial class InventoryUi : Control
|
||||
_inventoryExtensionTween = GetTree().CreateTween();
|
||||
_slotSelect.Show();
|
||||
_inventoryExtensionTween
|
||||
.TweenProperty(_slots, "offset_bottom", 200, 0.4)
|
||||
.TweenProperty(_slotsMover, "offset_bottom", _inventoryClosedOffset, 0.4)
|
||||
.SetTrans(Tween.TransitionType.Quad)
|
||||
.SetEase(Tween.EaseType.Out);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user