Information de date de dernière sauvegarde
This commit is contained in:
78
UI/men3FD6.tmp
Normal file
78
UI/men3FD6.tmp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://44wla7mlivqm"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://UI/menu.gd" id="1_30mo7"]
|
||||||
|
[ext_resource type="FontFile" uid="uid://c1lnxul6k2adw" path="res://assest/font/vhs-gothic.ttf" id="2_6inip"]
|
||||||
|
[ext_resource type="Theme" uid="uid://bn1flbuijm27d" path="res://UI/menu_button.tres" id="3_feq31"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_q3w7i"]
|
||||||
|
line_spacing = 45.0
|
||||||
|
font = ExtResource("2_6inip")
|
||||||
|
font_size = 60
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_i5c8e"]
|
||||||
|
font_size = 30
|
||||||
|
|
||||||
|
[node name="Menu" type="Control"]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_30mo7")
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_stretch_ratio = 1.37
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
offset_right = 1920.0
|
||||||
|
offset_bottom = 1080.0
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "
|
||||||
|
Chaussette sale, le jeu!
|
||||||
|
|
||||||
|
"
|
||||||
|
label_settings = SubResource("LabelSettings_q3w7i")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Start" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("3_feq31")
|
||||||
|
text = "Démarrer une nouvelle partie"
|
||||||
|
|
||||||
|
[node name="Save" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("3_feq31")
|
||||||
|
disabled = true
|
||||||
|
text = "Sauvegarder"
|
||||||
|
|
||||||
|
[node name="Load" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("3_feq31")
|
||||||
|
text = "Charger"
|
||||||
|
|
||||||
|
[node name="LastSaveInfo" type="Label" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Last save"
|
||||||
|
label_settings = SubResource("LabelSettings_i5c8e")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Start" to="." method="_on_button_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Save" to="." method="_on_save_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Load" to="." method="_on_load_pressed"]
|
||||||
18
UI/menu.gd
18
UI/menu.gd
@@ -10,8 +10,22 @@ signal load
|
|||||||
|
|
||||||
var instanciated_destinations = {}
|
var instanciated_destinations = {}
|
||||||
|
|
||||||
|
func set_last_save_info():
|
||||||
|
if FileAccess.file_exists("user://savegame.save"):
|
||||||
|
$MarginContainer/Panel/VBoxContainer/Load.disabled = false
|
||||||
|
$MarginContainer/Panel/VBoxContainer/LastSaveInfo.text = "Dernière sauvegarde: "+str(
|
||||||
|
Time.get_datetime_string_from_unix_time(
|
||||||
|
FileAccess.get_modified_time(
|
||||||
|
"user://savegame.save"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
$MarginContainer/Panel/VBoxContainer/Load.disabled = true
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
$MarginContainer/Panel/VBoxContainer/Load.disabled = not FileAccess.file_exists("user://savegame.save")
|
set_last_save_info()
|
||||||
|
|
||||||
func _on_button_pressed() -> void:
|
func _on_button_pressed() -> void:
|
||||||
emit_signal("start")
|
emit_signal("start")
|
||||||
@@ -20,7 +34,7 @@ func _on_button_pressed() -> void:
|
|||||||
|
|
||||||
func _on_save_pressed() -> void:
|
func _on_save_pressed() -> void:
|
||||||
emit_signal("save")
|
emit_signal("save")
|
||||||
$MarginContainer/Panel/VBoxContainer/Load.disabled = not FileAccess.file_exists("user://savegame.save")
|
set_last_save_info()
|
||||||
|
|
||||||
|
|
||||||
func _on_load_pressed() -> void:
|
func _on_load_pressed() -> void:
|
||||||
|
|||||||
21
UI/menu.tscn
21
UI/menu.tscn
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://44wla7mlivqm"]
|
[gd_scene load_steps=6 format=3 uid="uid://44wla7mlivqm"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://UI/menu.gd" id="1_30mo7"]
|
[ext_resource type="Script" path="res://UI/menu.gd" id="1_30mo7"]
|
||||||
[ext_resource type="FontFile" uid="uid://c1lnxul6k2adw" path="res://assest/font/vhs-gothic.ttf" id="2_6inip"]
|
[ext_resource type="FontFile" uid="uid://c1lnxul6k2adw" path="res://assest/font/vhs-gothic.ttf" id="2_6inip"]
|
||||||
@@ -9,6 +9,9 @@ line_spacing = 45.0
|
|||||||
font = ExtResource("2_6inip")
|
font = ExtResource("2_6inip")
|
||||||
font_size = 60
|
font_size = 60
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_i5c8e"]
|
||||||
|
font_size = 30
|
||||||
|
|
||||||
[node name="Menu" type="Control"]
|
[node name="Menu" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -53,17 +56,23 @@ layout_mode = 2
|
|||||||
theme = ExtResource("3_feq31")
|
theme = ExtResource("3_feq31")
|
||||||
text = "Démarrer une nouvelle partie"
|
text = "Démarrer une nouvelle partie"
|
||||||
|
|
||||||
[node name="Save" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
[node name="LastSaveInfo" type="Label" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("3_feq31")
|
text = "Last save"
|
||||||
disabled = true
|
label_settings = SubResource("LabelSettings_i5c8e")
|
||||||
text = "Sauvegarder"
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="Load" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
[node name="Load" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme = ExtResource("3_feq31")
|
theme = ExtResource("3_feq31")
|
||||||
text = "Charger"
|
text = "Charger"
|
||||||
|
|
||||||
|
[node name="Save" type="Button" parent="MarginContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
theme = ExtResource("3_feq31")
|
||||||
|
disabled = true
|
||||||
|
text = "Sauvegarder"
|
||||||
|
|
||||||
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Start" to="." method="_on_button_pressed"]
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Start" to="." method="_on_button_pressed"]
|
||||||
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Save" to="." method="_on_save_pressed"]
|
|
||||||
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Load" to="." method="_on_load_pressed"]
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Load" to="." method="_on_load_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/Panel/VBoxContainer/Save" to="." method="_on_save_pressed"]
|
||||||
|
|||||||
Reference in New Issue
Block a user