rework l'ui et équilibrage général
This commit is contained in:
@@ -1,74 +1,16 @@
|
||||
[gd_scene load_steps=29 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=23 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"]
|
||||
[ext_resource type="Texture2D" uid="uid://cm3ehinvvj52i" path="res://gui/game/assets/texture/Interface sans boutons.png" id="3_n4kem"]
|
||||
[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="FontFile" uid="uid://qt80w6o01q5s" path="res://gui/ressources/fonts/TitanOne-Regular.ttf" id="5_2wykm"]
|
||||
[ext_resource type="Script" uid="uid://0dhj8sdpil7q" path="res://gui/tools/control_animation_player.gd" id="6_id0t5"]
|
||||
[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"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_id0t5"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.115169, 0.41573, 0.620786, 0.924157)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_ykapk"]
|
||||
gradient = SubResource("Gradient_id0t5")
|
||||
fill_to = Vector2(1, 1)
|
||||
repeat = 1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_l73to"]
|
||||
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(0.950568, 0, 0.346412, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_p6blc"]
|
||||
resource_name = "default"
|
||||
loop_mode = 1
|
||||
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, 0.5, 1.03333),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.950568, 0, 0.346412, 1), Color(0.999996, 0.39403, 0.49625, 1), Color(0.950568, 0, 0.346412, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_l3q4a"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_l73to"),
|
||||
&"default": SubResource("Animation_p6blc")
|
||||
}
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_dr1y2"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0, 0.697674)
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_h6540"]
|
||||
gradient = SubResource("Gradient_dr1y2")
|
||||
width = 50
|
||||
height = 50
|
||||
fill = 1
|
||||
fill_from = Vector2(0.504274, 0.5)
|
||||
|
||||
[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)
|
||||
@@ -181,34 +123,10 @@ _data = {
|
||||
|
||||
[sub_resource type="Animation" id="Animation_mbdxg"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("NoEnergyLeft:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -100)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_w16yr"]
|
||||
resource_name = "no_energy_left_appear"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("NoEnergyLeft:position")
|
||||
tracks/0/interp = 2
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.0666667, 0.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -100), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p0xoq"]
|
||||
_data = {
|
||||
@@ -216,58 +134,23 @@ _data = {
|
||||
&"no_energy_left_appear": SubResource("Animation_w16yr")
|
||||
}
|
||||
|
||||
[node name="GameGui" type="Control"]
|
||||
[node name="GameGui" type="CanvasLayer"]
|
||||
script = ExtResource("1_udau0")
|
||||
|
||||
[node name="ScoreParticles" type="Control" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 1
|
||||
script = ExtResource("1_udau0")
|
||||
|
||||
[node name="NoEnergyLeft" type="VBoxContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
modulate = Color(0.950568, 0, 0.346412, 1)
|
||||
layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_top = -100.0
|
||||
offset_bottom = 2.0
|
||||
grow_horizontal = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="NoEnergyLeft"]
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
layout_mode = 2
|
||||
texture = SubResource("GradientTexture2D_ykapk")
|
||||
expand_mode = 1
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="Label" type="Label" parent="NoEnergyLeft"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
text = "No energy left"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="BlinkAnimation" type="AnimationPlayer" parent="NoEnergyLeft"]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_l3q4a")
|
||||
}
|
||||
autoplay = "default"
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Announce" parent="." instance=ExtResource("4_h6540")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@@ -276,75 +159,86 @@ grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
|
||||
[node name="PlayerInfo" type="Control" parent="MarginContainer"]
|
||||
custom_minimum_size = Vector2(337, 160)
|
||||
[node name="EnergyInfo" type="HBoxContainer" parent="MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/separation = 0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="EnergyAnimationPlayer" type="Node" parent="MarginContainer/EnergyInfo"]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("6_id0t5")
|
||||
metadata/_custom_type_script = "uid://0dhj8sdpil7q"
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/EnergyInfo"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/margin_left = 0
|
||||
theme_override_constants/margin_top = -25
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_bottom = -15
|
||||
|
||||
[node name="Background" type="TextureRect" parent="MarginContainer/PlayerInfo"]
|
||||
[node name="EnergyCount" type="RichTextLabel" parent="MarginContainer/EnergyInfo/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
theme_override_fonts/normal_font = ExtResource("5_2wykm")
|
||||
theme_override_fonts/bold_font = ExtResource("5_2wykm")
|
||||
theme_override_fonts/bold_italics_font = ExtResource("5_2wykm")
|
||||
theme_override_fonts/italics_font = ExtResource("5_2wykm")
|
||||
theme_override_font_sizes/normal_font_size = 30
|
||||
theme_override_font_sizes/bold_font_size = 100
|
||||
bbcode_enabled = true
|
||||
text = "[b]X[/b] / X"
|
||||
fit_content = true
|
||||
autowrap_mode = 0
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="MarginContainer/EnergyInfo"]
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
texture = ExtResource("4_k4juk")
|
||||
expand_mode = 4
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="DayCount" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 0
|
||||
text = "Day 0"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuotaProgressBar" type="ProgressBar" parent="MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(400, 50)
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
rounded = true
|
||||
show_percentage = false
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/QuotaProgressBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("3_n4kem")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="EnergyInfo" type="HBoxContainer" parent="MarginContainer/PlayerInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.27299702
|
||||
anchor_top = 0.453125
|
||||
anchor_right = 0.27299702
|
||||
anchor_bottom = 0.496875
|
||||
offset_left = -44.0
|
||||
offset_top = -12.5
|
||||
offset_right = 44.0
|
||||
offset_bottom = 12.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Icon" type="TextureRect" parent="MarginContainer/PlayerInfo/EnergyInfo"]
|
||||
custom_minimum_size = Vector2(36.64, 0)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_k4juk")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="EnergyCount" type="Label" parent="MarginContainer/PlayerInfo/EnergyInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_nq5i2")
|
||||
text = "X/X"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuotaInfo" type="CenterContainer" parent="MarginContainer/PlayerInfo"]
|
||||
layout_mode = 0
|
||||
offset_left = 176.0
|
||||
offset_top = 83.0
|
||||
offset_right = 247.0
|
||||
offset_bottom = 133.0
|
||||
|
||||
[node name="QuotaProgressBar" type="TextureProgressBar" parent="MarginContainer/PlayerInfo/QuotaInfo"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.1801, 0.349497, 0.456794, 1)
|
||||
layout_mode = 2
|
||||
fill_mode = 4
|
||||
texture_progress = SubResource("GradientTexture2D_h6540")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/PlayerInfo/QuotaInfo"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 2
|
||||
alignment = 1
|
||||
|
||||
[node name="QuotaProgressText" type="Label" parent="MarginContainer/PlayerInfo/QuotaInfo/HBoxContainer"]
|
||||
[node name="QuotaProgressText" type="Label" parent="MarginContainer/VBoxContainer/QuotaProgressBar/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "X"
|
||||
@@ -352,7 +246,7 @@ label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/PlayerInfo/QuotaInfo/HBoxContainer"]
|
||||
[node name="TextureRect" type="TextureRect" parent="MarginContainer/VBoxContainer/QuotaProgressBar/HBoxContainer"]
|
||||
custom_minimum_size = Vector2(30, 30)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("7_id0t5")
|
||||
@@ -365,15 +259,6 @@ size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
alignment = 1
|
||||
|
||||
[node name="DayCount" type="Label" parent="MarginContainer/TopRightContent"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 0
|
||||
text = "Day 0"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Pause" type="Button" parent="MarginContainer/TopRightContent"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
@@ -390,7 +275,6 @@ size_flags_vertical = 8
|
||||
|
||||
[node name="PassDayFade" type="ColorRect" parent="."]
|
||||
physics_interpolation_mode = 0
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@@ -401,7 +285,6 @@ color = Color(0.0627451, 0.0588235, 0.168627, 0)
|
||||
|
||||
[node name="Effect" type="TextureRect" parent="."]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
@@ -118,14 +118,14 @@ alignment = 1
|
||||
[node name="Label" type="Label" parent="RewardChoiceContainer/Choice/VSplitContainer"]
|
||||
layout_mode = 2
|
||||
theme = SubResource("Theme_7fpy7")
|
||||
text = "Choose a reward"
|
||||
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 = "Discover new plants or evolve discovered ones"
|
||||
text = "REWARD_SCREEN_TEXT"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ChoicesContainer" type="HBoxContainer" parent="RewardChoiceContainer/Choice/VSplitContainer"]
|
||||
|
||||
@@ -1,32 +1,38 @@
|
||||
extends Control
|
||||
extends CanvasLayer
|
||||
class_name GameGui
|
||||
|
||||
const SCORE_ICON : Texture = preload("res://common/icons/growth.svg")
|
||||
|
||||
@export var quota_reward : QuotaReward
|
||||
|
||||
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.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)
|
||||
|
||||
planet_update(GameInfo.game_data.current_planet_data)
|
||||
player_update(GameInfo.game_data.player_data)
|
||||
planet_update(GameInfo.game_data.current_planet_data, false)
|
||||
player_update(GameInfo.game_data.player_data, false)
|
||||
inventory_update(GameInfo.game_data.player_data.inventory)
|
||||
|
||||
if not GameInfo.game_data.current_planet_data.is_quota_announced:
|
||||
await quota_reward.reward_chosen
|
||||
announce_quota(GameInfo.game_data.current_planet_data)
|
||||
GameInfo.game_data.current_planet_data.is_quota_announced = true
|
||||
%EnergyInfo.update_minimum_size()
|
||||
|
||||
|
||||
func _on_player_updated(player_data : PlayerData):
|
||||
player_update(player_data)
|
||||
|
||||
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
|
||||
func player_update(player_data : PlayerData, with_animation = true):
|
||||
var energy_count_text = "[b]%d[/b] / %d" % [player_data.energy, player_data.max_energy]
|
||||
|
||||
update_no_energy_left_info(player_data.energy)
|
||||
if energy_count_text != %EnergyCount.text and with_animation:
|
||||
%EnergyAnimationPlayer.bounce()
|
||||
%EnergyCount.text = energy_count_text
|
||||
%EnergyInfo.modulate = Color.WHITE if player_data.energy > 0 else Color.RED
|
||||
|
||||
func _on_inventory_updated(inventory : Inventory):
|
||||
inventory_update(inventory)
|
||||
@@ -37,26 +43,67 @@ func inventory_update(inventory : Inventory):
|
||||
func _on_planet_updated(planet_data : PlanetData):
|
||||
planet_update(planet_data)
|
||||
|
||||
func planet_update(planet_data : PlanetData):
|
||||
func planet_update(planet_data : PlanetData, with_animation = true):
|
||||
if planet_data:
|
||||
%DayCount.text = tr("%d_DAY_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",
|
||||
quota_progression_percent,
|
||||
0.5,
|
||||
|
||||
if with_animation:
|
||||
get_tree().create_tween().tween_property(
|
||||
%QuotaProgressBar,
|
||||
"value",
|
||||
quota_progression_percent,
|
||||
0.5,
|
||||
)
|
||||
else: %QuotaProgressBar.value = quota_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
|
||||
)
|
||||
|
||||
await get_tree().create_timer(0.3).timeout
|
||||
|
||||
func spawn_score_particle(
|
||||
from_position,
|
||||
to_position,
|
||||
duration
|
||||
):
|
||||
var sprite_particle = Sprite2D.new()
|
||||
sprite_particle.texture = SCORE_ICON
|
||||
%ScoreParticles.add_child(sprite_particle)
|
||||
sprite_particle.position = from_position
|
||||
|
||||
var tween = get_tree().create_tween()
|
||||
|
||||
tween.set_trans(Tween.TransitionType.TRANS_SPRING)
|
||||
|
||||
tween.tween_property(
|
||||
sprite_particle,
|
||||
"position",
|
||||
to_position,
|
||||
duration
|
||||
)
|
||||
|
||||
|
||||
await tween.finished
|
||||
sprite_particle.queue_free()
|
||||
|
||||
|
||||
func _on_player_action_tried_without_energy():
|
||||
$AnimationPlayer.play("no_energy_left")
|
||||
|
||||
func _on_pause_pressed():
|
||||
Pause.pause = true
|
||||
|
||||
|
||||
func _on_player_upgraded():
|
||||
$EffectAnimation.play("upgrade")
|
||||
|
||||
@@ -66,14 +113,6 @@ func _on_planet_pass_day_started(planet):
|
||||
await $PassDayAnimation.animation_finished
|
||||
$PassDayAnimation.speed_scale = 1
|
||||
|
||||
func update_no_energy_left_info(energy):
|
||||
if energy == 0 and not %NoEnergyLeft.visible:
|
||||
%NoEnergyLeft.visible = true
|
||||
$NoEnergyLeftAnimation.play("no_energy_left_appear")
|
||||
elif energy != 0 and %NoEnergyLeft.visible:
|
||||
%NoEnergyLeft.visible = false
|
||||
|
||||
|
||||
func _on_planet_new_quota_started(planet_data : PlanetData):
|
||||
planet_update(planet_data)
|
||||
await quota_reward.reward_chosen
|
||||
@@ -91,6 +130,6 @@ func _on_planet_pass_day_ended(planet:Planet):
|
||||
if planet.data.quota_days == 1:
|
||||
%Announce.announce(
|
||||
tr("LAST_DAY_FOR_REACHING_QUOTA"),
|
||||
str(roundi(planet.data.get_quota_score() - planet.garden.get_score())) + " garden score left",
|
||||
tr("%d_GARDEN_SCORE_LEFT") % [planet.data.get_quota_score() - planet.garden.get_score()],
|
||||
Announce.RED_COLOR
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ func _ready():
|
||||
func win(planet : Planet):
|
||||
visible = true
|
||||
get_tree().paused = true
|
||||
%WinTitle.text = tr("SCORE_%d") % str(roundi(planet.garden.get_score()))
|
||||
%WinTitle.text = tr("SCORE_%d") % roundi(planet.garden.get_score())
|
||||
|
||||
func _on_restart_pressed():
|
||||
GameInfo.game_data.reset_all()
|
||||
|
||||
@@ -63,13 +63,13 @@ horizontal_alignment = 1
|
||||
|
||||
[node name="ThanksTitle" type="Label" parent="Tutorial/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Thanks for playing"
|
||||
text = "THANKS_FOR_PLAYING"
|
||||
label_settings = ExtResource("3_0b3c6")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="ThanksText" type="Label" parent="Tutorial/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "We need your feedback! Give us your thoughts on the game on our Discord or in the comments section of the Itch page."
|
||||
text = "WIN_SCREEN_TEXT"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="Tutorial/VBoxContainer"]
|
||||
@@ -80,7 +80,7 @@ alignment = 1
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_cl67j")
|
||||
theme_override_font_sizes/font_size = 24
|
||||
text = "Join our Discord"
|
||||
text = "JOIN_OUR_DISCORD"
|
||||
uri = "https://discord.gg/VTFKvEvgfz"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Tutorial/VBoxContainer"]
|
||||
@@ -89,12 +89,12 @@ alignment = 1
|
||||
|
||||
[node name="Restart" type="Button" parent="Tutorial/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Restart"
|
||||
text = "RESTART"
|
||||
icon = ExtResource("4_8p3aj")
|
||||
|
||||
[node name="Quit" type="Button" parent="Tutorial/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Quit"
|
||||
text = "QUIT"
|
||||
icon = ExtResource("5_j3wid")
|
||||
|
||||
[connection signal="pressed" from="Tutorial/VBoxContainer/HBoxContainer/Restart" to="." method="_on_restart_pressed"]
|
||||
|
||||
@@ -7,4 +7,6 @@ func _ready():
|
||||
|
||||
func _on_start_pressed():
|
||||
GameInfo.game_data.current_planet_data = PlanetData.new()
|
||||
var preferred_language = OS.get_locale_language()
|
||||
TranslationServer.set_locale(preferred_language)
|
||||
get_tree().change_scene_to_file(start_scene_path)
|
||||
|
||||
@@ -30,10 +30,10 @@ process_mode = 3
|
||||
script = ExtResource("1_1pe2k")
|
||||
default_cursor = ExtResource("2_q4bvb")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
[node name="InspectorCanvasLayer" type="CanvasLayer" parent="."]
|
||||
layer = 128
|
||||
|
||||
[node name="Inspector" type="Control" parent="CanvasLayer"]
|
||||
[node name="Inspector" type="Control" parent="InspectorCanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
@@ -41,7 +41,7 @@ offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Container" type="VBoxContainer" parent="CanvasLayer/Inspector"]
|
||||
[node name="Container" type="VBoxContainer" parent="InspectorCanvasLayer/Inspector"]
|
||||
layout_mode = 0
|
||||
offset_left = 28.0
|
||||
offset_right = 134.0
|
||||
@@ -50,25 +50,25 @@ size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="Action" type="HBoxContainer" parent="CanvasLayer/Inspector/Container"]
|
||||
[node name="Action" type="HBoxContainer" parent="InspectorCanvasLayer/Inspector/Container"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MouseImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
|
||||
[node name="MouseImage" type="TextureRect" parent="InspectorCanvasLayer/Inspector/Container/Action"]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("3_pshoq")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ActionEnergyImage" type="TextureRect" parent="CanvasLayer/Inspector/Container/Action"]
|
||||
[node name="ActionEnergyImage" type="TextureRect" parent="InspectorCanvasLayer/Inspector/Container/Action"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_b4uwv")
|
||||
expand_mode = 2
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="ActionText" type="RichTextLabel" parent="CanvasLayer/Inspector/Container/Action"]
|
||||
[node name="ActionText" type="RichTextLabel" parent="InspectorCanvasLayer/Inspector/Container/Action"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
bbcode_enabled = true
|
||||
@@ -77,17 +77,17 @@ fit_content = true
|
||||
scroll_active = false
|
||||
autowrap_mode = 0
|
||||
|
||||
[node name="ActionZone" type="Sprite2D" parent="CanvasLayer/Inspector"]
|
||||
[node name="ActionZone" type="Sprite2D" parent="InspectorCanvasLayer/Inspector"]
|
||||
unique_name_in_owner = true
|
||||
z_index = 4096
|
||||
script = ExtResource("5_b4uwv")
|
||||
opacity = 0.4
|
||||
metadata/_custom_type_script = "uid://c60a1bjcuj4hd"
|
||||
|
||||
[node name="CardsCanvasLayer" type="CanvasLayer" parent="."]
|
||||
[node name="CardCanvasLayer" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
|
||||
[node name="CardPosition" type="Control" parent="CardsCanvasLayer"]
|
||||
[node name="CardPosition" type="Control" parent="CardCanvasLayer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 8
|
||||
@@ -99,7 +99,7 @@ grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="CardsCanvasLayer/CardPosition"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="CardCanvasLayer/CardPosition"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
@@ -117,7 +117,7 @@ theme_override_constants/margin_top = 0
|
||||
theme_override_constants/margin_right = 0
|
||||
theme_override_constants/margin_bottom = 0
|
||||
|
||||
[node name="CardVisualiser" parent="CardsCanvasLayer/CardPosition/MarginContainer" instance=ExtResource("6_7j4mj")]
|
||||
[node name="CardVisualiser" parent="CardCanvasLayer/CardPosition/MarginContainer" instance=ExtResource("6_7j4mj")]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(1, 1, 1, 0.5003133)
|
||||
material = SubResource("ShaderMaterial_6eft6")
|
||||
|
||||
@@ -133,7 +133,7 @@ func update_inspector():
|
||||
%ActionEnergyImage.visible = current_inspect.interaction_cost(player) != 0
|
||||
elif current_selected_item and current_selected_item.use_text() != "":
|
||||
%Action.visible = true
|
||||
%ActionText.text = current_selected_item.use_text() + (" (no energy left)" if not have_energy_to_use_item else "")
|
||||
%ActionText.text = current_selected_item.use_text() + (tr("NO_ENERGY_LEFT") if not have_energy_to_use_item else "")
|
||||
if can_use_item:
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
else :
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=11 format=3 uid="uid://bgcmd213j6gk1"]
|
||||
[gd_resource type="Theme" load_steps=13 format=3 uid="uid://bgcmd213j6gk1"]
|
||||
|
||||
[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"]
|
||||
@@ -45,6 +45,20 @@ 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="StyleBoxFlat" id="StyleBoxFlat_ab4w8"]
|
||||
bg_color = Color(0.03, 0.03, 0.03, 0.42745098)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_36amo"]
|
||||
bg_color = Color(1, 0.6509804, 0.09019608, 1)
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_hv6r3"]
|
||||
|
||||
[resource]
|
||||
@@ -62,6 +76,8 @@ MarginContainer/constants/margin_left = 15
|
||||
MarginContainer/constants/margin_right = 15
|
||||
MarginContainer/constants/margin_top = 15
|
||||
Panel/styles/panel = SubResource("StyleBoxFlat_g7s0b")
|
||||
ProgressBar/styles/background = SubResource("StyleBoxFlat_ab4w8")
|
||||
ProgressBar/styles/fill = SubResource("StyleBoxFlat_36amo")
|
||||
RichTextLabel/font_sizes/bold_font_size = 12
|
||||
RichTextLabel/font_sizes/bold_italics_font_size = 12
|
||||
RichTextLabel/font_sizes/italics_font_size = 12
|
||||
|
||||
63
gui/tools/control_animation_player.gd
Normal file
63
gui/tools/control_animation_player.gd
Normal file
@@ -0,0 +1,63 @@
|
||||
@tool
|
||||
extends Node
|
||||
class_name ControlAnimationPlayer
|
||||
|
||||
@onready var target : Control = get_parent()
|
||||
|
||||
@export_tool_button("Test Shake", "Callable") var shake_action = shake
|
||||
@export_tool_button("Test Bounce", "Callable") var bounce_action = bounce
|
||||
|
||||
func bounce(
|
||||
duration : float = 0.4,
|
||||
amount : float = 10,
|
||||
direction : Vector2 = Vector2.UP,
|
||||
transition_type: Tween.TransitionType = Tween.TransitionType.TRANS_BOUNCE,
|
||||
):
|
||||
await add_tween(
|
||||
"position",
|
||||
target.position + direction * amount,
|
||||
duration/2,
|
||||
transition_type
|
||||
).finished
|
||||
await add_tween(
|
||||
"position",
|
||||
target.position - direction * amount,
|
||||
duration/2,
|
||||
transition_type
|
||||
).finished
|
||||
|
||||
func shake(
|
||||
duration : float = 0.3,
|
||||
amount : float = 10,
|
||||
transition_type: Tween.TransitionType = Tween.TransitionType.TRANS_LINEAR,
|
||||
):
|
||||
await add_tween(
|
||||
"position",
|
||||
target.position + Vector2.RIGHT * amount/2,
|
||||
duration/3,
|
||||
transition_type
|
||||
).finished
|
||||
await add_tween(
|
||||
"position",
|
||||
target.position + Vector2.LEFT * amount,
|
||||
duration/3,
|
||||
transition_type
|
||||
).finished
|
||||
await add_tween(
|
||||
"position",
|
||||
target.position + Vector2.RIGHT * amount/2,
|
||||
duration/3,
|
||||
transition_type
|
||||
).finished
|
||||
|
||||
|
||||
func add_tween(
|
||||
property : String,
|
||||
value : Variant,
|
||||
seconds: float = 1.,
|
||||
transition_type: Tween.TransitionType = Tween.TransitionType.TRANS_LINEAR
|
||||
) -> Tween:
|
||||
var tween : Tween = get_tree().create_tween()
|
||||
tween.set_trans(transition_type)
|
||||
tween.tween_property(target, property, value, seconds)
|
||||
return tween
|
||||
1
gui/tools/control_animation_player.gd.uid
Normal file
1
gui/tools/control_animation_player.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://0dhj8sdpil7q
|
||||
Reference in New Issue
Block a user