49 lines
1.2 KiB
GDScript
49 lines
1.2 KiB
GDScript
extends Control
|
|
|
|
var destination_map = {
|
|
"oustide":preload("res://scenes/outside.tscn"),
|
|
}
|
|
|
|
signal start
|
|
signal save
|
|
signal load
|
|
|
|
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:
|
|
set_last_save_info()
|
|
$AudioStreamPlayer.play()
|
|
|
|
func _on_button_pressed() -> void:
|
|
emit_signal("start")
|
|
$MarginContainer/Panel/VBoxContainer/Start.text="Continuer"
|
|
$MarginContainer/Panel/VBoxContainer/Save.disabled = false
|
|
$MarginContainer/Panel/VBoxContainer/info.text=""
|
|
|
|
func _on_save_pressed() -> void:
|
|
emit_signal("save")
|
|
set_last_save_info()
|
|
$MarginContainer/Panel/VBoxContainer/info.text="Partie sauvegardée"
|
|
$MarginContainer/Panel/VBoxContainer/info/Timer.start()
|
|
|
|
func _on_load_pressed() -> void:
|
|
emit_signal("load")
|
|
_on_button_pressed()
|
|
|
|
func _on_timer_timeout() -> void:
|
|
$MarginContainer/Panel/VBoxContainer/info.text=""
|