gros dev pre proto

* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police
* Ajout d'un semblant d'exploration
* Ajout de la sauvegarde des entités
* Restructuration mineure de l'arborescence
* Fix divers et réécriture des textes
This commit is contained in:
2025-10-31 13:52:45 +01:00
parent ceae7af589
commit ed7a8bcb6e
167 changed files with 2665 additions and 1201 deletions

View File

@@ -62,7 +62,7 @@ tracks/2/keys = {
[sub_resource type="Animation" id="Animation_871vo"]
resource_name = "pass"
length = 3.0
length = 4.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@@ -70,7 +70,7 @@ tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.0333333, 2.93334, 2.96667),
"times": PackedFloat32Array(0, 0.0333333, 3.96667, 4),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 1,
"values": [false, true, true, false]
@@ -82,7 +82,7 @@ tracks/1/path = NodePath("VBoxContainer/AnnounceTexture:custom_minimum_size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.0666667, 0.433333, 2.42651, 2.93334),
"times": PackedFloat32Array(0.0666667, 0.433333, 3.5, 3.96667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 0), Vector2(0, 65), Vector2(0, 65), Vector2(0, 0)]
@@ -94,7 +94,7 @@ tracks/2/path = NodePath("VBoxContainer:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.0666667, 0.133333, 2.83334, 2.93334),
"times": PackedFloat32Array(0.0666667, 0.133333, 3.86667, 3.96667),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxoi7fd2em002"
path="res://.godot/imported/reflect.png-bcb8dad250fa32818817143cee617537.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://gui/game/card/assets/texture/reflect.png"
dest_files=["res://.godot/imported/reflect.png-bcb8dad250fa32818817143cee617537.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

203
gui/game/card/card.tscn Normal file
View File

@@ -0,0 +1,203 @@
[gd_scene load_steps=20 format=3 uid="uid://753270jjxmfg"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_m317d"]
[ext_resource type="Script" uid="uid://b7f10wuounfan" path="res://gui/game/card/scripts/card.gd" id="2_kpm7h"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="2_plgbn"]
[ext_resource type="Script" uid="uid://dj2pv1hiwjfv0" path="res://gui/game/card/scripts/card_info.gd" id="3_7wc8v"]
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="3_kpm7h"]
[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="5_7wc8v"]
[ext_resource type="Texture2D" uid="uid://0hbdgalf04e" path="res://common/icons/wood.svg" id="6_7wc8v"]
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="6_pmldi"]
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="7_mwhj8"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="7_pmldi"]
[ext_resource type="Texture2D" uid="uid://deywxmh76nu5w" path="res://common/icons/caret-down.svg" id="11_kpm7h"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gibok"]
bg_color = Color(1, 1, 1, 1)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
[sub_resource type="Resource" id="Resource_mwhj8"]
script = ExtResource("5_7wc8v")
title_text = "Title"
title_icon = ExtResource("6_7wc8v")
text = "Text"
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_plgbn"]
script = ExtResource("3_7wc8v")
title = "Hello"
type_icon = ExtResource("6_7wc8v")
texture = ExtResource("7_mwhj8")
important_stat_text = "10"
important_stat_icon = ExtResource("3_kpm7h")
sections = Array[ExtResource("5_7wc8v")]([SubResource("Resource_mwhj8")])
metadata/_custom_type_script = "uid://dj2pv1hiwjfv0"
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vnqhg"]
bg_color = Color(1, 1, 1, 1)
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
[sub_resource type="Theme" id="Theme_on5kv"]
[sub_resource type="LabelSettings" id="LabelSettings_sx78e"]
font = ExtResource("2_plgbn")
font_size = 20
[sub_resource type="Animation" id="Animation_7wc8v"]
resource_name = "expand"
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pmldi"]
_data = {
&"expand": SubResource("Animation_7wc8v")
}
[node name="Card" type="PanelContainer"]
custom_minimum_size = Vector2(250, 0)
offset_right = 140.0
offset_bottom = 60.0
size_flags_horizontal = 0
size_flags_vertical = 0
theme = ExtResource("1_m317d")
theme_override_styles/panel = SubResource("StyleBoxFlat_gibok")
script = ExtResource("2_kpm7h")
info = SubResource("Resource_plgbn")
[node name="GridContainer" type="GridContainer" parent="."]
layout_mode = 2
theme = ExtResource("1_m317d")
theme_override_constants/h_separation = 0
theme_override_constants/v_separation = 0
[node name="CardUpperPart" type="PanelContainer" parent="GridContainer"]
unique_name_in_owner = true
self_modulate = Color(0.13725491, 0.39215687, 0.6666667, 1)
clip_contents = true
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_m317d")
theme_override_styles/panel = SubResource("StyleBoxFlat_vnqhg")
[node name="EntityTexture" type="TextureRect" parent="GridContainer/CardUpperPart"]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.23137255)
layout_mode = 2
texture = ExtResource("7_mwhj8")
expand_mode = 1
stretch_mode = 6
[node name="MarginContainer" type="MarginContainer" parent="GridContainer/CardUpperPart"]
layout_mode = 2
theme = SubResource("Theme_on5kv")
theme_override_constants/margin_left = 25
[node name="ContentContainer" type="VBoxContainer" parent="GridContainer/CardUpperPart/MarginContainer"]
layout_mode = 2
theme = ExtResource("1_m317d")
theme_override_constants/separation = 10
[node name="TitleContainer" type="HBoxContainer" parent="GridContainer/CardUpperPart/MarginContainer/ContentContainer"]
layout_mode = 2
theme = ExtResource("1_m317d")
[node name="CardTitle" type="Label" parent="GridContainer/CardUpperPart/MarginContainer/ContentContainer/TitleContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Hello"
label_settings = SubResource("LabelSettings_sx78e")
[node name="CardTypeIcon" type="TextureRect" parent="GridContainer/CardUpperPart/MarginContainer/ContentContainer/TitleContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(30, 30)
layout_mode = 2
theme = ExtResource("1_m317d")
texture = ExtResource("6_7wc8v")
expand_mode = 1
stretch_mode = 5
[node name="CardStats" type="MarginContainer" parent="GridContainer/CardUpperPart/MarginContainer/ContentContainer"]
unique_name_in_owner = true
visible = false
layout_mode = 2
theme = ExtResource("1_m317d")
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 40
theme_override_constants/margin_bottom = 0
[node name="CardStatsContainer" type="VBoxContainer" parent="GridContainer/CardUpperPart/MarginContainer/ContentContainer/CardStats"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("1_m317d")
theme_override_constants/separation = 6
[node name="CardSections" type="MarginContainer" parent="GridContainer"]
unique_name_in_owner = true
layout_mode = 2
[node name="CardSectionsContainer" type="VBoxContainer" parent="GridContainer/CardSections"]
unique_name_in_owner = true
layout_mode = 2
[node name="ImportantStat" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 0
theme_override_constants/margin_top = 30
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="CenterContainer" type="CenterContainer" parent="ImportantStat"]
layout_mode = 2
size_flags_horizontal = 0
size_flags_vertical = 0
use_top_left = true
[node name="ImportantStatIcon" type="TextureRect" parent="ImportantStat/CenterContainer"]
unique_name_in_owner = true
modulate = Color(1, 0.6509804, 0.09019608, 1)
custom_minimum_size = Vector2(60, 60)
layout_mode = 2
texture = ExtResource("3_kpm7h")
expand_mode = 1
stretch_mode = 5
[node name="ImportantStatText" type="Label" parent="ImportantStat/CenterContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "10"
label_settings = ExtResource("7_pmldi")
[node name="ArrowDown" type="Control" parent="."]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="TextureRect" type="TextureRect" parent="ArrowDown"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -24.0
offset_top = -24.0
offset_right = 24.0
offset_bottom = 24.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 8
texture = ExtResource("11_kpm7h")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_pmldi")
}

View File

@@ -0,0 +1,71 @@
[gd_scene load_steps=9 format=3 uid="uid://bghefrgaujjt6"]
[ext_resource type="Script" uid="uid://dcmee2jvohudl" path="res://gui/game/card/scripts/card_section.gd" id="1_41hkv"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_t7m3x"]
[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="2_3ktqg"]
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="2_41hkv"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="3_3ktqg"]
[sub_resource type="Theme" id="Theme_vlpjv"]
[sub_resource type="Resource" id="Resource_ycbno"]
script = ExtResource("2_3ktqg")
title_colored = true
title_text = "Hello"
title_icon = ExtResource("2_41hkv")
text = "Hello"
[sub_resource type="LabelSettings" id="LabelSettings_ycbno"]
font = ExtResource("3_3ktqg")
font_size = 15
[node name="CardSection" type="VBoxContainer"]
offset_right = 176.0
offset_bottom = 71.0
theme = SubResource("Theme_vlpjv")
theme_override_constants/separation = 6
script = ExtResource("1_41hkv")
info = SubResource("Resource_ycbno")
[node name="CardSectionTitle" type="HBoxContainer" parent="."]
layout_mode = 2
size_flags_vertical = 0
theme = ExtResource("1_t7m3x")
theme_override_constants/separation = 6
[node name="TitleIcon" type="TextureRect" parent="CardSectionTitle"]
unique_name_in_owner = true
modulate = Color(0.14509805, 0.75686276, 0.2784314, 1)
custom_minimum_size = Vector2(20, 20)
layout_mode = 2
texture = ExtResource("2_41hkv")
expand_mode = 1
stretch_mode = 5
[node name="TitleText" type="Label" parent="CardSectionTitle"]
unique_name_in_owner = true
modulate = Color(0.14509805, 0.75686276, 0.2784314, 1)
layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("1_t7m3x")
text = "Hello"
label_settings = SubResource("LabelSettings_ycbno")
autowrap_mode = 2
[node name="CardSectionTextContainer" type="MarginContainer" parent="."]
layout_mode = 2
theme = ExtResource("1_t7m3x")
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 0
theme_override_constants/margin_right = 0
theme_override_constants/margin_bottom = 0
[node name="Text" type="RichTextLabel" parent="CardSectionTextContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("1_t7m3x")
theme_override_colors/default_color = Color(0.0627451, 0.05882353, 0.16862746, 1)
bbcode_enabled = true
text = "Hello"
fit_content = true
scroll_active = false

View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=6 format=3 uid="uid://cpen6hj0rbw8x"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_6abif"]
[ext_resource type="Script" uid="uid://c8xxhu28xm4hy" path="res://gui/game/card/scripts/card_stat.gd" id="2_30iht"]
[ext_resource type="Texture2D" uid="uid://baaujfw8piywi" path="res://common/icons/dna.svg" id="3_30iht"]
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="3_c3wpw"]
[sub_resource type="Resource" id="Resource_n0n76"]
script = ExtResource("3_c3wpw")
[node name="CardStat" type="HBoxContainer"]
offset_right = 222.0
offset_bottom = 30.0
theme = ExtResource("1_6abif")
theme_override_constants/separation = 6
script = ExtResource("2_30iht")
info = SubResource("Resource_n0n76")
[node name="TextureRect" type="TextureRect" parent="."]
unique_name_in_owner = true
custom_minimum_size = Vector2(20, 20)
layout_mode = 2
texture = ExtResource("3_30iht")
expand_mode = 1
stretch_mode = 5
[node name="RichTextLabel" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
theme = ExtResource("1_6abif")
bbcode_enabled = true
text = "[b]10[/b] A very long text that will eventually break"
fit_content = true
scroll_active = false
autowrap_mode = 2

View File

@@ -0,0 +1,85 @@
[gd_scene load_steps=15 format=3 uid="uid://3ss8pvhsackj"]
[ext_resource type="PackedScene" uid="uid://753270jjxmfg" path="res://gui/game/card/card.tscn" id="1_we78f"]
[ext_resource type="Shader" uid="uid://bqjwmomh851lc" path="res://common/vfx/materials/shaders/skew.gdshader" id="1_x54se"]
[ext_resource type="Script" uid="uid://dj5pld5ragrjp" path="res://gui/game/card/scripts/card_visualiser.gd" id="2_ntbk8"]
[ext_resource type="Script" uid="uid://dj2pv1hiwjfv0" path="res://gui/game/card/scripts/card_info.gd" id="3_5yk1o"]
[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="4_7xkgc"]
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="5_1et8x"]
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="6_7xkgc"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="7_1et8x"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_r0jrf"]
shader = ExtResource("1_x54se")
shader_parameter/fov = 90.0
shader_parameter/cull_back = true
shader_parameter/y_rot = -6e-45
shader_parameter/x_rot = -6e-45
shader_parameter/inset = 0.0
[sub_resource type="ViewportTexture" id="ViewportTexture_5yk1o"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_r0jrf"]
script = ExtResource("3_5yk1o")
title = "Hello"
texture = ExtResource("6_7xkgc")
metadata/_custom_type_script = "uid://dj2pv1hiwjfv0"
[sub_resource type="Animation" id="Animation_1et8x"]
length = 0.3
[sub_resource type="Animation" id="Animation_7xkgc"]
resource_name = "appear"
length = 0.2
[sub_resource type="AnimationLibrary" id="AnimationLibrary_r0jrf"]
_data = {
&"RESET": SubResource("Animation_1et8x"),
&"appear": SubResource("Animation_7xkgc")
}
[node name="CardVisualiser" type="TextureRect"]
material = SubResource("ShaderMaterial_r0jrf")
offset_left = -24.0
offset_right = 276.0
offset_bottom = 110.0
size_flags_horizontal = 0
size_flags_vertical = 4
mouse_filter = 2
texture = SubResource("ViewportTexture_5yk1o")
stretch_mode = 4
script = ExtResource("2_ntbk8")
small_mode = true
card_info = SubResource("Resource_r0jrf")
[node name="SubViewport" type="SubViewport" parent="."]
unique_name_in_owner = true
transparent_bg = true
size = Vector2i(300, 110)
[node name="CardContainer" type="MarginContainer" parent="SubViewport"]
unique_name_in_owner = true
clip_contents = true
offset_right = 350.0
offset_bottom = 110.0
size_flags_horizontal = 0
theme_override_constants/margin_left = 25
theme_override_constants/margin_top = 25
theme_override_constants/margin_right = 25
theme_override_constants/margin_bottom = 25
[node name="Card" parent="SubViewport/CardContainer" instance=ExtResource("1_we78f")]
unique_name_in_owner = true
self_modulate = Color(1, 1, 1, 0)
layout_mode = 2
mouse_filter = 2
small_mode = true
down_arrow = true
info = SubResource("Resource_r0jrf")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_r0jrf")
}

View File

@@ -0,0 +1,57 @@
@tool
extends PanelContainer
class_name Card
const CARD_STAT_SCENE : PackedScene = preload("res://gui/game/card/card_stat.tscn")
const CARD_SECTION_SCENE : PackedScene = preload("res://gui/game/card/card_section.tscn")
@export var small_mode : bool = false
@export var down_arrow : bool = false
@export var info : CardInfo = CardInfo.new("Default Card Name")
@export_tool_button("Update", "Callable") var update_action = update
func _ready():
update()
func update():
%CardTitle.text = info.title
%CardUpperPart.self_modulate = info.bg_color
%CardTypeIcon.texture = info.type_icon
%EntityTexture.texture = info.texture
%ImportantStatIcon.texture = info.important_stat_icon
%ImportantStatText.text = info.important_stat_text
%ArrowDown.visible = down_arrow
self_modulate = Color.TRANSPARENT if small_mode else Color.WHITE
%CardUpperPart.self_modulate.a = 0.7 if small_mode else 1.0
update_card_stats()
update_card_sections()
func update_card_stats():
for stat in %CardStatsContainer.get_children():
stat.queue_free()
for stat_info in info.stats:
if stat_info:
var new_stat : CardStat = CARD_STAT_SCENE.instantiate() as CardStat
new_stat.info = stat_info
%CardStatsContainer.add_child(new_stat)
%CardStats.visible = len(info.stats) != 0 && small_mode == false
func update_card_sections():
for stat in %CardSectionsContainer.get_children():
stat.queue_free()
for sections_info in info.sections:
if sections_info:
var new_section : CardSection = CARD_SECTION_SCENE.instantiate() as CardSection
new_section.info = sections_info
%CardSectionsContainer.add_child(new_section)
%CardSections.visible = len(%CardSectionsContainer.get_children()) != 0 && small_mode == false

View File

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

View File

@@ -0,0 +1,18 @@
extends Resource
class_name CardInfo
@export var title : String
@export var bg_color : Color = Color("2364aaff")
@export var type_icon : Texture = preload("res://common/icons/cube-3d-sphere.svg")
@export var texture : Texture
@export var important_stat_text : String
@export var important_stat_icon : Texture
@export var stats : Array[CardStatInfo] = []
@export var sections : Array[CardSectionInfo] = []
func _init(
_title : String = "",
):
title = _title

View File

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

View File

@@ -0,0 +1,20 @@
@tool
extends VBoxContainer
class_name CardSection
const DEFAULT_ICON_COLOR = Color("96b3dbff")
const DEFAULT_TITLE_COLOR = Color("100f2bff")
@export var info : CardSectionInfo = CardSectionInfo.new()
func _ready():
update()
@export_tool_button("Update", "Callable") var update_action = update
func update():
%Text.text = info.text
%TitleIcon.texture = info.title_icon
%TitleText.text = info.title_text
%TitleIcon.modulate = info.title_color if info.title_colored else DEFAULT_ICON_COLOR
%TitleText.modulate = info.title_color if info.title_colored else DEFAULT_TITLE_COLOR

View File

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

View File

@@ -0,0 +1,15 @@
extends Resource
class_name CardSectionInfo
@export var title_colored : bool = false
@export var title_color : Color = Color("25c147ff")
@export var title_text : String = ""
@export var title_icon : Texture = null
@export_multiline var text : String = ""
func _init(
_title_text : String = "",
_text : String = ""
):
title_text = _title_text
text = _text

View File

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

View File

@@ -0,0 +1,20 @@
@tool
extends HBoxContainer
class_name CardStat
var is_ready = false
@export var info : CardStatInfo = CardStatInfo.new() :
set(v):
info = v
if is_ready : update()
@export_tool_button("Update", "Callable") var update_action = update
func _ready():
is_ready = true
update()
func update():
%RichTextLabel.text = info.text
%TextureRect.texture = info.icon

View File

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

View File

@@ -0,0 +1,12 @@
extends Resource
class_name CardStatInfo
@export var text : String = ""
@export var icon : Texture = null
func _init(
_text : String = "",
_icon : Texture = null,
):
icon = _icon
text = _text

View File

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

View File

@@ -0,0 +1,62 @@
@tool
extends TextureRect
const MAX_ROT = 15
const ZOOM_SCALE = 1.0
var wanted_rot : Vector2 = Vector2.ZERO
var real_rot : Vector2 = Vector2.ZERO
var wanted_scale : Vector2 = Vector2.ONE
var is_ready = false
@export var small_mode : bool = false :
set(v):
small_mode = v
if is_ready : update()
@export var card_info : CardInfo = null :
set(v):
card_info = v
if is_ready : update()
@export_tool_button("Update", "Callable") var update_action = update
func _ready():
material = material.duplicate()
update()
is_ready = true
func _process(_d):
var center_relative_mouse_position = (get_local_mouse_position() - size/2) / size
if is_mouse_over():
wanted_rot = center_relative_mouse_position * MAX_ROT
small_mode = false
else:
wanted_rot = Vector2.ZERO
small_mode = true
real_rot = real_rot.lerp(wanted_rot, 0.1)
material.set_shader_parameter("y_rot", - real_rot.x)
material.set_shader_parameter("x_rot", real_rot.y)
%SubViewport.size.y = %CardContainer.size.y
size = %SubViewport.size
func is_mouse_over() -> bool:
var center_relative_mouse_position = (get_local_mouse_position() - size/2) / size
return (
abs(center_relative_mouse_position.x) < 0.5
and abs(center_relative_mouse_position.y) < 0.5
)
func update():
if card_info:
%Card.info = card_info
%Card.small_mode = small_mode
%Card.update()

View File

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

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://12nak7amd1uq"]
[gd_scene load_steps=29 format=3 uid="uid://12nak7amd1uq"]
[ext_resource type="Script" uid="uid://cqao7n800qy40" path="res://gui/game/scripts/game_gui.gd" id="1_udau0"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_nq5i2"]
@@ -6,7 +6,6 @@
[ext_resource type="PackedScene" uid="uid://fnv0qhkh40mv" path="res://gui/game/announce/announce.tscn" id="4_h6540"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_k4juk"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_ujg5r"]
[ext_resource type="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="7_id0t5"]
[ext_resource type="Texture2D" uid="uid://b5cuxgisrsfgt" path="res://common/icons/player-pause.svg" id="9_2wykm"]
[ext_resource type="PackedScene" uid="uid://clicjf8ts51h8" path="res://gui/game/inventory_gui/inventory_gui.tscn" id="9_id0t5"]
@@ -322,7 +321,7 @@ stretch_mode = 5
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("2_nq5i2")
text = "0/3"
text = "X/X"
label_settings = ExtResource("4_ujg5r")
horizontal_alignment = 1
vertical_alignment = 1
@@ -389,13 +388,6 @@ layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="Inspector" parent="MarginContainer" instance=ExtResource("6_dr1y2")]
unique_name_in_owner = true
custom_minimum_size = Vector2(250, 0)
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 8
[node name="PassDayFade" type="ColorRect" parent="."]
physics_interpolation_mode = 0
layout_mode = 1

View File

@@ -11,6 +11,10 @@ var info : Info = null :
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:

View File

@@ -20,7 +20,7 @@ func inspect(is_inspected : bool = true):
func _on_mouse_entered():
if current_item:
Pointer.inspect(self, inspector_info())
Pointer.inspect(self)
func _on_mouse_excited():
if current_item:
@@ -30,9 +30,6 @@ func _on_gui_input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("action"):
emit_signal("item_clicked")
func inspector_info() -> Inspector.Info:
return current_item.inspector_info()
func update(item: Item, selected : bool):
if selected and not was_selected:
%SelectedAnimation.play("selected")

View File

@@ -35,7 +35,7 @@ tracks/0/keys = {
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/path = NodePath("Container:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
@@ -63,11 +63,11 @@ tracks/0/keys = {
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:modulate")
tracks/1/path = NodePath("Container:modulate")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.0333333, 0.3),
"times": PackedFloat32Array(0.033333335, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
@@ -79,18 +79,21 @@ _data = {
&"pause": SubResource("Animation_apjlw")
}
[node name="Pause" type="Control"]
[node name="Pause" type="CanvasLayer"]
process_mode = 3
layer = 100
visible = false
z_index = 10
script = ExtResource("1_he4ox")
[node name="Container" type="Control" parent="."]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_he4ox")
[node name="ColorRect" type="ColorRect" parent="."]
[node name="ColorRect" type="ColorRect" parent="Container"]
material = SubResource("ShaderMaterial_58dya")
layout_mode = 1
anchors_preset = 15
@@ -100,7 +103,7 @@ grow_horizontal = 2
grow_vertical = 2
color = Color(0.0352941, 0.0196078, 0.12549, 0.705882)
[node name="Tutorial" type="MarginContainer" parent="."]
[node name="Tutorial" type="MarginContainer" parent="Container"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
@@ -109,25 +112,25 @@ grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_51ks3")
[node name="VBoxContainer" type="VBoxContainer" parent="Tutorial"]
[node name="VBoxContainer" type="VBoxContainer" parent="Container/Tutorial"]
layout_mode = 2
theme = ExtResource("1_51ks3")
theme_override_constants/separation = 9
alignment = 1
[node name="PauseTitle" type="Label" parent="Tutorial/VBoxContainer"]
[node name="PauseTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Pause"
label_settings = SubResource("LabelSettings_apjlw")
horizontal_alignment = 1
[node name="StoryTitle" type="Label" parent="Tutorial/VBoxContainer"]
[node name="StoryTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Story"
label_settings = ExtResource("3_0pdto")
horizontal_alignment = 1
[node name="StoryText" type="Label" parent="Tutorial/VBoxContainer"]
[node name="StoryText" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "You are a robot who has recently arrived on a barren planet. Find and plant seeds to reduce the contamination.
You have limited energy, but can recharge when passing days.
@@ -135,13 +138,13 @@ Each 7 days, you have to meet a quota of decontaminted lands.
You get a machine to build each quota reached."
horizontal_alignment = 1
[node name="ControlsTitle" type="Label" parent="Tutorial/VBoxContainer"]
[node name="ControlsTitle" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Controls"
label_settings = ExtResource("3_0pdto")
horizontal_alignment = 1
[node name="ControlsText" type="Label" parent="Tutorial/VBoxContainer"]
[node name="ControlsText" type="Label" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
text = "Directional Arrows/Right Click : Move
Left Click : Interact/Pickup Items
@@ -150,21 +153,21 @@ X : Drop Item
"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Tutorial/VBoxContainer"]
[node name="HBoxContainer" type="HBoxContainer" parent="Container/Tutorial/VBoxContainer"]
layout_mode = 2
alignment = 1
[node name="Resume" type="Button" parent="Tutorial/VBoxContainer/HBoxContainer"]
[node name="Resume" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Resume Game"
icon = ExtResource("5_apjlw")
[node name="Restart" type="Button" parent="Tutorial/VBoxContainer/HBoxContainer"]
[node name="Restart" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Restart"
icon = ExtResource("6_58dya")
[node name="Quit" type="Button" parent="Tutorial/VBoxContainer/HBoxContainer"]
[node name="Quit" type="Button" parent="Container/Tutorial/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Quit"
icon = ExtResource("7_yj6f1")
@@ -175,6 +178,6 @@ libraries = {
&"": SubResource("AnimationLibrary_yj6f1")
}
[connection signal="pressed" from="Tutorial/VBoxContainer/HBoxContainer/Resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="Tutorial/VBoxContainer/HBoxContainer/Restart" to="." method="_on_restart_pressed"]
[connection signal="pressed" from="Tutorial/VBoxContainer/HBoxContainer/Quit" to="." method="_on_quit_pressed"]
[connection signal="pressed" from="Container/Tutorial/VBoxContainer/HBoxContainer/Resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="Container/Tutorial/VBoxContainer/HBoxContainer/Restart" to="." method="_on_restart_pressed"]
[connection signal="pressed" from="Container/Tutorial/VBoxContainer/HBoxContainer/Quit" to="." method="_on_quit_pressed"]

View File

@@ -1,4 +1,4 @@
extends Control
extends CanvasLayer
var pause = false : set = set_pause
@@ -20,12 +20,12 @@ func _on_resume_pressed():
pause = false
func _on_restart_pressed():
GameInfo.game_data.current_planet_data = null
GameInfo.game_data.reset_all()
pause = false
get_tree().reload_current_scene()
func _on_quit_pressed():
get_tree().quit()
func _on_root_gui_pause_asked():
func _on_game_gui_pause_asked():
pause = true

View File

@@ -4,22 +4,43 @@ class_name GameGui
signal pause_asked
func _ready():
Pointer.connect("inspected_changed", _on_inspected_changed)
GameInfo.game_data.current_planet_data.updated.connect(_on_planet_updated)
GameInfo.game_data.current_planet_data.new_quota_started.connect(_on_planet_new_quota_started)
GameInfo.game_data.player_data.updated.connect(_on_player_updated)
GameInfo.game_data.player_data.inventory.updated.connect(_on_inventory_updated)
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
if not GameInfo.game_data.current_planet_data.is_quota_announced:
announce_quota(GameInfo.game_data.current_planet_data)
GameInfo.game_data.current_planet_data.is_quota_announced = true
planet_update(GameInfo.game_data.current_planet_data)
player_update(GameInfo.game_data.player_data)
inventory_update(GameInfo.game_data.player_data.inventory)
%Inventory.update(player.inventory)
update_no_energy_left_info(player.energy)
func _on_player_updated(player_data : PlayerData):
player_update(player_data)
func _on_planet_updated(planet:Planet):
%DayCount.text = str(planet.get_quota_remaining_days()) + " days left"
func player_update(player_data : PlayerData):
%EnergyCount.text = "%d/%d" % [player_data.energy, player_data.max_energy]
%EnergyInfo.modulate = Color.WHITE if player_data.energy > 0 else Color.RED
if planet.next_quota:
var quota_progression_percent : float = (planet.garden_score - planet.last_quota) / (planet.next_quota - planet.last_quota) * 100
%QuotaProgressText.text = str(roundi(planet.garden_score)) + "/" + str(roundi(planet.next_quota))
update_no_energy_left_info(player_data.energy)
func _on_inventory_updated(inventory : Inventory):
inventory_update(inventory)
func inventory_update(inventory : Inventory):
%Inventory.update(inventory)
func _on_planet_updated(planet_data : PlanetData):
planet_update(planet_data)
func planet_update(planet_data : PlanetData):
if planet_data:
%DayCount.text = "%d days left" % (planet_data.quota_days)
var quota_progression_percent : float = (float(planet_data.garden_score) / float(planet_data.get_quota_score())) * 100
%QuotaProgressText.text = "%d/%d" % [planet_data.garden_score, planet_data.get_quota_score()]
get_tree().create_tween().tween_property(
%QuotaProgressBar,
"value",
@@ -31,7 +52,7 @@ func _on_player_action_tried_without_energy():
$AnimationPlayer.play("no_energy_left")
func _on_pause_pressed():
pause_asked.emit()
Pause.pause = true
func _on_player_upgraded():
@@ -43,9 +64,6 @@ func _on_planet_pass_day_started(planet):
await $PassDayAnimation.animation_finished
$PassDayAnimation.speed_scale = 1
func _on_inspected_changed(info : Inspector.Info):
%Inspector.info = info
func update_no_energy_left_info(energy):
if energy == 0 and not %NoEnergyLeft.visible:
%NoEnergyLeft.visible = true
@@ -54,23 +72,22 @@ func update_no_energy_left_info(energy):
%NoEnergyLeft.visible = false
func _on_planet_new_quota_started(planet:Planet):
func _on_planet_new_quota_started(planet_data : PlanetData):
announce_quota(planet_data)
planet_update(planet_data)
planet_data.is_quota_announced = true
func announce_quota(planet_data : PlanetData):
%Announce.announce(
"New Quota",
"Reach " + str(roundi(planet.next_quota)) + " garden score before " + str(Planet.DEFAULT_DAY_LIMIT) + " days"
"Reach %d garden score before %d days" % [planet_data.get_quota_score(), planet_data.get_quota_duration()]
)
func _on_planet_pass_day_ended(planet:Planet):
var remaining_days = planet.get_quota_remaining_days()
if remaining_days == 1:
if planet.data.quota_days == 1:
%Announce.announce(
"Last day for reaching quota",
str(roundi(planet.next_quota - planet.garden_score)) + " garden score left",
str(roundi(planet.data.get_quota_score() - planet.garden.get_score())) + " garden score left",
Announce.RED_COLOR
)
if remaining_days == 2:
%Announce.announce(
"2 days left before quota's ending",
str(roundi(planet.next_quota - planet.garden_score)) + " garden score left",
Announce.YELLOW_COLOR
)

View File

@@ -5,6 +5,7 @@ const INDICATOR_SCENE = preload("res://gui/game/tutorial/in_game_indicator/in_ga
var indicators : Array[InGameIndicator]
@export var player : Player
@export var planet : Planet
@onready var steps : Array[Step] = [
TakeShovelStep.new(),
@@ -19,14 +20,15 @@ var actual_step : Step = null : set = pass_to_step
func _process(_d):
if not GameInfo.game_data.tutorial_done:
if not actual_step and len(steps):
if not actual_step and planet.data.tutorial_step < len(steps):
destroy_indicators()
pass_to_step(steps.pop_front())
pass_to_step(steps[planet.data.tutorial_step])
if player and actual_step and actual_step.is_step_over(player):
if player and actual_step and actual_step.is_step_over(player, planet):
destroy_indicators()
if len(steps):
pass_to_step(steps.pop_front())
planet.data.tutorial_step += 1
if planet.data.tutorial_step < len(steps):
pass_to_step(steps[planet.data.tutorial_step])
else :
GameInfo.game_data.tutorial_done = true
@@ -37,7 +39,7 @@ func destroy_indicators():
func pass_to_step(new_step : Step):
actual_step = new_step
indicators = new_step.generate_indicators(player)
indicators = new_step.generate_indicators(player, planet)
for i in indicators:
add_child(i)
@@ -49,15 +51,15 @@ class Step:
)
return new_indicator
func generate_indicators(_player : Player) -> Array[InGameIndicator]:
func generate_indicators(_player : Player, _planet : Planet) -> Array[InGameIndicator]:
return []
func is_step_over(_p : Player) -> bool:
func is_step_over(_p : Player, _planet : Planet) -> bool:
return true
class TakeShovelStep extends Step:
func generate_indicators(p: Player) -> Array[InGameIndicator]:
for entity in p.planet.entity_container.get_children():
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
if entity is ItemObject and entity.item is Shovel:
var indicator = generate_indicator("Take the Shovel")
indicator.follow_entity(entity)
@@ -67,31 +69,40 @@ class TakeShovelStep extends Step:
printerr("No Shovel found...")
return []
func is_step_over(p : Player) -> bool:
return p.inventory.items.size() > 0
func is_step_over(p : Player, _planet : Planet) -> bool:
for item in p.data.inventory.items:
if item is Shovel:
return true
return false
class DigLootStep extends Step:
func generate_indicators(p: Player) -> Array[InGameIndicator]:
var indicators : Array[InGameIndicator] = []
for entity in p.planet.entity_container.get_children():
func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]:
var closest_loot : UndergroundLoot
var closest_distance = 10000000
for entity in planet.entity_container.get_children():
if entity is UndergroundLoot:
var indicator = generate_indicator("Dig Underground Loot")
indicator.follow_entity(entity)
indicators.append(
indicator
)
return indicators
var distance = entity.global_position.distance_to(p.global_position)
if distance < closest_distance:
closest_distance = distance
closest_loot = entity
if closest_loot:
var indicator = generate_indicator("Dig Underground Loot")
indicator.follow_entity(closest_loot)
return [indicator]
return []
func is_step_over(p : Player) -> bool:
for entity in p.terrain.entity_container.get_children():
func is_step_over(_p : Player, planet : Planet) -> bool:
for entity in planet.entity_container.get_children():
if entity is ItemObject and entity.item is Seed:
return true
return false
class TakeSeedStep extends Step:
func generate_indicators(p: Player) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
var indicators : Array[InGameIndicator] = []
for entity in p.terrain.entity_container.get_children():
for entity in planet.entity_container.get_children():
if entity is ItemObject and entity.item is Seed:
var indicator = generate_indicator("Take a seed")
indicator.follow_entity(entity)
@@ -100,27 +111,27 @@ class TakeSeedStep extends Step:
)
return indicators
func is_step_over(p : Player) -> bool:
for item in p.inventory.items:
func is_step_over(p : Player, _planet : Planet) -> bool:
for item in p.data.inventory.items:
if item is Seed:
return true
return false
class PlantSeedStep extends Step:
func generate_indicators(p: Player) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
var indicator = generate_indicator("Plant the seed in decontamined zone")
indicator.follow_game_position(Vector2(0,0) + p.planet.entity_container.global_position)
indicator.follow_game_position(Vector2(0,0) + planet.entity_container.global_position)
return [indicator]
func is_step_over(p : Player) -> bool:
for entity in p.terrain.entity_container.get_children():
func is_step_over(_p : Player, planet : Planet) -> bool:
for entity in planet.entity_container.get_children():
if entity is Plant:
return true
return false
class RechargeStep extends Step:
func generate_indicators(p: Player) -> Array[InGameIndicator]:
for entity in p.planet.entity_container.get_children():
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
var indicator = generate_indicator("Recharge to pass days")
indicator.follow_entity(entity)
if entity is TruckRecharge:
@@ -130,19 +141,19 @@ class RechargeStep extends Step:
printerr("No Recharge Station found...")
return []
func is_step_over(p : Player) -> bool:
if p.planet == null :
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
return false
return p.planet.day > 1
return planet.data.day > 1
class WaitMaturePlant extends Step:
func generate_indicators(_p: Player) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, _planet : Planet) -> Array[InGameIndicator]:
return []
func is_step_over(p : Player) -> bool:
if p.planet == null :
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
return false
for entity in p.planet.entity_container.get_children():
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
return true
return false
@@ -151,9 +162,9 @@ class HarvestMaturePlant extends Step:
var mature_plant_number : int = 0
func generate_indicators(p: Player) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
var indicators : Array[InGameIndicator] = []
for entity in p.planet.entity_container.get_children():
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
var indicator = generate_indicator("Harvest mature plants with shovel")
indicator.follow_entity(entity)
@@ -163,11 +174,11 @@ class HarvestMaturePlant extends Step:
mature_plant_number += 1
return indicators
func is_step_over(p : Player) -> bool:
if p.planet == null :
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
return false
var actual_mature_plant_number = 0
for entity in p.planet.entity_container.get_children():
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
actual_mature_plant_number += 1
return mature_plant_number != actual_mature_plant_number

View File

@@ -6,10 +6,10 @@ func _ready():
func win(planet : Planet):
visible = true
get_tree().paused = true
%WinTitle.text = "Score : " + str(roundi(planet.decontamination_surface))
%WinTitle.text = "Score : " + str(roundi(planet.garden.get_score()))
func _on_restart_pressed():
GameInfo.game_data.current_planet_data = null
GameInfo.game_data.reset_all()
get_tree().paused = false
get_tree().reload_current_scene()

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://0yr6b2jtuttm"]
[gd_scene load_steps=16 format=3 uid="uid://0yr6b2jtuttm"]
[ext_resource type="Script" uid="uid://vhumsfntpqcl" path="res://gui/pointer/scripts/pointer.gd" id="1_1pe2k"]
[ext_resource type="Texture2D" uid="uid://bspffyprdywgc" path="res://gui/pointer/assets/cursors/pointer.svg" id="2_q4bvb"]
@@ -6,6 +6,27 @@
[ext_resource type="Texture2D" uid="uid://djb52fosgmv4j" path="res://common/icons/left_click.svg" id="3_pshoq"]
[ext_resource type="Texture2D" uid="uid://dcgnamu7sb3ov" path="res://common/icons/bolt.svg" id="4_b4uwv"]
[ext_resource type="Script" uid="uid://c60a1bjcuj4hd" path="res://common/vfx/circle/scripts/circle.gd" id="5_b4uwv"]
[ext_resource type="PackedScene" uid="uid://3ss8pvhsackj" path="res://gui/game/card/card_visualiser.tscn" id="6_7j4mj"]
[ext_resource type="Shader" uid="uid://bqjwmomh851lc" path="res://common/vfx/materials/shaders/skew.gdshader" id="7_wgcdp"]
[ext_resource type="Script" uid="uid://dj2pv1hiwjfv0" path="res://gui/game/card/scripts/card_info.gd" id="8_xb313"]
[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="9_s1ym6"]
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="10_d4v46"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="11_s1ym6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_s1ym6"]
shader = ExtResource("7_wgcdp")
shader_parameter/fov = 90.0
shader_parameter/cull_back = true
shader_parameter/y_rot = 8.409235e-36
shader_parameter/x_rot = -9.785961e-36
shader_parameter/inset = 0.0
[sub_resource type="ViewportTexture" id="ViewportTexture_xb313"]
viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_mrxa2"]
script = ExtResource("8_xb313")
metadata/_custom_type_script = "uid://dj2pv1hiwjfv0"
[node name="Pointer" type="Node"]
process_mode = 3
@@ -32,12 +53,6 @@ size_flags_horizontal = 0
size_flags_vertical = 0
mouse_filter = 2
[node name="InspectorText" type="Label" parent="CanvasLayer/Inspector/Container"]
unique_name_in_owner = true
z_index = 1
layout_mode = 2
text = "Item"
[node name="Action" type="HBoxContainer" parent="CanvasLayer/Inspector/Container"]
unique_name_in_owner = true
modulate = Color(1, 1, 0.168627, 1)
@@ -68,6 +83,46 @@ script = ExtResource("5_b4uwv")
opacity = 0.4
metadata/_custom_type_script = "uid://c60a1bjcuj4hd"
[node name="CardsCanvasLayer" type="CanvasLayer" parent="."]
layer = 2
[node name="CardPosition" type="Control" parent="CardsCanvasLayer"]
unique_name_in_owner = true
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="MarginContainer" type="MarginContainer" parent="CardsCanvasLayer/CardPosition"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -175.0
offset_top = -130.0
offset_right = 175.0
grow_horizontal = 2
grow_vertical = 0
mouse_filter = 2
theme_override_constants/margin_bottom = 30
[node name="CardVisualiser" parent="CardsCanvasLayer/CardPosition/MarginContainer" instance=ExtResource("6_7j4mj")]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.5003133)
material = SubResource("ShaderMaterial_s1ym6")
layout_mode = 2
size_flags_horizontal = 4
mouse_filter = 0
texture = SubResource("ViewportTexture_xb313")
card_info = SubResource("Resource_mrxa2")
[node name="Audio" type="Node" parent="."]
[node name="Click" type="AudioStreamPlayer" parent="Audio"]

View File

@@ -9,10 +9,13 @@ const ZONE_OPACITY = 0.4
const ZONE_ACTIVATED_COLOR = Color.TURQUOISE
const ZONE_DEACTIVATED_COLOR = Color.REBECCA_PURPLE
const CARD_VISUALISATION_TIME = 1.0
@export var default_cursor : Texture2D
var inspected : Node = null
var inspected_info : Inspector.Info = null
var last_inspected : Node = null
var time_last_inspected : float = 0.
var player : Player # renseigné par Player
var can_interact : bool = false
var current_selected_item : Item = null
@@ -22,7 +25,6 @@ var can_use_item : bool = false
func _ready():
Input.set_custom_mouse_cursor(default_cursor)
%InspectorText.visible = false
%Action.visible = false
func _input(_event):
@@ -40,11 +42,12 @@ func _input(_event):
player.try_interact(interactable)
elif can_use_item:
player.try_use_item(
player.inventory.get_item(),
player.data.inventory.get_item(),
player.get_global_mouse_position()
)
func _process(_delta):
func _process(delta):
time_last_inspected += delta
%Inspector.position = get_viewport().get_mouse_position()
if player:
@@ -54,7 +57,7 @@ func _process(_delta):
and player.can_interact(inspected)
)
current_selected_item = player.inventory.get_item()
current_selected_item = player.data.inventory.get_item()
could_use_item = (
current_selected_item
@@ -76,22 +79,37 @@ func _process(_delta):
%ActionZone.queue_redraw()
update_card()
update_inspector()
func inspect(node : Node, info : Inspector.Info):
func inspect(node : Node):
if inspected and inspected != node and inspected.has_method("inspect"):
inspected.inspect(false)
inspected_info = info
inspected = node
inspected_changed.emit(inspected_info)
last_inspected = node
time_last_inspected = 0
if inspected.has_method("inspect"):
inspected.inspect(true)
update_inspector()
func update_card():
if not last_inspected or time_last_inspected > CARD_VISUALISATION_TIME:
%CardVisualiser.hide()
elif last_inspected != null and last_inspected is InspectableEntity:
%CardVisualiser.card_info = last_inspected.card_info()
%CardVisualiser.show()
var camera = get_viewport().get_camera_2d()
var screen_size = get_viewport().get_visible_rect().size
%CardPosition.position = last_inspected.global_position - camera.global_position + screen_size / 2
if %CardVisualiser.is_mouse_over():
time_last_inspected = 0.
func update_inspector():
%InspectorText.visible = inspected != null
if inspected and inspected is InspectableEntity:
%InspectorText.text = inspected.pointer_text()
if player:
if can_interact and inspected and inspected is Interactable:
@@ -118,6 +136,4 @@ func stop_inspect(node : Node):
node.inspect(false)
if inspected == node:
inspected = null
inspected_info = null
inspected_changed.emit(inspected_info)
update_inspector()

View File

@@ -1,6 +1,10 @@
[gd_resource type="Theme" load_steps=6 format=3 uid="uid://bgcmd213j6gk1"]
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://bgcmd213j6gk1"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_hv6r3"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="1_g7s0b"]
[ext_resource type="FontFile" uid="uid://c7k6ssq6ocwdk" path="res://gui/ressources/fonts/Ubuntu/Ubuntu-M.ttf" id="2_ab4w8"]
[ext_resource type="FontFile" uid="uid://3workc27eb0r" path="res://gui/ressources/fonts/Ubuntu/Ubuntu-B.ttf" id="3_36amo"]
[ext_resource type="FontFile" uid="uid://dxbmvk18hg103" path="res://gui/ressources/fonts/Ubuntu/Ubuntu-BI.ttf" id="4_feqcm"]
[ext_resource type="FontFile" uid="uid://bnmaweyw0kfcy" path="res://gui/ressources/fonts/Ubuntu/Ubuntu-MI.ttf" id="5_1lj4c"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hv6r3"]
bg_color = Color(0.976471, 0.741176, 0.4, 1)
@@ -15,12 +19,12 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_y48f0"]
bg_color = Color(0.886275, 0.623529, 0.196078, 1)
bg_color = Color(1, 0.6509804, 0.09019608, 1)
border_width_left = 10
border_width_top = 10
border_width_right = 10
border_width_bottom = 10
border_color = Color(0.886275, 0.623529, 0.196078, 1)
border_color = Color(1, 0.6509804, 0.09019608, 1)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
@@ -38,26 +42,35 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_g7s0b"]
bg_color = Color(0.0627451, 0.05882353, 0.16862746, 1)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_hv6r3"]
[resource]
Button/font_sizes/font_size = 25
Button/fonts/font = ExtResource("1_hv6r3")
Button/fonts/font = ExtResource("1_g7s0b")
Button/styles/hover = SubResource("StyleBoxFlat_hv6r3")
Button/styles/normal = SubResource("StyleBoxFlat_y48f0")
Button/styles/pressed = SubResource("StyleBoxFlat_st1o2")
GridContainer/constants/h_separation = 15
GridContainer/constants/v_separation = 15
HBoxContainer/constants/separation = 15
Label/fonts/font = ExtResource("2_ab4w8")
MarginContainer/constants/margin_bottom = 15
MarginContainer/constants/margin_left = 15
MarginContainer/constants/margin_right = 15
MarginContainer/constants/margin_top = 15
Panel/styles/panel = SubResource("StyleBoxFlat_g7s0b")
RichTextLabel/font_sizes/bold_font_size = 12
RichTextLabel/font_sizes/bold_italics_font_size = 12
RichTextLabel/font_sizes/italics_font_size = 12
RichTextLabel/font_sizes/mono_font_size = 12
RichTextLabel/font_sizes/normal_font_size = 12
RichTextLabel/fonts/bold_font = ExtResource("3_36amo")
RichTextLabel/fonts/bold_italics_font = ExtResource("4_feqcm")
RichTextLabel/fonts/italics_font = ExtResource("5_1lj4c")
RichTextLabel/fonts/normal_font = ExtResource("2_ab4w8")
VBoxContainer/constants/separation = 15
VSeparator/constants/separation = 15
VSeparator/styles/separator = SubResource("StyleBoxEmpty_hv6r3")

Binary file not shown.

View File

@@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://qt80w6o01q5s"
path="res://.godot/imported/TitanOne-Regular.ttf-9e2e4dbed700c72c7a3abf578595c39e.fontdata"
[deps]
source_file="res://gui/ressources/fonts/TitanOne-Regular.ttf"
dest_files=["res://.godot/imported/TitanOne-Regular.ttf-9e2e4dbed700c72c7a3abf578595c39e.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
modulate_color_glyphs=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,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://3workc27eb0r"
path="res://.godot/imported/Ubuntu-B.ttf-171a35e51fe4ca8ca138b3988a8d8d8a.fontdata"
[deps]
source_file="res://gui/ressources/fonts/Ubuntu/Ubuntu-B.ttf"
dest_files=["res://.godot/imported/Ubuntu-B.ttf-171a35e51fe4ca8ca138b3988a8d8d8a.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
modulate_color_glyphs=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,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://dxbmvk18hg103"
path="res://.godot/imported/Ubuntu-BI.ttf-9334c263e8e3de316cc010d019dac066.fontdata"
[deps]
source_file="res://gui/ressources/fonts/Ubuntu/Ubuntu-BI.ttf"
dest_files=["res://.godot/imported/Ubuntu-BI.ttf-9334c263e8e3de316cc010d019dac066.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
modulate_color_glyphs=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,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://c7k6ssq6ocwdk"
path="res://.godot/imported/Ubuntu-M.ttf-36be5f4f4ef3dc4145dbd922c285571b.fontdata"
[deps]
source_file="res://gui/ressources/fonts/Ubuntu/Ubuntu-M.ttf"
dest_files=["res://.godot/imported/Ubuntu-M.ttf-36be5f4f4ef3dc4145dbd922c285571b.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
modulate_color_glyphs=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,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bnmaweyw0kfcy"
path="res://.godot/imported/Ubuntu-MI.ttf-ca40c217d9e0441312ea36f046b3d722.fontdata"
[deps]
source_file="res://gui/ressources/fonts/Ubuntu/Ubuntu-MI.ttf"
dest_files=["res://.godot/imported/Ubuntu-MI.ttf-ca40c217d9e0441312ea36f046b3d722.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
modulate_color_glyphs=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,7 +1,7 @@
[gd_resource type="LabelSettings" load_steps=2 format=3 uid="uid://dqwayi8yjwau2"]
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_w0wva"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="1_lsdoq"]
[resource]
font = ExtResource("1_w0wva")
font_size = 25
font = ExtResource("1_lsdoq")
font_size = 30