#13 suite du developpement d'inventaire avec le rajout des ItemObjects, description sur le GUI, items d'exemple et corrections mineures

This commit was merged in pull request #35.
This commit is contained in:
2025-08-18 16:05:37 +02:00
parent d2742231e6
commit a91ca5f7f1
43 changed files with 755 additions and 90 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c2pgaklnj5w3d"
path="res://.godot/imported/Tablette info.png-0d02a3ea4c574d196b3e778477072d61.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gui/assets/texture/Tablette info.png"
dest_files=["res://.godot/imported/Tablette info.png-0d02a3ea4c574d196b3e778477072d61.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,12 +1,4 @@
extends Control
func _on_root_gui_player_updated(player: Player):
func player_update(player: Player):
$EnergyInfo/Label.text = str(player.energy)
var children = $Inventory.get_children()
for child in children:
child.free()
for item in player.inventory.items:
var item_rect = TextureRect.new()
item_rect.texture = item.icon
$Inventory.add_child(item_rect)

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://qx75h1k3wmm1"
path="res://.godot/imported/Tablette info.png-e89cd3fdb4a303341f3bbad730de279c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gui/ressources/Tablette info.png"
dest_files=["res://.godot/imported/Tablette info.png-e89cd3fdb4a303341f3bbad730de279c.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,6 +1,6 @@
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://dqwayi8yjwau2"]
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="1_w0wva"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_w0wva"]
[resource]
font = ExtResource("1_w0wva")

View File

@@ -1,6 +1,6 @@
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bgcmd213j6gk1"]
[ext_resource type="FontFile" uid="uid://byyfovm1ha5ya" path="res://gui/ressources/fonts/AtomicMd-3zXDZ.ttf" id="1_hv6r3"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_hv6r3"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hv6r3"]
bg_color = Color(0.976471, 0.741176, 0.4, 1)
@@ -44,7 +44,8 @@ Button/fonts/font = ExtResource("1_hv6r3")
Button/styles/hover = SubResource("StyleBoxFlat_hv6r3")
Button/styles/normal = SubResource("StyleBoxFlat_y48f0")
Button/styles/pressed = SubResource("StyleBoxFlat_st1o2")
MarginContainer/constants/margin_bottom = 10
MarginContainer/constants/margin_left = 10
MarginContainer/constants/margin_right = 10
MarginContainer/constants/margin_top = 10
HBoxContainer/constants/separation = 15
MarginContainer/constants/margin_bottom = 15
MarginContainer/constants/margin_left = 15
MarginContainer/constants/margin_right = 15
MarginContainer/constants/margin_top = 15

Binary file not shown.

View File

@@ -0,0 +1,35 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://c8xf3tfnpufk3"
path="res://.godot/imported/spincycle_3d_ot.otf-f71d33fbaded9da2ba85d0eb20bfd1e1.fontdata"
[deps]
source_file="res://gui/ressources/fonts/spincycle_3d_ot.otf"
dest_files=["res://.godot/imported/spincycle_3d_ot.otf-f71d33fbaded9da2ba85d0eb20bfd1e1.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

View File

@@ -0,0 +1,35 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://cpnsnrqhfkj3k"
path="res://.godot/imported/spincycle_ot.otf-be21809daa8fde21c00f1cf664ce2342.fontdata"
[deps]
source_file="res://gui/ressources/fonts/spincycle_ot.otf"
dest_files=["res://.godot/imported/spincycle_ot.otf-be21809daa8fde21c00f1cf664ce2342.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View File

@@ -1,25 +1,17 @@
[gd_scene load_steps=10 format=3 uid="uid://12nak7amd1uq"]
[gd_scene load_steps=14 format=3 uid="uid://12nak7amd1uq"]
[ext_resource type="PackedScene" uid="uid://baqrmhsgqda6v" path="res://gui/player_info/player_info.tscn" id="1_8kw6x"]
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/scripts/root_gui.gd" id="1_udau0"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://gui/player_info/assets/icons/bolt.svg" id="4_k4juk"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/default_label_settings.tres" id="4_ujg5r"]
[ext_resource type="Texture2D" uid="uid://c2pgaklnj5w3d" path="res://gui/assets/texture/Tablette info.png" id="6_fovlv"]
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/inventory/assets/icons/shovel.svg" id="7_n4kem"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="8_n4kem"]
[sub_resource type="Animation" id="Animation_k4juk"]
resource_name = "recharge_fade_in"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("RechargeFade:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
}
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
font = ExtResource("8_n4kem")
font_size = 20
[sub_resource type="Animation" id="Animation_iyvkh"]
length = 0.001
@@ -35,6 +27,45 @@ tracks/0/keys = {
"update": 0,
"values": [Color(0, 0, 0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RechargeFade:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_k4juk"]
resource_name = "recharge_fade_in"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("RechargeFade:color")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0, 0, 0, 0), Color(0, 0, 0, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RechargeFade:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_fovlv"]
resource_name = "recharge_fade_out"
@@ -50,6 +81,18 @@ tracks/0/keys = {
"update": 0,
"values": [Color(0, 0, 0, 1), Color(0, 0, 0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RechargeFade:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n4kem"]
_data = {
@@ -106,15 +149,95 @@ size_flags_horizontal = 8
size_flags_vertical = 0
label_settings = ExtResource("4_ujg5r")
[node name="RechargeFade" type="ColorRect" parent="."]
physics_interpolation_mode = 0
[node name="ItemInfo" type="TextureRect" parent="MarginContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 300)
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 8
theme = ExtResource("2_nq5i2")
texture = ExtResource("6_fovlv")
expand_mode = 3
stretch_mode = 4
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/ItemInfo"]
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 = 35
theme_override_constants/margin_top = 35
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 75
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ItemInfo/MarginContainer"]
layout_mode = 2
theme = ExtResource("2_nq5i2")
[node name="ItemIcon" type="TextureRect" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
texture = ExtResource("7_n4kem")
stretch_mode = 3
[node name="ItemName" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "fdqsd"
label_settings = SubResource("LabelSettings_ek73b")
horizontal_alignment = 1
[node name="ItemDesc" type="Label" parent="MarginContainer/ItemInfo/MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
text = "Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. Ceci est une pelle qui sert exclusivement à faire des choses intéressantes. "
autowrap_mode = 3
clip_text = true
[node name="AvailableActions" type="HBoxContainer" parent="MarginContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
theme = ExtResource("2_nq5i2")
[node name="GetItem" type="Label" parent="MarginContainer/AvailableActions"]
visible = false
layout_mode = 2
text = "E - Take Item"
label_settings = ExtResource("4_ujg5r")
[node name="SwapItem" type="Label" parent="MarginContainer/AvailableActions"]
visible = false
layout_mode = 2
text = "E - Swap Item"
label_settings = ExtResource("4_ujg5r")
[node name="DropItem" type="Label" parent="MarginContainer/AvailableActions"]
visible = false
layout_mode = 2
text = "w - Drop Item"
label_settings = ExtResource("4_ujg5r")
[node name="UseItem" type="Label" parent="MarginContainer/AvailableActions"]
visible = false
layout_mode = 2
text = "space/click - Use Item"
label_settings = ExtResource("4_ujg5r")
[node name="RechargeFade" type="ColorRect" parent="."]
physics_interpolation_mode = 0
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0, 0, 0, 0)
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
@@ -122,6 +245,10 @@ libraries = {
&"": SubResource("AnimationLibrary_n4kem")
}
[connection signal="player_stats_updated" from="." to="MarginContainer/PlayerInfo" method="_on_root_gui_player_stats_updated"]
[node name="GridContainer" type="GridContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[connection signal="button_down" from="GameAction" to="." method="_on_game_action_button_down"]
[connection signal="pressed" from="MarginContainer/DayPass" to="." method="_on_day_pass_pressed"]

View File

@@ -1,15 +1,24 @@
extends Control
class_name RootGui
signal player_stats_updated(player : Player)
signal game_click
signal day_pass_pressed
signal day_pass_proceed
signal day_pass_finished
func _on_player_player_stats_updated(player:Player):
emit_signal("player_stats_updated", player)
func _on_player_updated(player:Player):
$MarginContainer/PlayerInfo.player_update(player)
%AvailableActions/GetItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() == 0
%AvailableActions/SwapItem.visible = player.closest_interactable is ItemObject and player.inventory.lenght() > 0
%AvailableActions/DropItem.visible = player.inventory.lenght() > 0
%ItemInfo.visible = player.inventory.lenght() > 0
if player.inventory.lenght() > 0:
var item : Item = player.inventory.get_item()
%ItemIcon.texture = item.icon
%ItemName.text = item.name
%ItemDesc.text = item.description
func _on_planet_planet_stats_updated(day:int):
$MarginContainer/DayCount.text = "Day " + str(day)