From 28f38d236ebf3ec6c08431ec76be5367b4e50d4d Mon Sep 17 00:00:00 2001 From: Zenny Date: Mon, 2 Mar 2026 10:33:58 -0800 Subject: [PATCH] Show inventory alert when equipping/unequipping/augmenting items --- .../enemy_types/01. sproingy/Sproingy.tscn | 3 +-- Zennysoft.Game.Ma/src/game/Game.cs | 3 ++- Zennysoft.Game.Ma/src/game/IGame.cs | 2 ++ Zennysoft.Game.Ma/src/player/Player.cs | 4 ++++ .../src/ui/inventory_menu/InventoryMenu.tscn | 20 ++++++++++++++++--- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Zennysoft.Game.Ma/src/enemy/enemy_types/01. sproingy/Sproingy.tscn b/Zennysoft.Game.Ma/src/enemy/enemy_types/01. sproingy/Sproingy.tscn index 42f659135..53834a3a7 100644 --- a/Zennysoft.Game.Ma/src/enemy/enemy_types/01. sproingy/Sproingy.tscn +++ b/Zennysoft.Game.Ma/src/enemy/enemy_types/01. sproingy/Sproingy.tscn @@ -100,8 +100,7 @@ _followSpeed = 150.0 [node name="EngagePlayerBehavior" parent="Components" instance=ExtResource("5_drfkj")] unique_name_in_owner = true -_minimumAttackTime = 1.0 -_maximumAttackTime = 3.0 +_maximumAttackTime = 4.0 _acquireTargetTime = 2.0 [node name="NavigationAgent" type="NavigationAgent3D" parent="Components"] diff --git a/Zennysoft.Game.Ma/src/game/Game.cs b/Zennysoft.Game.Ma/src/game/Game.cs index d1a853fd0..9d0a4e3bb 100644 --- a/Zennysoft.Game.Ma/src/game/Game.cs +++ b/Zennysoft.Game.Ma/src/game/Game.cs @@ -13,7 +13,6 @@ using System.Threading.Tasks; using Zennysoft.Game.Implementation; using Zennysoft.Ma.Adapter.Entity; using System.Linq; -using Chickensoft.Collections; [Meta(typeof(IAutoNode))] public partial class Game : Node3D, IGame @@ -810,6 +809,8 @@ public partial class Game : Node3D, IGame _player.Activate(); } + public void NotifyInventory(string message) => InventoryEventNotification?.Invoke(message); + private void OnQuit() => GameExitRequested?.Invoke(); public void OnExitTree() diff --git a/Zennysoft.Game.Ma/src/game/IGame.cs b/Zennysoft.Game.Ma/src/game/IGame.cs index 560c36cf6..f57ffbe31 100644 --- a/Zennysoft.Game.Ma/src/game/IGame.cs +++ b/Zennysoft.Game.Ma/src/game/IGame.cs @@ -37,6 +37,8 @@ public interface IGame : IProvide, IProvide, IProvide public void DoubleExp(); + public void NotifyInventory(string message); + public ItemRescueMenu ItemRescueMenu { get; } public QuestData QuestData { get; } diff --git a/Zennysoft.Game.Ma/src/player/Player.cs b/Zennysoft.Game.Ma/src/player/Player.cs index 6928ca704..af861c6b7 100644 --- a/Zennysoft.Game.Ma/src/player/Player.cs +++ b/Zennysoft.Game.Ma/src/player/Player.cs @@ -361,6 +361,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value + 0.2f); } + _game.NotifyInventory($"{equipable.ItemName} equipped."); } public void Unequip(IEquipableItem equipable) @@ -384,6 +385,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide if (accessory.AccessoryTag == AccessoryTag.BoostEXPGainRate) ExperiencePointsComponent.ModifyExpGainRate(ExperiencePointsComponent.ExpGainRate.Value - 0.2f); } + _game.NotifyInventory($"{equipable.ItemName} unequipped."); } public void ApplyNewAugment(IAugmentItem jewel, IAugmentableItem augmentableItem) @@ -394,6 +396,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide if (augmentableItem.Augment != null && augmentableItem is IEquipableItem equipable && EquipmentComponent.IsItemEquipped(equipable)) augmentableItem.Augment.AugmentType.Apply(); + + _game.NotifyInventory($"{((IBaseInventoryItem)augmentableItem).ItemName} augmented with {jewel.ItemName}."); } private void ApplyNewAugment(Weapon weapon, Jewel jewel) diff --git a/Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn b/Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn index 2651629b2..377b19136 100644 --- a/Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn +++ b/Zennysoft.Game.Ma/src/ui/inventory_menu/InventoryMenu.tscn @@ -450,20 +450,34 @@ focus_mode = 2 layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxFlat_cq2sk") -[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer"] +[node name="MarginContainer2" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/ItemActionResultPanel"] layout_mode = 2 +offset_right = 574.0 +offset_bottom = 250.0 theme_override_constants/margin_left = 5 theme_override_constants/margin_top = 5 theme_override_constants/margin_right = 5 theme_override_constants/margin_bottom = 5 -[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/MarginContainer"] +[node name="ReferenceRect" type="ReferenceRect" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/ItemActionResultPanel/MarginContainer2"] layout_mode = 2 border_color = Color(1, 1, 1, 1) border_width = 2.0 editor_only = false -[node name="ItemActionResultLabel" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/MarginContainer"] +[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/ItemActionResultPanel"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 20 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="ItemActionResultLabel" type="Label" parent="Panel/MarginContainer/PanelContainer/MenuPanel/ItemActionResultContainer/ItemActionResultPanel/MarginContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(275, 125) layout_mode = 2