équilibrage des quota et du jeu, changement du GUI pour rendre les objectifs de quotas plus visibles #72
This commit is contained in:
159
gui/game/announce/announce.tscn
Normal file
159
gui/game/announce/announce.tscn
Normal file
@@ -0,0 +1,159 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://fnv0qhkh40mv"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_0ssee"]
|
||||
[ext_resource type="Script" uid="uid://bvb4v66bqteuc" path="res://gui/game/announce/scripts/announce.gd" id="1_4evne"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_yrhd4"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_7nrno"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_vbart"]
|
||||
font = ExtResource("2_yrhd4")
|
||||
font_size = 50
|
||||
|
||||
[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_mnweq"]
|
||||
gradient = SubResource("Gradient_id0t5")
|
||||
fill_to = Vector2(1, 1)
|
||||
repeat = 1
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ok3ge"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("VBoxContainer/AnnounceTexture:custom_minimum_size")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("VBoxContainer:modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_871vo"]
|
||||
resource_name = "pass"
|
||||
length = 3.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [false, true, true, false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, 65), Vector2(0, 65), Vector2(0, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
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),
|
||||
"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)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_dvva5"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_ok3ge"),
|
||||
&"pass": SubResource("Animation_871vo")
|
||||
}
|
||||
|
||||
[node name="Announce" type="Control"]
|
||||
visible = false
|
||||
clip_contents = true
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_4evne")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
modulate = Color(1, 1, 1, 0)
|
||||
clip_contents = true
|
||||
layout_mode = 1
|
||||
anchors_preset = 14
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_top = -73.5
|
||||
offset_bottom = 73.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_0ssee")
|
||||
alignment = 1
|
||||
|
||||
[node name="AnnounceTitle" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "New Quota"
|
||||
label_settings = SubResource("LabelSettings_vbart")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="AnnounceTexture" type="TextureRect" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(0.886275, 0.623529, 0.196078, 1)
|
||||
layout_mode = 2
|
||||
texture = SubResource("GradientTexture2D_mnweq")
|
||||
expand_mode = 1
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="AnnounceText" type="Label" parent="VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Decontaminate 50 unit in 10 days"
|
||||
label_settings = ExtResource("3_7nrno")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_dvva5")
|
||||
}
|
||||
11
gui/game/announce/scripts/announce.gd
Normal file
11
gui/game/announce/scripts/announce.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
extends Control
|
||||
class_name Announce
|
||||
|
||||
const YELLOW_COLOR = Color("e29f32")
|
||||
const RED_COLOR = Color("f20058")
|
||||
|
||||
func announce(title : String, text : String, band_color : Color = YELLOW_COLOR):
|
||||
%AnnounceTitle.text = title
|
||||
%AnnounceText.text = text
|
||||
%AnnounceTexture.modulate = band_color
|
||||
%AnimationPlayer.play("pass")
|
||||
1
gui/game/announce/scripts/announce.gd.uid
Normal file
1
gui/game/announce/scripts/announce.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bvb4v66bqteuc
|
||||
@@ -1,8 +1,9 @@
|
||||
[gd_scene load_steps=27 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=28 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="PackedScene" uid="uid://d3lff5fui1k0c" path="res://gui/game/inspector/inspector.tscn" id="6_dr1y2"]
|
||||
@@ -260,6 +261,10 @@ libraries = {
|
||||
}
|
||||
autoplay = "default"
|
||||
|
||||
[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
|
||||
@@ -291,10 +296,10 @@ stretch_mode = 5
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.64095
|
||||
anchor_top = 0.640625
|
||||
anchor_right = 0.64095
|
||||
anchor_bottom = 0.684375
|
||||
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
|
||||
@@ -322,23 +327,22 @@ vertical_alignment = 1
|
||||
|
||||
[node name="QuotaInfo" type="CenterContainer" parent="MarginContainer/PlayerInfo"]
|
||||
layout_mode = 0
|
||||
offset_left = 55.0
|
||||
offset_top = 51.0
|
||||
offset_right = 126.0
|
||||
offset_bottom = 101.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
|
||||
value = 83.0
|
||||
fill_mode = 4
|
||||
texture_progress = SubResource("GradientTexture2D_h6540")
|
||||
|
||||
[node name="QuotaProgressText" type="Label" parent="MarginContainer/PlayerInfo/QuotaInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "100%"
|
||||
text = "X"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
@@ -393,10 +397,6 @@ layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 5.0
|
||||
offset_top = 2.0
|
||||
offset_right = 5.0
|
||||
offset_bottom = 2.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
@@ -15,6 +15,33 @@ shader_parameter/mix_percentage = 0.3
|
||||
font = ExtResource("3_5sqh2")
|
||||
font_size = 50
|
||||
|
||||
[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(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_4f1tl"]
|
||||
resource_name = "show"
|
||||
length = 0.3
|
||||
@@ -43,33 +70,6 @@ tracks/1/keys = {
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[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(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7fpy7"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_8323k"),
|
||||
|
||||
@@ -13,16 +13,17 @@ func _on_player_updated(player:Player):
|
||||
update_no_energy_left_info(player.energy)
|
||||
|
||||
func _on_planet_updated(planet:Planet):
|
||||
%DayCount.text = "Day " + str(planet.day) + "/" + str(planet.day_limit)
|
||||
%DayCount.text = str(planet.get_quota_remaining_days()) + " days left"
|
||||
|
||||
var quota_progression_percent : float = (planet.decontamination_surface - planet.surface_on_last_quota) / (planet.next_quota - planet.surface_on_last_quota) * 100
|
||||
%QuotaProgressText.text = str(roundi(quota_progression_percent)) + " %"
|
||||
get_tree().create_tween().tween_property(
|
||||
%QuotaProgressBar,
|
||||
"value",
|
||||
quota_progression_percent,
|
||||
0.5,
|
||||
)
|
||||
if planet.next_quota:
|
||||
var quota_progression_percent : float = (planet.decontamination_surface - planet.last_quota) / (planet.next_quota - planet.last_quota) * 100
|
||||
%QuotaProgressText.text = str(roundi(planet.decontamination_surface)) + "/" + str(roundi(planet.next_quota))
|
||||
get_tree().create_tween().tween_property(
|
||||
%QuotaProgressBar,
|
||||
"value",
|
||||
quota_progression_percent,
|
||||
0.5,
|
||||
)
|
||||
|
||||
func _on_player_action_tried_without_energy():
|
||||
$AnimationPlayer.play("no_energy_left")
|
||||
@@ -52,3 +53,25 @@ func update_no_energy_left_info(energy):
|
||||
$NoEnergyLeftAnimation.play("no_energy_left_appear")
|
||||
elif energy != 0 and %NoEnergyLeft.visible:
|
||||
%NoEnergyLeft.visible = false
|
||||
|
||||
|
||||
func _on_planet_new_quota_started(planet:Planet):
|
||||
%Announce.announce(
|
||||
"New Quota",
|
||||
"Reach " + str(roundi(planet.next_quota)) + " units before " + str(Planet.DEFAULT_DAY_LIMIT) + " days"
|
||||
)
|
||||
|
||||
func _on_planet_pass_day_ended(planet:Planet):
|
||||
var remaining_days = planet.get_quota_remaining_days()
|
||||
if remaining_days == 1:
|
||||
%Announce.announce(
|
||||
"Last day for reaching quota",
|
||||
str(roundi(planet.next_quota - planet.decontamination_surface)) + " units left to decontaminate",
|
||||
Announce.RED_COLOR
|
||||
)
|
||||
if remaining_days == 2:
|
||||
%Announce.announce(
|
||||
"2 days left before quota's ending",
|
||||
str(roundi(planet.next_quota - planet.decontamination_surface)) + " units left to decontaminate",
|
||||
Announce.YELLOW_COLOR
|
||||
)
|
||||
|
||||
@@ -3,12 +3,14 @@ extends Control
|
||||
func _ready():
|
||||
visible = false
|
||||
|
||||
func win(decontamination_surface : float):
|
||||
func win(planet : Planet):
|
||||
visible = true
|
||||
get_tree().paused = true
|
||||
%WinTitle.text = "Score : " + str(roundi(decontamination_surface)) + " m2"
|
||||
%WinTitle.text = "Score : " + str(roundi(planet.decontamination_surface))
|
||||
|
||||
func _on_restart_pressed():
|
||||
GameInfo.game_data.current_planet_data = null
|
||||
get_tree().paused = false
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
func _on_quit_pressed():
|
||||
@@ -16,4 +18,4 @@ func _on_quit_pressed():
|
||||
|
||||
|
||||
func _on_planet_day_limit_exceed(planet : Planet):
|
||||
win(planet.decontamination_surface)
|
||||
win(planet)
|
||||
|
||||
@@ -57,7 +57,7 @@ alignment = 1
|
||||
[node name="WinTitle" type="Label" parent="Tutorial/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Score : 2%"
|
||||
text = "Score : 10"
|
||||
label_settings = SubResource("LabelSettings_eq457")
|
||||
horizontal_alignment = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user