amélioration de l'UI de l'inventaire et ajout de la récompense d'amélioration de taille d'inventaire #52

This commit is contained in:
2025-09-19 17:31:12 +02:00
parent 00c7e9bc4c
commit bcd8038b3a
19 changed files with 329 additions and 104 deletions

View File

@@ -0,0 +1,50 @@
extends Control
class_name InventoryGuiItem
@export var no_item_texture_path : Texture2D
const MODULATE_INSPECTED_COLOR = Color.GRAY
var current_item : Item = null
var was_selected : bool = false
func _ready():
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_excited)
update(null, false)
func inspect(is_inspected : bool = true):
modulate = MODULATE_INSPECTED_COLOR if is_inspected else Color.WHITE
func _on_mouse_entered():
if current_item:
Pointer.inspect(self, inspector_info())
func _on_mouse_excited():
if current_item:
Pointer.stop_inspect(self)
func inspector_info() -> Inspector.Info:
return Inspector.Info.new(
current_item.name,
current_item.description,
current_item.icon
)
func update(item: Item, selected : bool):
if selected and not was_selected:
%SelectedAnimation.play("selected")
elif not selected and was_selected:
%SelectedAnimation.play_backwards("selected")
if item != current_item:
%SquishAnimation.play("squish")
print("squish")
if item and item.icon:
%TextureRect.texture = item.icon
%TextureRect.visible = item != null
%NoItemTextureRect.visible = item == null
current_item = item
was_selected = selected

View File

@@ -0,0 +1 @@
uid://c8qfny4dlg7ql