2021-05-08 13:16:13 +02:00
|
|
|
extends Node
|
|
|
|
|
|
2021-05-15 00:35:15 +02:00
|
|
|
export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn")
|
|
|
|
|
export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
|
2021-05-08 15:54:58 +02:00
|
|
|
|
2021-05-15 00:35:15 +02:00
|
|
|
onready var current_scene = "title"
|
2021-05-23 21:48:01 +02:00
|
|
|
onready var stream_button= preload("res://assets/sounds/click-button.ogg")
|
2021-05-08 15:54:58 +02:00
|
|
|
|
2021-05-09 23:28:45 +02:00
|
|
|
func _ready():
|
2021-05-13 20:10:43 +02:00
|
|
|
_translation()
|
2021-05-15 01:02:04 +02:00
|
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect.grab_focus()
|
2021-05-15 00:35:15 +02:00
|
|
|
_apply_scene("Title")
|
2021-05-23 21:48:01 +02:00
|
|
|
_configure_sound()
|
|
|
|
|
|
|
|
|
|
func _configure_sound():
|
|
|
|
|
stream_button.set_loop(false)
|
|
|
|
|
$MarginContainer/HBoxContainer/UI_summary/ClickButton.stream = stream_button
|
2021-05-09 23:28:45 +02:00
|
|
|
|
2021-05-08 15:54:58 +02:00
|
|
|
## PRIVATE
|
2021-05-13 20:10:43 +02:00
|
|
|
func _translation():
|
2021-05-14 22:27:40 +02:00
|
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonPuzzle/Label.text = tr("MAIN_BUTTON_PUZZLES")
|
|
|
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonSetting/Label.text = tr("MAIN_BUTTON_SETTINGS")
|
|
|
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit/Label.text = tr("MAIN_BUTTON_QUIT")
|
2021-05-15 00:35:15 +02:00
|
|
|
|
|
|
|
|
func _apply_scene(actual_scene):
|
|
|
|
|
var node = "MarginContainer/HBoxContainer/MarginContainer/"
|
2021-05-13 20:10:43 +02:00
|
|
|
|
2021-05-15 00:35:15 +02:00
|
|
|
for scene in ["Title", "Settings", "ChooseScene"]:
|
|
|
|
|
get_node(node + scene).visible = true
|
|
|
|
|
if actual_scene == scene:
|
|
|
|
|
get_node(node + scene).visible = true
|
|
|
|
|
else:
|
|
|
|
|
get_node(node + scene).visible = false
|
2021-05-14 19:07:26 +02:00
|
|
|
|
|
|
|
|
# Load scene for select game
|
|
|
|
|
func _on_ButtonPuzzle_pressed():
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-05-15 00:35:15 +02:00
|
|
|
_apply_scene("ChooseScene")
|
2021-05-14 19:07:26 +02:00
|
|
|
|
|
|
|
|
# Load scene settings
|
|
|
|
|
func _on_ButtonSetting_pressed():
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-05-15 00:35:15 +02:00
|
|
|
_apply_scene("Settings")
|
|
|
|
|
|
|
|
|
|
# Click to icon game
|
|
|
|
|
func _on_TextureRect_pressed():
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-05-15 00:35:15 +02:00
|
|
|
_apply_scene("Title")
|
2021-05-14 19:07:26 +02:00
|
|
|
|
|
|
|
|
# Quit the game
|
|
|
|
|
func _on_ButtonQuit_pressed():
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-05-14 19:07:26 +02:00
|
|
|
get_tree().quit(0)
|
2021-05-23 21:48:01 +02:00
|
|
|
|
|
|
|
|
func _sound_button():
|
|
|
|
|
$MarginContainer/HBoxContainer/UI_summary/ClickButton.play()
|