refactor du code et ajouts des quotas, avec des récompense entre chaque quota #68
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=25 format=3 uid="uid://12nak7amd1uq"]
|
||||
[gd_scene load_steps=27 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"]
|
||||
@@ -55,6 +55,18 @@ _data = {
|
||||
&"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)
|
||||
@@ -202,7 +214,7 @@ _data = {
|
||||
&"no_energy_left_appear": SubResource("Animation_w16yr")
|
||||
}
|
||||
|
||||
[node name="RootGui" type="Control"]
|
||||
[node name="GameGui" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -279,10 +291,10 @@ stretch_mode = 5
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.267062
|
||||
anchor_top = 0.453125
|
||||
anchor_right = 0.267062
|
||||
anchor_bottom = 0.496875
|
||||
anchor_left = 0.64095
|
||||
anchor_top = 0.640625
|
||||
anchor_right = 0.64095
|
||||
anchor_bottom = 0.684375
|
||||
offset_left = -44.0
|
||||
offset_top = -12.5
|
||||
offset_right = 44.0
|
||||
@@ -308,13 +320,24 @@ label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DecontaminationCoverage" type="Label" parent="MarginContainer/PlayerInfo"]
|
||||
unique_name_in_owner = true
|
||||
[node name="QuotaInfo" type="CenterContainer" parent="MarginContainer/PlayerInfo"]
|
||||
layout_mode = 0
|
||||
offset_left = 157.0
|
||||
offset_top = 86.0
|
||||
offset_right = 291.0
|
||||
offset_bottom = 126.0
|
||||
offset_left = 55.0
|
||||
offset_top = 51.0
|
||||
offset_right = 126.0
|
||||
offset_bottom = 101.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%"
|
||||
label_settings = ExtResource("4_ujg5r")
|
||||
horizontal_alignment = 1
|
||||
@@ -370,6 +393,10 @@ 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
|
||||
|
||||
@@ -1,18 +1,86 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://csiacsndm62ll"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://csiacsndm62ll"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_51ks3"]
|
||||
[ext_resource type="Script" uid="uid://crt2d4m5ba25i" path="res://gui/game/pause/scripts/pause.gd" id="1_he4ox"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_8d1kg"]
|
||||
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://gui/game/pause/resources/blur.gdshader" id="2_apjlw"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_0pdto"]
|
||||
[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://dex283rx00fjb" path="res://common/icons/logout.svg" id="7_yj6f1"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_58dya"]
|
||||
shader = ExtResource("2_apjlw")
|
||||
shader_parameter/strength = 3.3
|
||||
shader_parameter/mix_percentage = 0.3
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_apjlw"]
|
||||
font = ExtResource("2_8d1kg")
|
||||
font_size = 50
|
||||
|
||||
[sub_resource type="Animation" id="Animation_58dya"]
|
||||
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, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_apjlw"]
|
||||
resource_name = "pause"
|
||||
length = 0.3
|
||||
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),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [false, true]
|
||||
}
|
||||
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.0333333, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_yj6f1"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_58dya"),
|
||||
&"pause": SubResource("Animation_apjlw")
|
||||
}
|
||||
|
||||
[node name="Pause" type="Control"]
|
||||
visible = false
|
||||
z_index = 10
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
@@ -23,6 +91,7 @@ grow_vertical = 2
|
||||
script = ExtResource("1_he4ox")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_58dya")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -101,6 +170,12 @@ layout_mode = 2
|
||||
text = "Quit"
|
||||
icon = ExtResource("7_yj6f1")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
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"]
|
||||
|
||||
44
gui/game/pause/resources/blur.gdshader
Normal file
44
gui/game/pause/resources/blur.gdshader
Normal file
@@ -0,0 +1,44 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D SCREEN_TEXTURE: hint_screen_texture,repeat_disable, filter_nearest;
|
||||
/**
|
||||
* How blurry the result should be.
|
||||
* Limited to 20 because of performance, if you want feel free to break it.
|
||||
*/
|
||||
uniform float strength : hint_range(0.1, 20.0) = 3.3;
|
||||
/**
|
||||
* How dark the blur will be
|
||||
*/
|
||||
uniform float mix_percentage: hint_range(0.0, 1.0) = 0.3;
|
||||
|
||||
float gaussianDistribution(float x, float STD){ // STD stands for standard deviation
|
||||
return exp(-(x*x)/(2.*STD*STD))/(sqrt(2.*PI)*STD);
|
||||
}
|
||||
|
||||
vec3 gaussianblur(sampler2D sampler, vec2 pos, vec2 pixel_size, float sigmaUsed, int radius){
|
||||
vec3 blurredPixel = vec3(0.0);
|
||||
float total_weight = 0.0;
|
||||
// Loop over the radius (tecnically its a square)
|
||||
for(int i = -radius ; i <= radius; i++){
|
||||
for(int j = -radius; j <= radius; j++){
|
||||
// Calculate the offset from the current pixel
|
||||
vec2 offset = vec2(float(i), float(j))*pixel_size;
|
||||
vec2 changedPos = pos + offset;
|
||||
|
||||
// Calculate the weight based on the Gaussian distribution multiplying both dimentions (how far are X and Y form the center (pos))
|
||||
float weight = gaussianDistribution(float(i), sigmaUsed)*gaussianDistribution(float(j), sigmaUsed);
|
||||
// Add the weighted color value to the blurred pixel
|
||||
blurredPixel += texture(SCREEN_TEXTURE, changedPos).rgb * weight;
|
||||
total_weight += weight;
|
||||
}
|
||||
}
|
||||
// Normalize the blurred pixel color by the total weight
|
||||
blurredPixel/=total_weight;
|
||||
return blurredPixel;
|
||||
}
|
||||
void fragment() {
|
||||
vec3 PixelBlurred = gaussianblur(SCREEN_TEXTURE, SCREEN_UV, SCREEN_PIXEL_SIZE, strength, int(round(3.0 * strength)));
|
||||
vec3 color = mix(PixelBlurred, vec3(0.0), mix_percentage);
|
||||
// The radius is 3*strength because it is the point where the Gaussian weight is near zero.
|
||||
COLOR = vec4(color, 1.);
|
||||
}
|
||||
1
gui/game/pause/resources/blur.gdshader.uid
Normal file
1
gui/game/pause/resources/blur.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cuni3ggtw2uuy
|
||||
@@ -1,13 +1,16 @@
|
||||
extends Control
|
||||
|
||||
var pause = false :
|
||||
set(v):
|
||||
pause = v
|
||||
visible = pause
|
||||
get_tree().paused = pause
|
||||
var pause = false : set = set_pause
|
||||
|
||||
func set_pause(p):
|
||||
if p != pause:
|
||||
if p:
|
||||
%AnimationPlayer.play("pause")
|
||||
else:
|
||||
%AnimationPlayer.play_backwards("pause")
|
||||
pause = p
|
||||
get_tree().paused = pause
|
||||
|
||||
func _ready():
|
||||
pause = true
|
||||
|
||||
func _input(_event):
|
||||
if Input.is_action_just_pressed("pause"):
|
||||
@@ -17,6 +20,8 @@ func _on_resume_pressed():
|
||||
pause = false
|
||||
|
||||
func _on_restart_pressed():
|
||||
GameInfo.game_data.current_planet_data = null
|
||||
pause = false
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
func _on_quit_pressed():
|
||||
|
||||
177
gui/game/reward_choice/reward_choice.tscn
Normal file
177
gui/game/reward_choice/reward_choice.tscn
Normal file
@@ -0,0 +1,177 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://doxm7uab8i3tq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://12kjdou2kp5y" path="res://gui/game/reward_choice/scripts/reward_choice.gd" id="1_4f1tl"]
|
||||
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://gui/game/pause/resources/blur.gdshader" id="1_iykpa"]
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="2_c278i"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="3_5sqh2"]
|
||||
[ext_resource type="Texture2D" uid="uid://0xg54agef5gh" path="res://common/icons/package.svg" id="4_qmlcw"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gy0la"]
|
||||
shader = ExtResource("1_iykpa")
|
||||
shader_parameter/strength = 3.3
|
||||
shader_parameter/mix_percentage = 0.3
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_4f1tl"]
|
||||
font = ExtResource("3_5sqh2")
|
||||
font_size = 50
|
||||
|
||||
[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(".:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.0333333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [false, true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 2
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.0333333, 0.3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"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"),
|
||||
&"show": SubResource("Animation_4f1tl")
|
||||
}
|
||||
|
||||
[node name="RewardChoice" type="Control"]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
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
|
||||
script = ExtResource("1_4f1tl")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
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="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_c278i")
|
||||
|
||||
[node name="VSplitContainer" type="VBoxContainer" parent="Choice"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_c278i")
|
||||
alignment = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Choice/VSplitContainer"]
|
||||
layout_mode = 2
|
||||
text = "You reached the quota !"
|
||||
label_settings = SubResource("LabelSettings_4f1tl")
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label2" type="Label" parent="Choice/VSplitContainer"]
|
||||
layout_mode = 2
|
||||
text = "Choose a reward"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Choice/VSplitContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("2_c278i")
|
||||
columns = 2
|
||||
|
||||
[node name="Reward1" type="VBoxContainer" parent="Choice/VSplitContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Reward1Button" type="Button" parent="Choice/VSplitContainer/GridContainer/Reward1"]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Compost"
|
||||
icon = ExtResource("4_qmlcw")
|
||||
|
||||
[node name="Reward1Desc" type="Label" parent="Choice/VSplitContainer/GridContainer/Reward1"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "The Compost can do so mush things.... But it's a little gross !"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Reward2" type="VBoxContainer" parent="Choice/VSplitContainer/GridContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Reward2Button" type="Button" parent="Choice/VSplitContainer/GridContainer/Reward2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
text = "Compost"
|
||||
icon = ExtResource("4_qmlcw")
|
||||
|
||||
[node name="Reward2Desc" type="Label" parent="Choice/VSplitContainer/GridContainer/Reward2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "The Compost can do so mush things.... But it's a little gross !"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_7fpy7")
|
||||
}
|
||||
|
||||
[connection signal="pressed" from="Choice/VSplitContainer/GridContainer/Reward1/Reward1Button" to="." method="_on_reward_1_button_pressed"]
|
||||
[connection signal="pressed" from="Choice/VSplitContainer/GridContainer/Reward2/Reward2Button" to="." method="_on_reward_2_button_pressed"]
|
||||
37
gui/game/reward_choice/scripts/reward_choice.gd
Normal file
37
gui/game/reward_choice/scripts/reward_choice.gd
Normal file
@@ -0,0 +1,37 @@
|
||||
extends Control
|
||||
|
||||
var planet: Planet
|
||||
var item1: Item
|
||||
var item2: Item
|
||||
|
||||
func show_rewards():
|
||||
get_tree().paused = true
|
||||
%AnimationPlayer.play("show")
|
||||
|
||||
func hide_rewards():
|
||||
get_tree().paused = false
|
||||
%AnimationPlayer.play_backwards("show")
|
||||
|
||||
func _on_planet_quota_reward_asked(_planet:Planet, _item1:Item, _item2:Item):
|
||||
planet = _planet
|
||||
item1 = _item1
|
||||
item2 = _item2
|
||||
|
||||
%Reward1Button.text = item1.name
|
||||
%Reward1Button.icon = item1.icon
|
||||
%Reward1Desc.text = item1.description
|
||||
|
||||
%Reward2Button.text = item2.name
|
||||
%Reward2Button.icon = item2.icon
|
||||
%Reward2Desc.text = item2.description
|
||||
show_rewards()
|
||||
|
||||
func _on_reward_1_button_pressed():
|
||||
if planet:
|
||||
planet.choose_quota_reward(item1)
|
||||
hide_rewards()
|
||||
|
||||
func _on_reward_2_button_pressed():
|
||||
if planet:
|
||||
planet.choose_quota_reward(item2)
|
||||
hide_rewards()
|
||||
1
gui/game/reward_choice/scripts/reward_choice.gd.uid
Normal file
1
gui/game/reward_choice/scripts/reward_choice.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://12kjdou2kp5y
|
||||
@@ -12,21 +12,21 @@ func _on_player_updated(player:Player):
|
||||
|
||||
update_no_energy_left_info(player.energy)
|
||||
|
||||
func _on_day_pass_pressed():
|
||||
|
||||
await $AnimationPlayer.animation_finished
|
||||
$AnimationPlayer.play("recharge_fade_out")
|
||||
await $AnimationPlayer.animation_finished
|
||||
|
||||
func _on_planet_updated(planet:Planet):
|
||||
%DayCount.text = "Day " + str(planet.day) + "/" + str(planet.day_limit)
|
||||
%DecontaminationCoverage.text = str(roundi(planet.decontamination_surface)) + " m2"
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
func _on_player_action_tried_without_energy():
|
||||
$AnimationPlayer.play("no_energy_left")
|
||||
|
||||
|
||||
func _on_pause_pressed():
|
||||
pause_asked.emit()
|
||||
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://v41hfc7haaye"]
|
||||
[gd_scene load_steps=10 format=3 uid="uid://v41hfc7haaye"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bgcmd213j6gk1" path="res://gui/ressources/default_theme.tres" id="1_cl67j"]
|
||||
[ext_resource type="Script" uid="uid://b3wuxv04clyed" path="res://gui/game/win/scripts/win.gd" id="1_sehw2"]
|
||||
[ext_resource type="Shader" uid="uid://cuni3ggtw2uuy" path="res://gui/game/pause/resources/blur.gdshader" id="2_0b3c6"]
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="2_sehw2"]
|
||||
[ext_resource type="LabelSettings" uid="uid://dqwayi8yjwau2" path="res://gui/ressources/title_label_settings.tres" id="3_0b3c6"]
|
||||
[ext_resource type="Texture2D" uid="uid://bewr0t1wi8pff" path="res://common/icons/rotate.svg" id="4_8p3aj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dex283rx00fjb" path="res://common/icons/logout.svg" id="5_j3wid"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_8p3aj"]
|
||||
shader = ExtResource("2_0b3c6")
|
||||
shader_parameter/strength = 3.3
|
||||
shader_parameter/mix_percentage = 0.3
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_eq457"]
|
||||
font = ExtResource("2_sehw2")
|
||||
font_size = 50
|
||||
@@ -23,6 +29,7 @@ grow_vertical = 2
|
||||
script = ExtResource("1_sehw2")
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_8p3aj")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
||||
@@ -6,5 +6,5 @@ func _ready():
|
||||
%Version.text = ProjectSettings.get_setting("application/config/version")
|
||||
|
||||
func _on_start_pressed():
|
||||
GameInfo.game_data.current_terrain_data = TerrainData.new()
|
||||
GameInfo.game_data.current_planet_data = PlanetData.new()
|
||||
get_tree().change_scene_to_file(start_scene_path)
|
||||
|
||||
@@ -58,7 +58,7 @@ func _process(_delta):
|
||||
)
|
||||
|
||||
if current_selected_item:
|
||||
%ActionZone.radius = current_selected_item.use_zone_radius
|
||||
%ActionZone.radius = current_selected_item.usage_zone_radius
|
||||
%ActionZone.active = can_use_item
|
||||
else:
|
||||
%ActionZone.radius = 0
|
||||
@@ -88,8 +88,8 @@ func update_inspector():
|
||||
elif can_use_item and current_selected_item:
|
||||
%Action.visible = true
|
||||
%ActionText.text = current_selected_item.use_text()
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.use_energy == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = current_selected_item.use_energy != 0
|
||||
%Action.modulate = DEFAULT_ACTION_COLOR if current_selected_item.energy_usage == 0 else ENERGY_ACTION_COLOR
|
||||
%ActionEnergyImage.visible = current_selected_item.energy_usage != 0
|
||||
else:
|
||||
%Action.visible = false
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_resource type="Theme" load_steps=5 format=3 uid="uid://bgcmd213j6gk1"]
|
||||
[gd_resource type="Theme" load_steps=6 format=3 uid="uid://bgcmd213j6gk1"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://cpnsnrqhfkj3k" path="res://gui/ressources/fonts/spincycle_ot.otf" id="1_hv6r3"]
|
||||
|
||||
@@ -38,14 +38,22 @@ corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_hv6r3"]
|
||||
|
||||
[resource]
|
||||
Button/font_sizes/font_size = 25
|
||||
Button/fonts/font = ExtResource("1_hv6r3")
|
||||
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
|
||||
MarginContainer/constants/margin_bottom = 15
|
||||
MarginContainer/constants/margin_left = 15
|
||||
MarginContainer/constants/margin_right = 15
|
||||
MarginContainer/constants/margin_top = 15
|
||||
VBoxContainer/constants/separation = 15
|
||||
VSeparator/constants/separation = 15
|
||||
VSeparator/styles/separator = SubResource("StyleBoxEmpty_hv6r3")
|
||||
VSplitContainer/constants/separation = 15
|
||||
|
||||
Reference in New Issue
Block a user