refonte de l'inventaire en 3D et nettoyage des prints

This commit is contained in:
2026-02-23 00:07:04 +01:00
parent 925bf4465c
commit fa21b3a558
41 changed files with 472 additions and 611 deletions

View File

@@ -185,10 +185,9 @@ text = "9 charges left"
label_settings = ExtResource("6_h6540")
horizontal_alignment = 1
[node name="Inventory" parent="MarginContainer" unique_id=1407862321 instance=ExtResource("9_id0t5")]
unique_name_in_owner = true
[node name="Inventory" parent="MarginContainer" unique_id=1178590658 instance=ExtResource("9_id0t5")]
layout_mode = 2
size_flags_horizontal = 4
size_flags_horizontal = 1
size_flags_vertical = 8
[node name="GiveUpButton" type="Button" parent="MarginContainer" unique_id=1128310884]

View File

@@ -1,57 +0,0 @@
[gd_scene load_steps=7 format=3 uid="uid://dinju2m0oja38"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_1ddv5"]
[ext_resource type="Script" uid="uid://ymn5layeoat8" path="res://gui/game/inspector/framed_info/scripts/framed_info.gd" id="1_7tmbd"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_7tmbd"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_1ddv5"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7tmbd"]
bg_color = Color(1, 1, 1, 0.78431374)
[sub_resource type="LabelSettings" id="LabelSettings_1ddv5"]
font = ExtResource("3_1ddv5")
font_size = 18
[node name="FramedInfo" type="PanelContainer"]
self_modulate = Color(0.043137256, 0.07450981, 0.14901961, 1)
offset_right = 275.0
offset_bottom = 94.0
size_flags_horizontal = 3
size_flags_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_7tmbd")
script = ExtResource("1_7tmbd")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme = ExtResource("1_1ddv5")
[node name="HFlowContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/HFlowContainer"]
layout_mode = 2
theme_override_constants/separation = 10
[node name="Icon" type="TextureRect" parent="MarginContainer/HFlowContainer/HBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(20, 20)
layout_mode = 2
texture = ExtResource("2_7tmbd")
expand_mode = 1
stretch_mode = 5
[node name="Title" type="Label" parent="MarginContainer/HFlowContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "On mature"
label_settings = SubResource("LabelSettings_1ddv5")
[node name="Desc" type="RichTextLabel" parent="MarginContainer/HFlowContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_1ddv5")
bbcode_enabled = true
text = "On mature, do this and that and do this and that and do this and that"
fit_content = true

View File

@@ -1,10 +0,0 @@
extends PanelContainer
var framed_info :Inspector.FramedInfo = null : set = update_framed_info
func update_framed_info(f: Inspector.FramedInfo):
framed_info = f
%Icon.texture = f.icon
%Title.text = f.title
%Desc.text = f.description
self_modulate = f.bg_color

View File

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

View File

@@ -1,71 +0,0 @@
[gd_scene load_steps=9 format=3 uid="uid://d3lff5fui1k0c"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_f5bv4"]
[ext_resource type="Texture2D" uid="uid://lpik6kwqgmjx" path="res://gui/game/assets/texture/tablette_resized.png" id="1_qfinp"]
[ext_resource type="Script" uid="uid://b36bjfq4sng36" path="res://gui/game/inspector/scripts/inspector.gd" id="3_a8c2j"]
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_qfinp"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="4_yijvw"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_yijvw"]
texture = ExtResource("1_qfinp")
texture_margin_left = 30.0
texture_margin_top = 10.0
texture_margin_right = 30.0
texture_margin_bottom = 50.0
region_rect = Rect2(18, 31, 240, 334)
[sub_resource type="AtlasTexture" id="AtlasTexture_ek73b"]
atlas = ExtResource("3_qfinp")
region = Rect2(76, 75, 124, 135)
[sub_resource type="LabelSettings" id="LabelSettings_ek73b"]
font = ExtResource("4_yijvw")
font_size = 20
[node name="Inspector" type="PanelContainer"]
offset_right = 276.0
offset_bottom = 235.0
size_flags_horizontal = 0
size_flags_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxTexture_yijvw")
script = ExtResource("3_a8c2j")
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 2
size_flags_vertical = 0
theme = ExtResource("1_f5bv4")
[node name="Texture" type="TextureRect" parent="VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
size_flags_horizontal = 3
texture = SubResource("AtlasTexture_ek73b")
expand_mode = 1
stretch_mode = 5
[node name="Title" type="Label" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "fdqsd dqsdq dsqdqsd"
label_settings = SubResource("LabelSettings_ek73b")
horizontal_alignment = 1
autowrap_mode = 2
[node name="StatInfos" type="HFlowContainer" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/h_separation = 8
theme_override_constants/v_separation = 8
alignment = 1
[node name="Desc" type="RichTextLabel" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
bbcode_enabled = true
text = "Very interesting description that can be very long, like 2 or 3 lines long."
fit_content = true
[node name="FramedInfos" type="VBoxContainer" parent="VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2

View File

@@ -1,99 +0,0 @@
extends Control
class_name Inspector
const FRAMED_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/framed_info/framed_info.tscn")
const STAT_INFO_SCENE : PackedScene = preload("res://gui/game/inspector/stat_info/stat_info.tscn")
var info : Info = null :
set(i):
info = i
update_info(i)
func _ready():
update_info(info)
Pointer.connect("inspected_changed", _on_inspected_changed)
func _on_inspected_changed(i : Inspector.Info):
info = i
func update_info(i : Info):
if i == null:
visible = false
else :
visible = true
if i.texture:
%Texture.texture = i.texture
%Texture.visible = i.texture != null
%Title.text = i.title
%Desc.text = i.description
%Desc.visible = i.description != ""
update_framed_infos(info.framed_infos)
update_stat_info(info.stat_infos)
func update_framed_infos(framed_infos : Array[FramedInfo]):
for c in %FramedInfos.get_children() :
c.queue_free()
for i in range(len(framed_infos)):
var frame_info_object = FRAMED_INFO_SCENE.instantiate()
%FramedInfos.add_child(frame_info_object)
frame_info_object.framed_info = framed_infos[i]
func update_stat_info(stat_infos):
%StatInfos.visible = len(stat_infos) != 0
for c in %StatInfos.get_children() :
c.queue_free()
for i in range(len(stat_infos)):
var stat_inof_object = STAT_INFO_SCENE.instantiate()
%StatInfos.add_child(stat_inof_object)
stat_inof_object.stat_info = stat_infos[i]
class Info:
var title : String = ""
var texture: Texture = null
var description : String = ""
var framed_infos : Array[Inspector.FramedInfo] = []
var stat_infos = []
func _init(
_title : String = "",
_description : String = "",
_texture : Texture = null,
):
title = _title
description = _description
texture = _texture
func add_framed_info(framed_info : Inspector.FramedInfo):
framed_infos.push_front(framed_info)
func add_stat_info(s_info : Inspector.StatInfo):
stat_infos.push_front(s_info)
class FramedInfo:
var title : String
var icon: Texture
var description : String
var bg_color : Color
func _init(
_title : String = "",
_desc : String = "",
_icon : Texture = null,
_bg_color : Color = Color("0B1326")
):
title = _title
description = _desc
icon = _icon
bg_color = _bg_color
class StatInfo:
var text : String
var icon: Texture
func _init(
_text : String = "",
_icon : Texture = null,
):
text = _text
icon = _icon

View File

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

View File

@@ -1,9 +0,0 @@
extends HBoxContainer
var stat_info : Inspector.StatInfo = null : set = update_stat_info
func update_stat_info(s_info : Inspector.StatInfo):
stat_info = s_info
%Icon.texture = stat_info.icon
%Text.text = str(stat_info.text)

View File

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

View File

@@ -1,28 +0,0 @@
[gd_scene load_steps=4 format=3 uid="uid://djihfgtjuhqwy"]
[ext_resource type="Script" uid="uid://yghu53hja4xj" path="res://gui/game/inspector/stat_info/scripts/stat_info.gd" id="1_4pua2"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="2_pdlch"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="3_pdlch"]
[node name="StatInfo" type="HBoxContainer"]
theme_override_constants/separation = 4
alignment = 1
script = ExtResource("1_4pua2")
[node name="Icon" type="TextureRect" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(20, 20)
layout_mode = 2
texture = ExtResource("2_pdlch")
expand_mode = 1
stretch_mode = 5
[node name="Text" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("3_pdlch")
bbcode_enabled = true
text = "6"
fit_content = true
scroll_active = false
autowrap_mode = 0

View File

@@ -37,7 +37,15 @@ import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://common/assets/materials/default_3d.tres",
"use_external/path": "uid://dvvi1k5c5iowc"
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,68 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://yqq3unuxmtdl"
path="res://.godot/imported/item_separator.blend-cac4afe123af52ae1e1aa2d79bf56691.scn"
[deps]
source_file="res://gui/game/inventory_gui/assets/3d/item_separator.blend"
dest_files=["res://.godot/imported/item_separator.blend-cac4afe123af52ae1e1aa2d79bf56691.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://common/assets/materials/default_3d.tres",
"use_external/path": "uid://dvvi1k5c5iowc"
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2

Binary file not shown.

View File

@@ -0,0 +1,17 @@
[gd_scene format=3 uid="uid://crbjmwumboelw"]
[ext_resource type="Script" uid="uid://c66acjl2dhd7x" path="res://gui/game/inventory_gui/scripts/inventory_3d.gd" id="1_k2pqu"]
[ext_resource type="PackedScene" uid="uid://4r2ab6foer05" path="res://gui/game/inventory_gui/inventory_item/inventory_item_3d.tscn" id="2_1jdtu"]
[ext_resource type="PackedScene" uid="uid://yqq3unuxmtdl" path="res://gui/game/inventory_gui/assets/3d/item_separator.blend" id="13_8twi0"]
[node name="Inventory3D" type="Node3D" unique_id=810532522]
script = ExtResource("1_k2pqu")
inventory_item_scene = ExtResource("2_1jdtu")
[node name="Items3D" type="Node3D" parent="." unique_id=893360425]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, 0, 0)
[node name="ItemSeparator" parent="." unique_id=999679207 instance=ExtResource("13_8twi0")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, 0, 0)

View File

@@ -1,19 +1,85 @@
[gd_scene format=3 uid="uid://clicjf8ts51h8"]
[ext_resource type="Script" uid="uid://dplbbs2dlq308" path="res://gui/game/inventory_gui/scripts/inventory_gui.gd" id="1_himlj"]
[ext_resource type="PackedScene" uid="uid://dadihouw8o3jx" path="res://gui/game/inventory_gui/inventory_item/inventory_gui_item.tscn" id="2_0vvyy"]
[ext_resource type="Texture2D" uid="uid://dw80a4c5iekir" path="res://common/icons/bar.png" id="3_hqvrf"]
[ext_resource type="Environment" uid="uid://bxyp24f85p0xf" path="res://gui/game/assets/gui_3d_environment.tres" id="3_g6k02"]
[ext_resource type="Material" uid="uid://cr7bp4fhh1ipr" path="res://entities/player_3d/resources/materials/post_process_quad.tres" id="4_6ahyd"]
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://entities/player/inventory/scripts/item.gd" id="4_tp3yk"]
[ext_resource type="Texture2D" uid="uid://ds4m14vl7he6v" path="res://common/icons/pick.svg" id="5_4v624"]
[ext_resource type="PackedScene" uid="uid://crbjmwumboelw" path="res://gui/game/inventory_gui/inventory_3d.tscn" id="5_hmild"]
[ext_resource type="Texture2D" uid="uid://4mh1w1f4q2sa" path="res://entities/plants/assets/sprites/pili/mature.png" id="6_10rrv"]
[ext_resource type="Script" uid="uid://fnu2d6wna4yc" path="res://entities/player/inventory/scripts/inventory.gd" id="7_upv64"]
[node name="Inventory" type="HBoxContainer" unique_id=1144799110 node_paths=PackedStringArray("bar")]
[sub_resource type="ViewportTexture" id="ViewportTexture_tp3yk"]
viewport_path = NodePath("ViewPortTexture/SubViewport")
[sub_resource type="Resource" id="Resource_13try"]
script = ExtResource("4_tp3yk")
icon = ExtResource("5_4v624")
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
[sub_resource type="Resource" id="Resource_sph21"]
script = ExtResource("4_tp3yk")
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
[sub_resource type="Resource" id="Resource_3d1h6"]
script = ExtResource("4_tp3yk")
icon = ExtResource("6_10rrv")
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
[sub_resource type="Resource" id="Resource_c8v1t"]
script = ExtResource("4_tp3yk")
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
[sub_resource type="Resource" id="Resource_ee31p"]
script = ExtResource("7_upv64")
items = Array[ExtResource("4_tp3yk")]([SubResource("Resource_13try"), SubResource("Resource_sph21"), SubResource("Resource_3d1h6"), SubResource("Resource_c8v1t")])
n_tools = 1
metadata/_custom_type_script = "uid://fnu2d6wna4yc"
[sub_resource type="QuadMesh" id="QuadMesh_tp3yk"]
size = Vector2(2, 2)
[node name="Inventory" type="CenterContainer" unique_id=1041300312]
custom_minimum_size = Vector2(48, 48)
offset_right = 156.0
offset_bottom = 153.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 0
size_flags_vertical = 0
script = ExtResource("1_himlj")
inventory_item_scene = ExtResource("2_0vvyy")
bar = NodePath("Bar")
test_size = 4
test_n_tool = 1
[node name="Bar" type="TextureRect" parent="." unique_id=60027067]
[node name="ViewPortTexture" type="TextureRect" parent="." unique_id=997120459]
layout_mode = 2
texture = ExtResource("3_hqvrf")
texture = SubResource("ViewportTexture_tp3yk")
stretch_mode = 2
[node name="SubViewport" type="SubViewport" parent="ViewPortTexture" unique_id=1891358676]
own_world_3d = true
transparent_bg = true
size = Vector2i(1000, 100)
[node name="WorldEnvironment" type="WorldEnvironment" parent="ViewPortTexture/SubViewport" unique_id=604331804]
environment = ExtResource("3_g6k02")
[node name="Inventory3D" parent="ViewPortTexture/SubViewport" unique_id=810532522 instance=ExtResource("5_hmild")]
test_inventory = SubResource("Resource_ee31p")
[node name="Camera3D" type="Camera3D" parent="ViewPortTexture/SubViewport" unique_id=843201055]
transform = Transform3D(-1, 0, -8.742278e-08, -7.433939e-09, 0.996378, 0.08503435, 8.710613e-08, 0.08503435, -0.996378, 0, 0.109818935, -1.4748735)
current = true
fov = 10.1
[node name="MeshInstance3D" type="MeshInstance3D" parent="ViewPortTexture/SubViewport/Camera3D" unique_id=2129450070]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.057, -0.2)
mesh = SubResource("QuadMesh_tp3yk")
skeleton = NodePath("../..")
surface_material_override/0 = ExtResource("4_6ahyd")
[node name="InventoryMouseDetectors" type="HBoxContainer" parent="." unique_id=876676243]
unique_name_in_owner = true
layout_mode = 2
theme_override_constants/separation = 0

View File

@@ -1,184 +0,0 @@
[gd_scene load_steps=12 format=3 uid="uid://dadihouw8o3jx"]
[ext_resource type="Script" uid="uid://c8qfny4dlg7ql" path="res://gui/game/inventory_gui/inventory_item/scripts/inventory_gui_item.gd" id="2_m0ja8"]
[ext_resource type="Texture2D" uid="uid://bf6nw4onkhavr" path="res://common/icons/shovel.svg" id="2_xs0u7"]
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="3_m0ja8"]
[sub_resource type="Animation" id="Animation_046xr"]
length = 0.001
[sub_resource type="Animation" id="Animation_x2pqk"]
resource_name = "squish"
length = 0.2
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k17ff"]
_data = {
&"RESET": SubResource("Animation_046xr"),
&"squish": SubResource("Animation_x2pqk")
}
[sub_resource type="Animation" id="Animation_k17ff"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BottomSpace:custom_minimum_size")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CenterContainer/ItemTexture:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.033333335),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0.27058825, 0.27058825, 0.27058825, 1), Color(0.27058825, 0.27058825, 0.27058825, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CenterContainer/NoItemTextureRect:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(0.27058825, 0.27058825, 0.27058825, 1)]
}
[sub_resource type="Animation" id="Animation_m0ja8"]
resource_name = "selected"
length = 0.2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BottomSpace:custom_minimum_size")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 15)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CenterContainer/ItemTexture:modulate")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0.27022192, 0.27022192, 0.2702219, 1), Color(1, 1, 1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CenterContainer/NoItemTextureRect:modulate")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(0.27022192, 0.27022192, 0.2702219, 1), Color(1, 1, 1, 1)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2wu2x"]
_data = {
&"RESET": SubResource("Animation_k17ff"),
&"selected": SubResource("Animation_m0ja8")
}
[sub_resource type="Gradient" id="Gradient_fu672"]
interpolation_mode = 1
offsets = PackedFloat32Array(0, 0.44886363)
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_vgckh"]
gradient = SubResource("Gradient_fu672")
fill = 1
fill_from = Vector2(0.48290598, 0.48290598)
[node name="InventoryItem" type="VBoxContainer"]
custom_minimum_size = Vector2(48, 48)
offset_right = 48.0
offset_bottom = 52.0
size_flags_horizontal = 0
size_flags_vertical = 8
script = ExtResource("2_m0ja8")
[node name="SquishAnimation" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_k17ff")
}
[node name="SelectedAnimation" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_2wu2x")
}
[node name="CenterContainer" type="CenterContainer" parent="."]
layout_mode = 2
[node name="NoItemTextureRect" type="TextureRect" parent="CenterContainer"]
unique_name_in_owner = true
visible = false
modulate = Color(0.27058825, 0.27058825, 0.27058825, 1)
custom_minimum_size = Vector2(12, 12)
layout_mode = 2
texture = SubResource("GradientTexture2D_vgckh")
expand_mode = 2
stretch_mode = 5
[node name="ItemTexture" type="TextureRect" parent="CenterContainer"]
unique_name_in_owner = true
modulate = Color(0.27058825, 0.27058825, 0.27058825, 1)
custom_minimum_size = Vector2(48, 48)
layout_mode = 2
texture = ExtResource("2_xs0u7")
expand_mode = 1
stretch_mode = 5
[node name="ParticleTexture" type="TextureRect" parent="CenterContainer/ItemTexture"]
unique_name_in_owner = true
layout_mode = 0
offset_left = 26.0
offset_top = 27.0
offset_right = 48.0
offset_bottom = 49.0
texture = ExtResource("3_m0ja8")
expand_mode = 1
stretch_mode = 4
[node name="ParticleTexture2" type="TextureRect" parent="CenterContainer/ItemTexture"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -22.0
offset_right = 22.0
grow_vertical = 0
texture = ExtResource("3_m0ja8")
expand_mode = 1
stretch_mode = 4
[node name="BottomSpace" type="Control" parent="."]
layout_mode = 2
[connection signal="gui_input" from="." to="." method="_on_gui_input"]

View File

@@ -0,0 +1,80 @@
[gd_scene format=3 uid="uid://4r2ab6foer05"]
[ext_resource type="Script" uid="uid://mrw23oxsai10" path="res://gui/game/inventory_gui/inventory_item/scripts/inventory_item_3d.gd" id="1_nsad1"]
[ext_resource type="PackedScene" uid="uid://oktd71knql00" path="res://gui/game/inventory_gui/assets/3d/item_screen.blend" id="2_1uxm0"]
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="2_hv1tg"]
[ext_resource type="Script" uid="uid://bq7admu4ahs5r" path="res://entities/player/inventory/scripts/item.gd" id="3_ixa47"]
[sub_resource type="Resource" id="Resource_g1uf8"]
script = ExtResource("3_ixa47")
icon = ExtResource("2_hv1tg")
metadata/_custom_type_script = "uid://bq7admu4ahs5r"
[sub_resource type="Gradient" id="Gradient_ixa47"]
offsets = PackedFloat32Array(0, 0.84549356)
colors = PackedColorArray(0.002722778, 0.0025074463, 0.012722934, 1, 0.0627451, 0.05882353, 0.16862746, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_g1uf8"]
gradient = SubResource("Gradient_ixa47")
width = 14
height = 14
fill_from = Vector2(0, 1)
fill_to = Vector2(0, 0)
[sub_resource type="Gradient" id="Gradient_g1uf8"]
colors = PackedColorArray(0.13725491, 0.39215687, 0.6666667, 1, 0.14509805, 0.75686276, 0.2784314, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_jdjjl"]
gradient = SubResource("Gradient_g1uf8")
width = 14
height = 14
fill_from = Vector2(0, 1)
fill_to = Vector2(0, 0)
[sub_resource type="Gradient" id="Gradient_l7avg"]
colors = PackedColorArray(1, 0, 0.43137255, 1, 1, 0.6509804, 0.09019608, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_gj8fm"]
gradient = SubResource("Gradient_l7avg")
width = 14
height = 14
fill_from = Vector2(0, 1)
fill_to = Vector2(0, 0)
[sub_resource type="BoxShape3D" id="BoxShape3D_1uxm0"]
size = Vector3(0.21289063, 0.22167969, 0.2841797)
[node name="InventoryItem3d" type="Node3D" unique_id=797856392]
script = ExtResource("1_nsad1")
item = SubResource("Resource_g1uf8")
[node name="Model" parent="." unique_id=1055300734 instance=ExtResource("2_1uxm0")]
[node name="BlackScreen" type="Sprite3D" parent="." unique_id=1828017914]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.08962244)
texture = SubResource("GradientTexture2D_g1uf8")
[node name="ItemScreen" type="Sprite3D" parent="." unique_id=1128109703]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.08962244)
visible = false
texture = SubResource("GradientTexture2D_jdjjl")
[node name="ToolScreen" type="Sprite3D" parent="." unique_id=1384339729]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.08962244)
visible = false
texture = SubResource("GradientTexture2D_gj8fm")
[node name="ItemIconSprite" type="Sprite3D" parent="." unique_id=1279203709]
unique_name_in_owner = true
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 0, 0.004884802, -0.0937915)
modulate = Color(1, 1, 1, 0.3)
pixel_size = 0.0020833334
texture = ExtResource("2_hv1tg")
[node name="Area3D" type="Area3D" parent="." unique_id=426596211]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" unique_id=2020875183]
shape = SubResource("BoxShape3D_1uxm0")

View File

@@ -1,55 +0,0 @@
extends Control
class_name InventoryGuiItem
@export var no_item_texture_path : Texture2D
signal item_clicked()
const MODULATE_INSPECTED_COLOR = Color.GRAY
var current_item : Item = null
var item : Item = null
var was_selected : bool = false
func _ready():
mouse_entered.connect(
func(): Pointer.inspect(self)
)
mouse_exited.connect(
func(): Pointer.stop_inspect(self)
)
update(null, false)
func inspect(is_inspected : bool = true):
modulate = MODULATE_INSPECTED_COLOR if is_inspected else Color.WHITE
func _on_gui_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("action"):
emit_signal("item_clicked")
func update(_item: Item, selected : bool):
item = _item
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")
if item and item.icon:
%ItemTexture.texture = item.icon
var particles = item.get_particles()
if len(particles) > 0:
%ParticleTexture.texture = particles[0].texture
%ParticleTexture.modulate = particles[0].color
if len(particles) > 1:
%ParticleTexture2.texture = particles[1].texture
%ParticleTexture2.modulate = particles[1].color
%ItemTexture.visible = item != null
%NoItemTextureRect.visible = item == null
%ParticleTexture.visible = item and len(item.get_particles())>0
%ParticleTexture2.visible = item and len(item.get_particles())>1
current_item = item
was_selected = selected

View File

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

View File

@@ -0,0 +1,34 @@
@tool
extends Node3D
class_name InventoryItem3D
enum State { BLACK,ITEM,TOOL }
const OFF_TRANSPARENCY = 0.3
const SPRITE_SIZE = 0.1
@export var item : Item : set = set_item
@export var state : State = State.BLACK : set = set_state
@export_tool_button("Reset Texture", "Callable") var reset_texture_action = func() : set_item()
func _ready():
set_item()
set_state()
func set_item(i : Item = item):
item = i
if is_node_ready():
if i and i.icon:
%ItemIconSprite.texture = i.icon
%ItemIconSprite.pixel_size = SPRITE_SIZE / i.icon.get_width()
else:
%ItemIconSprite.texture = null
func set_state(s := state):
state = s
if is_node_ready():
%ItemIconSprite.modulate.a = OFF_TRANSPARENCY if state == State.BLACK else 1.0
%BlackScreen.visible = state == State.BLACK
%ItemScreen.visible = state == State.ITEM
%ToolScreen.visible = state == State.TOOL

View File

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

View File

@@ -0,0 +1,62 @@
@tool
extends Node3D
class_name Inventory3D
const INVENTORY_OBJECT_SIZE = 0.2
const SEPARATOR_SIZE = 0.1
@export var inventory_item_scene: PackedScene
@export var bar: TextureRect
@export var test_inventory : Inventory
var last_n_tools = -1
var inventory_item_objects: Array[InventoryItem3D] = []
@export_tool_button("Test Update", "Callable") var update_action = func() : update(test_inventory)
func _ready():
if not Engine.is_editor_hint():
GameInfo.game_data.player_data.inventory.updated.connect(update)
update(GameInfo.game_data.player_data.inventory)
func update(inventory : Inventory):
if len(inventory.items) != len(inventory_item_objects) or last_n_tools != inventory.n_tools:
create_inventory_objects(inventory)
for i in range(len(inventory.items)):
var item : Item= inventory.items[i]
var object : InventoryItem3D = inventory_item_objects[i]
object.item = inventory.items[i]
if inventory.current_item_ind == i:
object.state = (
InventoryItem3D.State.TOOL if i < inventory.n_tools
else InventoryItem3D.State.ITEM
)
else:
object.state = InventoryItem3D.State.BLACK
func create_inventory_objects(inventory : Inventory):
for c in %Items3D.get_children():
c.queue_free()
last_n_tools = inventory.n_tools
inventory_item_objects = []
for i in range(len(inventory.items)):
var new_inventory_object := (inventory_item_scene.instantiate() as InventoryItem3D)
%Items3D.add_child(new_inventory_object)
new_inventory_object.position.x = -INVENTORY_OBJECT_SIZE * i
if i >= inventory.n_tools:
new_inventory_object.position.x -= SEPARATOR_SIZE
inventory_item_objects.append(new_inventory_object)
%Items3D.position.x = (
(len(inventory_item_objects) - 1) * INVENTORY_OBJECT_SIZE + SEPARATOR_SIZE
) / 2
%ItemSeparator.position.x = (
%Items3D.position.x
- (inventory.n_tools) * INVENTORY_OBJECT_SIZE
+ SEPARATOR_SIZE/2
)

View File

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

View File

@@ -1,36 +1,47 @@
extends HBoxContainer
@tool
extends Control
class_name InventoryGui
@export var inventory_item_scene: PackedScene
@export var bar: TextureRect
const SEPARATOR_OBJECT_SIZE = 40
var inventory_item_objects: Array[InventoryGuiItem]
@export var test_size : int
@export var test_n_tool : int
var last_n_tools = -1
var last_inventory_size = 0
@export_tool_button("Test Update", "Callable") var update_action = func() : generate_inventory_mouse_detectors(test_size,test_n_tool,true)
func _ready():
GameInfo.game_data.player_data.inventory.updated.connect(update)
update(GameInfo.game_data.player_data.inventory)
if not Engine.is_editor_hint():
GameInfo.game_data.player_data.inventory.updated.connect(update)
update(GameInfo.game_data.player_data.inventory)
func update(inventory: Inventory):
if len(inventory_item_objects) == 0 or len(inventory_item_objects) != inventory.items.size():
for o in inventory_item_objects:
o.queue_free()
inventory_item_objects = generate_inventory_item_objects(inventory, inventory.items.size())
for i in range(inventory.items.size()):
inventory_item_objects[i].update(inventory.get_item(i), i == inventory.current_item_ind)
if last_inventory_size != len(inventory.items) or last_n_tools != inventory.n_tools:
last_inventory_size = len(inventory.items)
last_n_tools = inventory.n_tools
generate_inventory_mouse_detectors(last_inventory_size, last_n_tools)
func generate_inventory_mouse_detectors(inventory_size: int, n_tool : int, test = false):
for c in %InventoryMouseDetectors.get_children():
c.queue_free()
move_child(bar, inventory.n_tools)
bar.visible = inventory.n_tools > 0 && inventory.items.size() > inventory.n_tools
for i in range(inventory_size):
if i == n_tool:
%InventoryMouseDetectors.add_child(generate_separator(test))
%InventoryMouseDetectors.add_child(generate_item_mouse_detector(i, test))
func generate_inventory_item_objects(inventory: Inventory, nb: int = 1) -> Array[InventoryGuiItem]:
var objects: Array[InventoryGuiItem] = []
for i in range(nb):
var o = inventory_item_scene.instantiate() as InventoryGuiItem
add_child(o)
move_child(o, i)
objects.append(o)
o.item_clicked.connect(func(): change_current_item_ind(inventory, i))
return objects
func generate_item_mouse_detector(index : int, test = false) -> ColorRect:
return InventoryGuiItemMouseDetector.new(index, test)
func change_current_item_ind(inventory: Inventory, new_ind: int):
inventory.set_current_item(new_ind)
func generate_separator(test = false) -> ColorRect:
var separator = ColorRect.new()
separator.custom_minimum_size = Vector2(SEPARATOR_OBJECT_SIZE, SEPARATOR_OBJECT_SIZE)
separator.color = Color.RED
if test:
separator.color.a = 0.5
else :
separator.color.a = 0.
return separator

View File

@@ -0,0 +1,30 @@
extends ColorRect
class_name InventoryGuiItemMouseDetector
const SIZE = 80
var index : int
func _init(_index := 0, test := false):
index = _index
color = Color.WHITE
color.a = 0.5 if test else 0.
func _ready():
custom_minimum_size = Vector2.ONE * SIZE
mouse_entered.connect(
func(): Pointer.inspect(self)
)
mouse_exited.connect(
func(): Pointer.stop_inspect(self)
)
func card_info() -> CardInfo:
var inventory := GameInfo.game_data.player_data.inventory
if inventory and index < len(inventory.items):
var item = GameInfo.game_data.player_data.inventory.items[index]
if item:
return item.card_info()
return null

View File

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

View File

@@ -3,19 +3,20 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://d4mj2mdjgkxsu"
path="res://.godot/imported/fond.jpg-4f076ce7d6a6874c8e67959f569870d5.ctex"
path.s3tc="res://.godot/imported/fond.jpg-4f076ce7d6a6874c8e67959f569870d5.s3tc.ctex"
metadata={
"vram_texture": false
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://gui/loading_screen/assets/fond.jpg"
dest_files=["res://.godot/imported/fond.jpg-4f076ce7d6a6874c8e67959f569870d5.ctex"]
dest_files=["res://.godot/imported/fond.jpg-4f076ce7d6a6874c8e67959f569870d5.s3tc.ctex"]
[params]
compress/mode=0
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
@@ -23,7 +24,7 @@ compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
@@ -37,4 +38,4 @@ 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
detect_3d/compress_to=0

View File

@@ -37,7 +37,9 @@ func _input(_event):
player.drop_item()
if Input.is_action_just_pressed("action"):
if can_interact:
if current_inspect is InventoryGuiItemMouseDetector:
GameInfo.game_data.player_data.inventory.set_current_item(inspected.index)
elif can_interact:
var interactable = current_inspect as Interactable
player.try_interact(interactable)
elif can_use_item:
@@ -91,8 +93,8 @@ func inspect(node: Node):
inspected = node
if inspected is InspectableEntity:
inspected_card_info = inspected.card_info()
elif inspected is InventoryGuiItem and inspected.item != null:
inspected_card_info = inspected.item.card_info()
elif inspected is InventoryGuiItemMouseDetector:
inspected_card_info = inspected.card_info()
elif inspected is RegionPoint:
inspected_card_info = inspected.card_info()
else: