Throw item
This commit is contained in:
@@ -237,6 +237,9 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
{
|
||||
foreach (var item in ItemSlots)
|
||||
ItemsPage.RemoveChildEx(item);
|
||||
|
||||
ItemDescriptionTitle.Text = string.Empty;
|
||||
ItemEffectLabel.Text = string.Empty;
|
||||
}
|
||||
|
||||
private void PopulatePlayerInfo()
|
||||
@@ -408,23 +411,22 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
|
||||
if (currentItem is IThrowableItem throwable)
|
||||
{
|
||||
throwable.Throw();
|
||||
Game.ThrowItem(currentItem);
|
||||
GameRepo.PlayerData.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
|
||||
EmitSignal(SignalName.ClosedMenu);
|
||||
}
|
||||
EmitSignal(SignalName.ClosedMenu);
|
||||
}
|
||||
|
||||
private async void DropButtonPressed()
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
Game.DropItem(currentItem);
|
||||
GameRepo.PlayerData.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
|
||||
Reference in New Issue
Block a user