changement du scene manager, amélioration du cockpit et autres

* refonte du scene manager
* refonte du audio manager
* premier rework des plantes
* nettoyage des dossiers/fichiers
* renommage de planète en region
* fix des run
This commit is contained in:
2026-01-23 18:06:27 +01:00
parent 62b34473b6
commit 83d462f2f4
247 changed files with 2964 additions and 3159 deletions

View File

@@ -21,13 +21,7 @@ func update(
max_energy = _max_energy
var energy_count_text = "[b]%d[/b] / %d" % [energy, max_energy]
if with_animation:
%EnergyAnimationPlayer.bounce()
# if with_animation:
# %EnergyAnimationPlayer.bounce()
%EnergyCount.text = energy_count_text
modulate = Color.WHITE if energy > 0 else Color.RED
func appear():
await %EnergyAnimationPlayer.appear()
func disappear():
await %EnergyAnimationPlayer.disappear()
modulate = Color.WHITE if energy > 0 else Color.RED

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=3 uid="uid://12nak7amd1uq"]
[gd_scene load_steps=8 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/hud.tres" id="2_nq5i2"]
@@ -8,64 +8,6 @@
[ext_resource type="Texture2D" uid="uid://bt3g5bmar0icf" path="res://common/icons/growth.svg" id="7_id0t5"]
[ext_resource type="PackedScene" uid="uid://clicjf8ts51h8" path="res://gui/game/inventory_gui/inventory_gui.tscn" id="9_id0t5"]
[sub_resource type="Gradient" id="Gradient_2wykm"]
offsets = PackedFloat32Array(0, 0.279476, 1)
colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_id0t5"]
gradient = SubResource("Gradient_2wykm")
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="Animation" id="Animation_l3q4a"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_2wykm"]
resource_name = "upgrade"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2, 0.9),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Color(0.6, 0.580392, 0, 0), Color(0.600196, 0.581106, 0, 0.392157), Color(0.6, 0.580392, 0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_nhqnj"]
_data = {
&"RESET": SubResource("Animation_l3q4a"),
&"upgrade": SubResource("Animation_2wykm")
}
[sub_resource type="Animation" id="Animation_mbdxg"]
length = 0.001
[sub_resource type="Animation" id="Animation_w16yr"]
resource_name = "no_energy_left_appear"
length = 0.5
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p0xoq"]
_data = {
&"RESET": SubResource("Animation_mbdxg"),
&"no_energy_left_appear": SubResource("Animation_w16yr")
}
[node name="GameGui" type="CanvasLayer"]
script = ExtResource("1_udau0")
@@ -147,24 +89,3 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
[node name="Effect" type="TextureRect" parent="."]
modulate = Color(1, 1, 1, 0)
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = SubResource("GradientTexture2D_id0t5")
[node name="EffectAnimation" type="AnimationPlayer" parent="."]
root_node = NodePath("../Effect")
libraries = {
&"": SubResource("AnimationLibrary_nhqnj")
}
[node name="NoEnergyLeftAnimation" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_p0xoq")
}

View File

@@ -5,6 +5,10 @@ class_name InventoryGui
var inventory_item_objects: Array[InventoryGuiItem]
func _ready():
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:

View File

@@ -1,17 +1,19 @@
[gd_scene load_steps=6 format=3 uid="uid://yk78ubpu5ghq"]
[gd_scene load_steps=9 format=3 uid="uid://yk78ubpu5ghq"]
[ext_resource type="Script" uid="uid://2qomrdxbvxqa" path="res://gui/game/pass_day/scripts/pass_day.gd" id="1_0pm4g"]
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://common/vfx/materials/shaders/blur.gdshader" id="1_v570a"]
[ext_resource type="Script" uid="uid://i7glvbe8pdr8" path="res://gui/game/pass_day/scripts/pass_day_background.gd" id="2_bhfpo"]
[ext_resource type="PackedScene" uid="uid://brfsapvj2quxm" path="res://gui/game/energy_info/energy_info.tscn" id="2_feyaf"]
[ext_resource type="Theme" uid="uid://5au2k3vf2po3" path="res://gui/ressources/menu.tres" id="4_0pm4g"]
[ext_resource type="Script" uid="uid://0dhj8sdpil7q" path="res://gui/tools/control_animation_player.gd" id="5_dqmg8"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="6_dqmg8"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_27lg1"]
shader = ExtResource("1_v570a")
shader_parameter/strength = 0.1
shader_parameter/mix_percentage = 0.0
shader_parameter/strength = 10.0
shader_parameter/mix_percentage = 0.8
[node name="PassDay" type="Control"]
visible = false
z_index = 100
layout_mode = 3
anchors_preset = 15
@@ -33,18 +35,36 @@ grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("2_bhfpo")
blur_strength = 0.1
blur_strength = 10.0
blur_mix_percentage = 0.8
[node name="EnergyPassDayInfo" parent="." instance=ExtResource("2_feyaf")]
[node name="PassDayInfo" type="VBoxContainer" parent="."]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0)
layout_mode = 1
anchors_preset = 14
anchor_top = 0.5
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -37.5
offset_right = 0.0
offset_bottom = 37.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("4_0pm4g")
alignment = 1
[node name="PassDayInfoAnimationPlayer" type="Node" parent="PassDayInfo"]
unique_name_in_owner = true
script = ExtResource("5_dqmg8")
metadata/_custom_type_script = "uid://0dhj8sdpil7q"
[node name="EnergyPassDayInfo" parent="PassDayInfo" instance=ExtResource("2_feyaf")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
[node name="ChargeCount" type="Label" parent="PassDayInfo"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
text = "%d_CHARGE_LEFT"
label_settings = ExtResource("6_dqmg8")
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -4,8 +4,8 @@ class_name PassDay
const BLUR_STRENGTH = 10
const BLUR_MIX_PERCENTAGE = 0.8
const TIME_BY_ENERGY = 0.7
const TIME_MARGIN = 0.5
const TIME_BY_ENERGY = 0.3
const TIME_MARGIN = 0.2
signal max_energy_reached()
signal animation_appeared
@@ -26,7 +26,7 @@ var is_animation_disappeared := false
func _ready():
hide()
setup_energy_values()
%EnergyPassDayInfo.hide()
%PassDayInfo.hide()
func _process(delta):
if recharging:
@@ -48,6 +48,8 @@ func pass_day_animation():
setup_energy_values()
%ChargeCount.text = tr('%d_CHARGE_LEFT') % GameInfo.game_data.current_region_data.charges
is_animation_appeared=false
is_animation_disappeared=false
@@ -80,10 +82,10 @@ func appear():
BLUR_STRENGTH,
0.5
).finished
await %EnergyPassDayInfo.appear()
await %PassDayInfoAnimationPlayer.appear()
func disappear():
await %EnergyPassDayInfo.disappear()
await %PassDayInfoAnimationPlayer.disappear()
add_tween(
"blur_mix_percentage",
%Blur,

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://csiacsndm62ll"]
[gd_scene load_steps=16 format=3 uid="uid://csiacsndm62ll"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="1_51ks3"]
[ext_resource type="Script" uid="uid://crt2d4m5ba25i" path="res://gui/game/pause/scripts/pause.gd" id="1_he4ox"]
@@ -6,7 +6,6 @@
[ext_resource type="PackedScene" uid="uid://g6lbgg1fhc25" path="res://gui/menu/settings/settings.tscn" id="4_58dya"]
[ext_resource type="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="4_apjlw"]
[ext_resource type="Texture2D" uid="uid://vmsn54d1ptih" path="res://common/icons/player-play.svg" id="5_apjlw"]
[ext_resource type="Texture2D" uid="uid://bewr0t1wi8pff" path="res://common/icons/rotate.svg" id="6_58dya"]
[ext_resource type="Texture2D" uid="uid://cixd5j8yqpavg" path="res://common/icons/settings.svg" id="6_yj6f1"]
[ext_resource type="Texture2D" uid="uid://bkwhrq4sp5dcp" path="res://common/icons/device-gamepad.svg" id="7_7c7ks"]
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="7_yj6f1"]
@@ -148,11 +147,6 @@ layout_mode = 2
text = "CONTROLS"
icon = ExtResource("7_7c7ks")
[node name="Restart" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer"]
layout_mode = 2
text = "RESTART"
icon = ExtResource("6_58dya")
[node name="Quit" type="Button" parent="Container/MarginContainer/Pause/HBoxContainer"]
layout_mode = 2
text = "QUIT"
@@ -160,14 +154,10 @@ icon = ExtResource("7_yj6f1")
[node name="Settings" parent="." instance=ExtResource("4_58dya")]
unique_name_in_owner = true
visible = false
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 2
[node name="Controls" parent="." instance=ExtResource("11_urlqn")]
unique_name_in_owner = true
visible = false
mouse_filter = 2
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
@@ -179,5 +169,4 @@ libraries = {
[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Controls" to="." method="_on_controls_pressed"]
[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Restart" to="." method="_on_restart_pressed"]
[connection signal="pressed" from="Container/MarginContainer/Pause/HBoxContainer/Quit" to="." method="_on_quit_pressed"]

View File

@@ -12,6 +12,10 @@ func set_pause(p):
get_tree().paused = pause
%Settings.close_settings()
%Controls.close_controls()
if p :
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
elif SceneManager.actual_scene.mouse_captured:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(_event):
if Input.is_action_just_pressed("pause"):
@@ -20,11 +24,6 @@ func _input(_event):
func _on_resume_pressed():
pause = false
func _on_restart_pressed():
GameInfo.game_data.reset_all()
pause = false
SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN)
func _on_quit_pressed():
get_tree().quit()

View File

@@ -1,140 +0,0 @@
[gd_scene load_steps=10 format=3 uid="uid://doxm7uab8i3tq"]
[ext_resource type="Script" uid="uid://12kjdou2kp5y" path="res://gui/game/quota_reward/scripts/quota_reward.gd" id="1_gye62"]
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://common/vfx/materials/shaders/blur.gdshader" id="2_6ibex"]
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/hud.tres" id="3_x2kx4"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="4_trw0e"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gy0la"]
shader = ExtResource("2_6ibex")
shader_parameter/strength = 3.3
shader_parameter/mix_percentage = 0.3
[sub_resource type="Theme" id="Theme_7fpy7"]
[sub_resource type="Animation" id="Animation_8323k"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("RewardChoiceContainer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RewardChoiceContainer:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_4f1tl"]
resource_name = "show"
length = 0.3
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("RewardChoiceContainer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.033333335, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("RewardChoiceContainer:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.033333335),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7fpy7"]
_data = {
&"RESET": SubResource("Animation_8323k"),
&"show": SubResource("Animation_4f1tl")
}
[node name="RewardChoice" type="CanvasLayer"]
process_mode = 3
script = ExtResource("1_gye62")
[node name="RewardChoiceContainer" type="Control" parent="."]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0)
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="RewardChoiceContainer"]
material = SubResource("ShaderMaterial_gy0la")
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.0352941, 0.0196078, 0.12549, 0.705882)
[node name="Choice" type="MarginContainer" parent="RewardChoiceContainer"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("3_x2kx4")
theme_override_constants/margin_left = 30
theme_override_constants/margin_top = 30
theme_override_constants/margin_right = 30
theme_override_constants/margin_bottom = 30
[node name="VSplitContainer" type="VBoxContainer" parent="RewardChoiceContainer/Choice"]
layout_mode = 2
theme = ExtResource("3_x2kx4")
alignment = 1
[node name="Label" type="Label" parent="RewardChoiceContainer/Choice/VSplitContainer"]
layout_mode = 2
theme = SubResource("Theme_7fpy7")
text = "CHOOSE_A_REWARD"
label_settings = ExtResource("4_trw0e")
horizontal_alignment = 1
[node name="Label2" type="Label" parent="RewardChoiceContainer/Choice/VSplitContainer"]
layout_mode = 2
theme = ExtResource("3_x2kx4")
text = "REWARD_SCREEN_TEXT"
horizontal_alignment = 1
[node name="ChoicesContainer" type="HBoxContainer" parent="RewardChoiceContainer/Choice/VSplitContainer"]
unique_name_in_owner = true
layout_mode = 2
theme = ExtResource("3_x2kx4")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
&"": SubResource("AnimationLibrary_7fpy7")
}

View File

@@ -1,96 +0,0 @@
[gd_scene load_steps=20 format=3 uid="uid://caupeuds0holj"]
[ext_resource type="Script" uid="uid://bhhhw2ywxmmba" path="res://gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice.gd" id="1_5arw8"]
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="1_pjvy1"]
[ext_resource type="Script" uid="uid://dj2pv1hiwjfv0" path="res://gui/game/card/scripts/card_info.gd" id="2_0lvi7"]
[ext_resource type="PackedScene" uid="uid://3ss8pvhsackj" path="res://gui/game/card/card_visualiser.tscn" id="2_5arw8"]
[ext_resource type="Script" uid="uid://bist0wp4nrswp" path="res://gui/game/quota_reward/quota_reward_choice/scripts/quota_reward_choice_info.gd" id="2_hirys"]
[ext_resource type="Shader" uid="uid://bqjwmomh851lc" path="res://common/vfx/materials/shaders/skew.gdshader" id="3_07hub"]
[ext_resource type="Script" uid="uid://dgbh38j13g5kn" path="res://gui/game/card/scripts/card_section_info.gd" id="3_llc24"]
[ext_resource type="Texture2D" uid="uid://0hbdgalf04e" path="res://common/icons/wood.svg" id="4_llc24"]
[ext_resource type="Script" uid="uid://b4tkium34c831" path="res://gui/game/card/scripts/card_stat_info.gd" id="4_tsfju"]
[ext_resource type="Texture2D" uid="uid://bsvxhafoxwmw0" path="res://common/icons/cube-3d-sphere.svg" id="5_nnvhv"]
[sub_resource type="Resource" id="Resource_tsfju"]
script = ExtResource("3_llc24")
title_colored = true
title_text = "Hello"
title_icon = ExtResource("4_llc24")
text = "This is text"
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_llc24"]
script = ExtResource("3_llc24")
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_nnvhv"]
script = ExtResource("3_llc24")
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_rnvv6"]
script = ExtResource("3_llc24")
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_0or1o"]
script = ExtResource("3_llc24")
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_46ofu"]
script = ExtResource("3_llc24")
metadata/_custom_type_script = "uid://dgbh38j13g5kn"
[sub_resource type="Resource" id="Resource_3bvi2"]
script = ExtResource("2_0lvi7")
title = "Reward"
sections = Array[ExtResource("3_llc24")]([SubResource("Resource_tsfju"), SubResource("Resource_llc24"), SubResource("Resource_nnvhv"), SubResource("Resource_rnvv6"), SubResource("Resource_0or1o"), SubResource("Resource_46ofu")])
metadata/_custom_type_script = "uid://dj2pv1hiwjfv0"
[sub_resource type="Resource" id="Resource_apks8"]
script = ExtResource("2_hirys")
title = "One Reward"
text = "Je m"
card_info = SubResource("Resource_3bvi2")
metadata/_custom_type_script = "uid://bist0wp4nrswp"
[sub_resource type="ShaderMaterial" id="ShaderMaterial_llc24"]
shader = ExtResource("3_07hub")
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
[node name="QuotaRewardChoice" type="VBoxContainer"]
size_flags_horizontal = 3
size_flags_vertical = 3
mouse_filter = 0
alignment = 1
script = ExtResource("1_5arw8")
info = SubResource("Resource_apks8")
[node name="QuotaRewardTitle" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 2
text = "One Reward"
label_settings = ExtResource("1_pjvy1")
horizontal_alignment = 1
[node name="QuotaRewardText" type="RichTextLabel" parent="."]
unique_name_in_owner = true
layout_mode = 2
bbcode_enabled = true
text = "Je m"
fit_content = true
horizontal_alignment = 1
[node name="QuotaRewardCenterContainer" type="CenterContainer" parent="."]
layout_mode = 2
[node name="QuotaRewardCard" parent="QuotaRewardCenterContainer" instance=ExtResource("2_5arw8")]
unique_name_in_owner = true
material = SubResource("ShaderMaterial_llc24")
layout_mode = 2
small_mode = false
interactive_small_mode = false
down_arrow = false
card_info = SubResource("Resource_3bvi2")

View File

@@ -1,30 +0,0 @@
@tool
extends VBoxContainer
class_name QuotaRewardChoice
signal card_clicked(c : VBoxContainer)
var is_ready = false
@export var info : QuotaRewardChoiceInfo = null :
set(v):
info = v
if is_ready : update()
@export_tool_button("Update", "Callable") var update_action = update
func _ready():
update()
%QuotaRewardCard.clicked.connect(
func (_c : CardVisualiser):
card_clicked.emit(self)
)
is_ready = true
func update():
if info:
%QuotaRewardTitle.text = info.title
%QuotaRewardText.text = info.text
%QuotaRewardCard.card_info = info.card_info
%QuotaRewardCard.update()

View File

@@ -1,8 +0,0 @@
extends Resource
class_name QuotaRewardChoiceInfo
@export var title : String = ""
@export var text : String = ""
@export var card_info : CardInfo = null

View File

@@ -1,124 +0,0 @@
@tool
extends CanvasLayer
class_name QuotaReward
const REWARD_CHOICE_SCENE : PackedScene = preload("res://gui/game/quota_reward/quota_reward_choice/quota_reward_choice.tscn")
signal reward_chosen
var showing_rewards: bool = false
var rewards : Array[QuotaReward.RewardData] = []
func _ready():
%RewardChoiceContainer.visible = false
func show_rewards():
showing_rewards = true
get_tree().paused = true
%AnimationPlayer.play("show")
func hide_rewards():
showing_rewards = false
get_tree().paused = false
%AnimationPlayer.play_backwards("show")
func generate_rewards(nb : int = 3):
var new_rewards : Array[QuotaReward.RewardData] = []
var max_retry = 20
while len(new_rewards) < nb or max_retry < 0:
max_retry -= 1
var new_reward = (
generate_discover_plant_reward()
if len(GameInfo.game_data.unlocked_plant_types) == 0 or randi() % 2 == 0
else generate_evolution_plant_reward()
)
if new_rewards.find_custom(func(r): return r.reward_info().title == new_reward.reward_info().title) == -1:
new_rewards.append(new_reward)
else :
max_retry -= 1
rewards = new_rewards
func generate_rewards_choices():
for c in %ChoicesContainer.get_children():
c.queue_free()
for r in rewards:
var reward_choice : QuotaRewardChoice = REWARD_CHOICE_SCENE.instantiate() as QuotaRewardChoice
reward_choice.info = r.reward_info()
reward_choice.card_clicked.connect(
func (_c):
if showing_rewards: choose_reward(r)
)
%ChoicesContainer.add_child(reward_choice)
func generate_discover_plant_reward() -> RewardData:
return DiscoverPlantReward.new(
GameInfo.game_data.get_locked_plant_types().pick_random()
)
func generate_evolution_plant_reward() -> RewardData:
return EvolvePlantReward.new(
GameInfo.game_data.unlocked_plant_types.pick_random().get_available_evolution().pick_random()
)
func choose_reward(r : RewardData):
r.reward()
reward_chosen.emit()
hide_rewards()
func trigger_reward():
generate_rewards()
generate_rewards_choices()
show_rewards()
class RewardData:
func reward_info() -> QuotaRewardChoiceInfo:
return null
func reward():
pass
class DiscoverPlantReward extends RewardData:
var new_plant_type : PlantType
func _init(_new_plant_type):
new_plant_type = _new_plant_type
func reward_info() -> QuotaRewardChoiceInfo:
var info = QuotaRewardChoiceInfo.new()
info.title = tr("DISCOVER_%s") % new_plant_type.name
info.text = tr("%s_SEEDS_CAN_NOW_BE_FOUND") % new_plant_type.name
info.card_info = new_plant_type.card_info()
return info
func reward():
GameInfo.game_data.unlock_plant_type(new_plant_type)
class EvolvePlantReward extends RewardData:
var plant_evolution : PlantType.Evolution
func _init(_plant_evolution):
plant_evolution = _plant_evolution
func reward_info() -> QuotaRewardChoiceInfo:
var info = QuotaRewardChoiceInfo.new()
info.title = tr("EVOLVE_%s") % plant_evolution.plant_type.name
info.text = plant_evolution.get_description()
var preview_evolved_plant = plant_evolution.plant_type.duplicate_deep()
plant_evolution.evolve(preview_evolved_plant)
info.card_info = preview_evolved_plant.card_info()
return info
func reward():
plant_evolution.evolve()

View File

@@ -1 +0,0 @@
uid://12kjdou2kp5y

View File

@@ -3,15 +3,21 @@ class_name GameGui
const SCORE_ICON : Texture = preload("res://common/icons/growth.svg")
func _ready():
GameInfo.game_data.current_planet_data.updated.connect(_on_planet_updated)
GameInfo.game_data.current_planet_data.plant_gaining_score.connect(_on_plant_gaining_score)
GameInfo.game_data.player_data.updated.connect(_on_player_updated)
GameInfo.game_data.player_data.inventory.updated.connect(_on_inventory_updated)
var score_mirror :
set(v):
score_mirror = v
score_update(true)
planet_update(GameInfo.game_data.current_planet_data, false)
func _ready():
GameInfo.game_data.current_region_data.updated.connect(_on_region_updated)
GameInfo.game_data.current_region_data.plant_changing_score.connect(_on_plant_changing_score)
GameInfo.game_data.player_data.updated.connect(_on_player_updated)
GameInfo.game_data.current_region_data.pass_day_ended.connect(_on_region_pass_day_ended)
score_mirror = GameInfo.game_data.current_region_data.get_score()
charge_update(GameInfo.game_data.current_region_data)
player_update(GameInfo.game_data.player_data, false)
inventory_update(GameInfo.game_data.player_data.inventory)
%EnergyInfo.reset_size()
func _on_player_updated(player_data : PlayerData):
@@ -24,49 +30,49 @@ func player_update(player_data : PlayerData, with_animation = true):
with_animation
)
func _on_inventory_updated(inventory : Inventory):
inventory_update(inventory)
func _on_region_updated(region_data : RegionData):
charge_update(region_data)
func inventory_update(inventory : Inventory):
%Inventory.update(inventory)
func charge_update(region_data : RegionData):
%ChargeCount.text = tr("%d_CHARGE_LEFT") % (region_data.charges)
func _on_planet_updated(planet_data : PlanetData):
planet_update(planet_data)
func score_update(with_animation = true):
var objective = GameInfo.game_data.current_region_data.objective
var objective_progression_percent : float = (float(score_mirror) / float(objective)) * 100
%ObjectiveProgressText.text = "%d/%d" % [score_mirror, objective]
func planet_update(planet_data : PlanetData, with_animation = true):
if planet_data:
%ChargeCount.text = tr("%d_CHARGE_LEFT") % (planet_data.charges)
var objective_progression_percent : float = (float(planet_data.garden_score) / float(planet_data.objective)) * 100
%ObjectiveProgressText.text = "%d/%d" % [planet_data.garden_score, planet_data.objective]
if with_animation:
get_tree().create_tween().tween_property(
%QuotaProgressBar,
"value",
objective_progression_percent,
0.5,
)
else: %QuotaProgressBar.value = objective_progression_percent
func _on_plant_gaining_score(plant: Plant, amount : int):
for i in range(amount):
var camera = get_viewport().get_camera_2d()
var screen_size = get_viewport().get_visible_rect().size
spawn_score_particle(
plant.global_position - camera.global_position + screen_size / 2,
%QuotaProgressBar.global_position + %QuotaProgressBar.size / 2,
0.8
if with_animation:
get_tree().create_tween().tween_property(
%QuotaProgressBar,
"value",
objective_progression_percent,
0.5,
)
else: %QuotaProgressBar.value = objective_progression_percent
await get_tree().create_timer(0.3 / max(1,i)).timeout
func _on_plant_changing_score(plant_data: PlantData, amount : int):
if amount <= 0:
score_mirror += amount
else :
for i in range(amount):
var camera = get_viewport().get_camera_2d()
var screen_size = get_viewport().get_visible_rect().size
spawn_score_particle(
plant_data.position - camera.global_position + screen_size / 2,
%QuotaProgressBar.global_position + %QuotaProgressBar.size / 2,
0.8
)
await get_tree().create_timer(0.3 / max(1,i)).timeout
func spawn_score_particle(
from_position,
to_position,
duration
):
if GameInfo.game_data.current_region_data.in_passing_day_animation:
await GameInfo.game_data.current_region_data.pass_day_ended
var sprite_particle = Sprite2D.new()
sprite_particle.texture = SCORE_ICON
%ScoreParticles.add_child(sprite_particle)
@@ -85,6 +91,8 @@ func spawn_score_particle(
await tween.finished
score_mirror += 1
sprite_particle.queue_free()
@@ -94,13 +102,10 @@ func _on_player_action_tried_without_energy():
func _on_player_upgraded():
$EffectAnimation.play("upgrade")
func _on_planet_pass_day_started(_planet):
%PassDay.pass_day_animation()
func _on_planet_pass_day_ended(planet:Planet):
if planet.data.charges == 1:
func _on_region_pass_day_ended(region:Region):
if region.data.charges == 1:
%Announce.announce(
tr("LAST_RECHARGE"),
tr("%d_GARDEN_SCORE_LEFT") % [planet.data.objective - planet.garden.get_score()],
tr("%d_GARDEN_SCORE_LEFT") % [region.data.objective - region.garden.get_score()],
Announce.RED_COLOR
)

View File

@@ -6,13 +6,13 @@ class_name InGameBaseIndicator
# Called when the node enters the scene tree for the first time.
func _ready():
setup(tr("GARDEN"))
follow_game_position(Planet.CHUNK_SIZE / 2. * Vector2.ONE)
follow_game_position(Region.CHUNK_SIZE / 2. * Vector2.ONE)
func _process(_delta):
visible = player and (
player.global_position.x < 0
or player.global_position.x > Planet.CHUNK_SIZE
or player.global_position.x > Region.CHUNK_SIZE
or player.global_position.y < 0
or player.global_position.y > Planet.CHUNK_SIZE
or player.global_position.y > Region.CHUNK_SIZE
)
update()

View File

@@ -5,7 +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
@export var region : Region
@onready var steps : Array[Step] = [
TakeShovelStep.new(),
@@ -19,18 +19,18 @@ var indicators : Array[InGameIndicator]
var actual_step : Step = null : set = pass_to_step
func _process(_d):
if not GameInfo.game_data.tutorial_done:
if not actual_step and planet.data.tutorial_step < len(steps):
if region.data.tutorial:
if not actual_step and region.data.tutorial_step < len(steps):
destroy_indicators()
pass_to_step(steps[planet.data.tutorial_step])
pass_to_step(steps[region.data.tutorial_step])
if player and actual_step and actual_step.is_step_over(player, planet):
if player and actual_step and actual_step.is_step_over(player, region):
destroy_indicators()
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
region.data.tutorial_step += 1
if region.data.tutorial_step < len(steps):
pass_to_step(steps[region.data.tutorial_step])
else:
destroy_indicators()
func destroy_indicators():
for i in indicators:
@@ -39,7 +39,7 @@ func destroy_indicators():
func pass_to_step(new_step : Step):
actual_step = new_step
indicators = new_step.generate_indicators(player, planet)
indicators = new_step.generate_indicators(player, region)
for i in indicators:
add_child(i)
@@ -51,15 +51,15 @@ class Step:
)
return new_indicator
func generate_indicators(_player : Player, _planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(_player : Player, _region : Region) -> Array[InGameIndicator]:
return []
func is_step_over(_p : Player, _planet : Planet) -> bool:
func is_step_over(_p : Player, _region : Region) -> bool:
return true
class TakeShovelStep extends Step:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
for entity in region.entity_container.get_children():
if entity is ItemObject and entity.item is Shovel:
var indicator = generate_indicator(tr("TAKE_THE_SHOVEL"))
indicator.follow_entity(entity)
@@ -69,14 +69,14 @@ class TakeShovelStep extends Step:
printerr("No Shovel found...")
return []
func is_step_over(p : Player, _planet : Planet) -> bool:
func is_step_over(p : Player, _region : Region) -> bool:
for item in p.data.inventory.items:
if item is Shovel:
return true
return false
class DigSeedStep extends Step:
func generate_indicators(p: Player, planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]:
var closest_seed = null
var limit_distance = 1000
@@ -87,7 +87,7 @@ class DigSeedStep extends Step:
for x in range(actual_distance):
for y in range(actual_distance):
var coord = Vector2i(x,y) - Vector2i.ONE * floori(actual_distance/2.) + player_tile
if planet.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL:
if region.rock_layer.get_tile_type(coord) == RockLayer.TileType.CRISTAL:
if closest_seed == null or player_tile.distance_to(coord) < player_tile.distance_to(closest_seed):
closest_seed = coord
@@ -95,20 +95,20 @@ class DigSeedStep extends Step:
if closest_seed:
var indicator = generate_indicator(tr("DIG_UNDERGROUND_LOOT"))
indicator.follow_game_position(closest_seed * Planet.TILE_SIZE + Vector2i.ONE * floori(Planet.TILE_SIZE/2.))
indicator.follow_game_position(closest_seed * Region.TILE_SIZE + Vector2i.ONE * floori(Region.TILE_SIZE/2.))
return [indicator]
return []
func is_step_over(_p : Player, planet : Planet) -> bool:
for entity in planet.entity_container.get_children():
func is_step_over(_p : Player, region : Region) -> bool:
for entity in region.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, planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
var indicators : Array[InGameIndicator] = []
for entity in planet.entity_container.get_children():
for entity in region.entity_container.get_children():
if entity is ItemObject and entity.item is Seed:
var indicator = generate_indicator(tr("TAKE_A_SEED"))
indicator.follow_entity(entity)
@@ -117,27 +117,27 @@ class TakeSeedStep extends Step:
)
return indicators
func is_step_over(p : Player, _planet : Planet) -> bool:
func is_step_over(p : Player, _region : Region) -> 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, planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(p: Player, region : Region) -> Array[InGameIndicator]:
var indicator = generate_indicator(tr("PLANT_THE_SEED_IN_DECONTAMINED_ZONE"))
indicator.follow_game_position(Planet.CHUNK_TILE_SIZE/2. * Planet.TILE_SIZE * Vector2.ONE)
indicator.follow_game_position(Region.CHUNK_TILE_SIZE/2. * Region.TILE_SIZE * Vector2.ONE)
return [indicator]
func is_step_over(_p : Player, planet : Planet) -> bool:
for entity in planet.entity_container.get_children():
func is_step_over(_p : Player, region : Region) -> bool:
for entity in region.entity_container.get_children():
if entity is Plant:
return true
return false
class RechargeStep extends Step:
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
for entity in planet.entity_container.get_children():
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
for entity in region.entity_container.get_children():
var indicator = generate_indicator(tr("RECHARGE_TO_PASS_DAYS"))
indicator.follow_entity(entity)
if entity is TruckRecharge:
@@ -147,20 +147,20 @@ class RechargeStep extends Step:
printerr("No Recharge Station found...")
return []
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
func is_step_over(_p : Player, region : Region) -> bool:
if region == null :
return false
return planet.data.day > 1
return region.data.day > 1
class WaitMaturePlant extends Step:
func generate_indicators(_p: Player, _planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, _region : Region) -> Array[InGameIndicator]:
return []
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
func is_step_over(_p : Player, region : Region) -> bool:
if region == null :
return false
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
for entity in region.entity_container.get_children():
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
return true
return false
@@ -168,10 +168,10 @@ class HarvestMaturePlant extends Step:
var mature_plant_number : int = 0
func generate_indicators(_p: Player, planet : Planet) -> Array[InGameIndicator]:
func generate_indicators(_p: Player, region : Region) -> Array[InGameIndicator]:
var indicators : Array[InGameIndicator] = []
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
for entity in region.entity_container.get_children():
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
var indicator = generate_indicator(tr("HARVEST_MATURE_PLANTS_WITH_SHOVEL"))
indicator.follow_entity(entity)
indicators.append(
@@ -180,11 +180,11 @@ class HarvestMaturePlant extends Step:
mature_plant_number += 1
return indicators
func is_step_over(_p : Player, planet : Planet) -> bool:
if planet == null :
func is_step_over(_p : Player, region : Region) -> bool:
if region == null :
return false
var actual_mature_plant_number = 0
for entity in planet.entity_container.get_children():
if entity is Plant and entity.state == Plant.State.MATURE:
for entity in region.entity_container.get_children():
if entity is Plant and entity.data.get_state() == PlantData.State.MATURE:
actual_mature_plant_number += 1
return mature_plant_number != actual_mature_plant_number

View File

@@ -5,19 +5,19 @@ extends Control
func _ready():
visible = false
func win(planet : Planet):
func win(region : Region):
visible = true
get_tree().paused = true
%WinTitle.text = tr("SCORE_%d") % roundi(planet.garden.get_score())
%WinTitle.text = tr("SCORE_%d") % roundi(region.garden.get_score())
func _on_restart_pressed():
GameInfo.game_data.reset_all()
get_tree().paused = false
SceneManager.change_scene(SceneManager.REGION_SELECTION_SCREEN)
SceneManager.change_scene("REGION_SELECTION")
func _on_quit_pressed():
get_tree().quit()
func _on_planet_day_limit_exceed(planet : Planet):
win(planet)
func _on_region_day_limit_exceed(region : Region):
win(region)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 KiB

View File

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

View File

@@ -1,6 +0,0 @@
extends Node
@export_file var start_scene_path : String
func _ready():
SceneManager.change_scene(start_scene_path)

View File

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

View File

@@ -72,7 +72,7 @@ func _process(delta):
can_use_item = could_use_item and have_energy_to_use_item
if current_selected_item:
if current_selected_item and SceneManager.actual_scene.scene_id == "REGION":
%ActionZone.radius = current_selected_item.usage_zone_radius
%ActionZone.color = ZONE_ACTIVATED_COLOR if can_use_item else ZONE_DEACTIVATED_COLOR
else:

View File

@@ -173,6 +173,7 @@ func bounce(
transition_type
).finished
end_anim()
target.position = target_default_pos
func shake(
duration : float = 0.3,