laptop
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c63uufq63qpuy"
|
||||
path.bptc="res://.godot/imported/Rondo.png-57553b850a093da6dba43a1e1947fcce.bptc.ctex"
|
||||
path.bptc="res://.godot/imported/RONDO.PNG-77b50e9afaf9eb46f5672e079a5f50bf.bptc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
@@ -11,8 +11,8 @@ metadata={
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/items/weapons/textures/Rondo.png"
|
||||
dest_files=["res://.godot/imported/Rondo.png-57553b850a093da6dba43a1e1947fcce.bptc.ctex"]
|
||||
source_file="res://src/items/weapons/textures/RONDO.PNG"
|
||||
dest_files=["res://.godot/imported/RONDO.PNG-77b50e9afaf9eb46f5672e079a5f50bf.bptc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Game.Ma;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
@@ -13,6 +14,8 @@ public partial class ActionPanel : Panel
|
||||
|
||||
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
|
||||
|
||||
[Dependency] private IGame _game => this.DependOn<IGame>();
|
||||
|
||||
[Node] public Button InteractButton { get; set; }
|
||||
|
||||
[Node] public Button ThrowButton { get; set; }
|
||||
@@ -21,6 +24,8 @@ public partial class ActionPanel : Panel
|
||||
|
||||
public event Action ActionPanelClosing;
|
||||
|
||||
public event Action ReturnToGameAction;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
InteractButton.Pressed += InteractButton_Pressed;
|
||||
@@ -49,12 +54,16 @@ public partial class ActionPanel : Panel
|
||||
|
||||
private void ThrowButton_Pressed()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
_game.ThrowItem(_currentlySelected);
|
||||
_currentlySelected = null;
|
||||
ActionPanelClosing?.Invoke();
|
||||
}
|
||||
|
||||
private void DropButton_Pressed()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
_game.DropItem(_currentlySelected);
|
||||
_currentlySelected = null;
|
||||
ActionPanelClosing?.Invoke();
|
||||
}
|
||||
|
||||
private void SetOptions(IBaseInventoryItem item)
|
||||
@@ -93,4 +102,9 @@ public partial class ActionPanel : Panel
|
||||
SfxDatabase.Instance.Play(SoundEffect.Equip);
|
||||
}
|
||||
}
|
||||
|
||||
private void PerformAction(IBaseInventoryItem item)
|
||||
{
|
||||
_game.UseItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
private List<IItemSlot> ItemSlots;
|
||||
|
||||
private IItemSlot _currentlySelected;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
ItemSlots = [.. Inventory.GetChildren().OfType<IItemSlot>()];
|
||||
@@ -36,6 +38,15 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
ItemSlots.ForEach(x => x.ItemSelected += ItemSelected);
|
||||
VisibilityChanged += ResetInventoryState;
|
||||
ActionPanel.ActionPanelClosing += ActionPanel_ActionPanelClosing;
|
||||
ActionPanel.ReturnToGameAction += ActionPanel_ReturnToGameAction;
|
||||
ItemName.Text = string.Empty;
|
||||
ItemFlavor.Text = string.Empty;
|
||||
ItemStats.Text = string.Empty;
|
||||
}
|
||||
|
||||
private void ActionPanel_ReturnToGameAction()
|
||||
{
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private void ItemPressed(IItemSlot selectedItem)
|
||||
@@ -46,6 +57,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
private void ItemSelected(IItemSlot selectedItem)
|
||||
{
|
||||
_currentlySelected = selectedItem;
|
||||
ItemName.Text = selectedItem.Item.Value.ItemName;
|
||||
ItemFlavor.Text = selectedItem.Item.Value.Description;
|
||||
}
|
||||
@@ -58,8 +70,11 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
for (var i = 0; i < inventory.Count; i++)
|
||||
ItemSlots[i].SetItemToSlot(inventory[i]);
|
||||
|
||||
if (_currentlySelected == null && inventory.Any())
|
||||
_currentlySelected = ItemSlots.First();
|
||||
if (inventory.Any())
|
||||
ItemSlots.First().FocusItem();
|
||||
_currentlySelected.FocusItem();
|
||||
ActionPanel.Hide();
|
||||
}
|
||||
|
||||
private void ActionPanel_ActionPanelClosing()
|
||||
@@ -68,14 +83,6 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
ResetInventoryState();
|
||||
}
|
||||
|
||||
private void Slot_FocusEntered(IItemSlot slot)
|
||||
{
|
||||
var item = slot.Item.Value;
|
||||
ItemName.Text = item.ItemName;
|
||||
ItemFlavor.Text = item.Description;
|
||||
}
|
||||
|
||||
|
||||
private void InteractButton_Pressed()
|
||||
{
|
||||
//if (_currentlySelected != null)
|
||||
|
||||
@@ -45,6 +45,7 @@ outline_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="InventoryMenu" type="PanelContainer"]
|
||||
process_mode = 2
|
||||
visible = false
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
@@ -37,6 +37,7 @@ public partial class ItemSlot : Control, IItemSlot
|
||||
{
|
||||
Item.Changed += Item_Changed;
|
||||
ItemName.Pressed += ItemSlot_Pressed;
|
||||
ItemName.FocusEntered += FocusItem;
|
||||
}
|
||||
|
||||
public void SetItemToSlot(IBaseInventoryItem item)
|
||||
|
||||
Reference in New Issue
Block a user