142 lines
4 KiB
Text
142 lines
4 KiB
Text
[gd_scene load_steps=9 format=3 uid="uid://xd3nsiglcdfc"]
|
|
|
|
[ext_resource type="FontFile" uid="uid://c3fsj6knyiuhl" path="res://fonts/Knewave/Knewave-Regular.ttf" id="1_m1tld"]
|
|
|
|
[sub_resource type="GDScript" id="GDScript_q235s"]
|
|
script/source = "extends VBoxContainer
|
|
|
|
var enabled := false:
|
|
get: return enabled
|
|
set(value):
|
|
if enabled == value:
|
|
return
|
|
enabled = value
|
|
if value == false:
|
|
$AnimationPlayer.play(\"scale_linear\")
|
|
await get_tree().create_timer($AnimationPlayer.current_animation_length).timeout
|
|
$AnimationPlayer.play_backwards(\"scale_cubic\")
|
|
|
|
var seconds_spent_total := 0.0:
|
|
get: return seconds_spent_total
|
|
set(value):
|
|
seconds_spent_total = value
|
|
$Total.text = \"Total: \" + seconds_to_readable(seconds_spent_total)
|
|
var seconds_spent_level_attempt := 0.0:
|
|
get: return seconds_spent_level_attempt
|
|
set(value):
|
|
seconds_spent_level_attempt = value
|
|
$Level.text = \"Level: \" + seconds_to_readable(seconds_spent_level_attempt)
|
|
|
|
func _on_visibility_changed() -> void:
|
|
if self.visible and len(SaveFiles.selected_file):
|
|
var save_file = SaveFiles.read(SaveFiles.selected_file)
|
|
if save_file.has(\"played_for\") and save_file.played_for is float:
|
|
seconds_spent_total = save_file.played_for
|
|
else:
|
|
seconds_spent_total = 0.0
|
|
|
|
func seconds_to_readable(seconds: float) -> String:
|
|
var minutes: int = floor(seconds / 60)
|
|
return (\"%0*d\" % [2, minutes]) + \":\" + (\"%0*.3f\" % [6, seconds - (minutes * 60)])
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if enabled:
|
|
seconds_spent_total += delta
|
|
seconds_spent_level_attempt += delta
|
|
"
|
|
|
|
[sub_resource type="LabelSettings" id="LabelSettings_m1tld"]
|
|
font = ExtResource("1_m1tld")
|
|
font_size = 32
|
|
outline_size = 8
|
|
outline_color = Color(1, 0, 1, 1)
|
|
shadow_size = 8
|
|
shadow_color = Color(0, 0, 0, 1)
|
|
|
|
[sub_resource type="LabelSettings" id="LabelSettings_2a86r"]
|
|
font = ExtResource("1_m1tld")
|
|
font_size = 24
|
|
outline_size = 8
|
|
outline_color = Color(0, 0, 1, 1)
|
|
shadow_size = 8
|
|
shadow_color = Color(0, 0, 0, 1)
|
|
|
|
[sub_resource type="Animation" id="Animation_m1tld"]
|
|
length = 0.001
|
|
tracks/0/type = "value"
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/path = NodePath(".:scale")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/keys = {
|
|
"times": PackedFloat32Array(0),
|
|
"transitions": PackedFloat32Array(1),
|
|
"update": 0,
|
|
"values": [Vector2(1, 1)]
|
|
}
|
|
|
|
[sub_resource type="Animation" id="Animation_houb3"]
|
|
resource_name = "scale_cubic"
|
|
length = 0.25
|
|
step = 0.25
|
|
tracks/0/type = "value"
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/path = NodePath(".:scale")
|
|
tracks/0/interp = 2
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/keys = {
|
|
"times": PackedFloat32Array(0, 0.25),
|
|
"transitions": PackedFloat32Array(1, 1),
|
|
"update": 0,
|
|
"values": [Vector2(1, 1), Vector2(1.2, 1.2)]
|
|
}
|
|
|
|
[sub_resource type="Animation" id="Animation_2a86r"]
|
|
resource_name = "scale_linear"
|
|
length = 0.25
|
|
step = 0.25
|
|
tracks/0/type = "value"
|
|
tracks/0/imported = false
|
|
tracks/0/enabled = true
|
|
tracks/0/path = NodePath(".:scale")
|
|
tracks/0/interp = 1
|
|
tracks/0/loop_wrap = true
|
|
tracks/0/keys = {
|
|
"times": PackedFloat32Array(0, 0.25),
|
|
"transitions": PackedFloat32Array(1, 1),
|
|
"update": 0,
|
|
"values": [Vector2(1, 1), Vector2(1.2, 1.2)]
|
|
}
|
|
|
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_jmgpn"]
|
|
_data = {
|
|
&"RESET": SubResource("Animation_m1tld"),
|
|
&"scale_cubic": SubResource("Animation_houb3"),
|
|
&"scale_linear": SubResource("Animation_2a86r")
|
|
}
|
|
|
|
[node name="Timer" type="VBoxContainer"]
|
|
process_mode = 3
|
|
offset_right = 315.0
|
|
offset_bottom = 85.0
|
|
theme_override_constants/separation = -5
|
|
script = SubResource("GDScript_q235s")
|
|
|
|
[node name="Total" type="Label" parent="."]
|
|
layout_mode = 2
|
|
text = "Total: 0:00.000"
|
|
label_settings = SubResource("LabelSettings_m1tld")
|
|
|
|
[node name="Level" type="Label" parent="."]
|
|
layout_mode = 2
|
|
text = "Level: 0:00.000"
|
|
label_settings = SubResource("LabelSettings_2a86r")
|
|
|
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
|
libraries = {
|
|
&"": SubResource("AnimationLibrary_jmgpn")
|
|
}
|
|
|
|
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|