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

@@ -4,29 +4,13 @@ class_name GameGui
signal pause_asked
func _ready():
Pointer.connect("inspected_entity_changed", _on_inspected_entity_changed)
Pointer.connect("inspected_changed", _on_inspected_changed)
func _on_player_updated(player:Player):
%EnergyCount.text = str(player.energy) + "/" + str(player.max_energy)
%EnergyInfo.modulate = Color.WHITE if player.energy > 0 else Color.RED
for i in player.inventory.max_items:
var item : Item = player.inventory.get_item(i)
if item:
if %Inventory.get_child_count() <= i:
var texture_rect = TextureRect.new()
texture_rect.expand_mode = TextureRect.EXPAND_FIT_WIDTH_PROPORTIONAL
%Inventory.add_child(texture_rect)
%Inventory.get_child(i).texture = item.icon
%Inventory.get_child(i).visible = true
if i == player.inventory.current_item_ind:
%Inventory.get_child(i).modulate = Color.WHITE
else:
%Inventory.get_child(i).modulate = Color.DARK_GRAY
else:
if %Inventory.get_child_count() > i:
%Inventory.get_child(i).visible = false
%Inventory.update(player.inventory)
update_no_energy_left_info(player.energy)
@@ -59,10 +43,7 @@ func _on_planet_pass_day_started(planet):
await $PassDayAnimation.animation_finished
$PassDayAnimation.speed_scale = 1
func _on_inspected_entity_changed(e : InspectableEntity):
var info : Inspector.Info = null
if e:
info = e.inspector_info()
func _on_inspected_changed(info : Inspector.Info):
%Inspector.info = info
func update_no_energy_left_info(energy):