2021-05-08 13:16:13 +02:00
|
|
|
extends Node
|
|
|
|
|
|
2026-05-16 19:18:27 +02:00
|
|
|
@export var title: PackedScene = load("res://scenes/UI/title/Title.tscn")
|
|
|
|
|
@export var setting: PackedScene = load("res://scenes/UI/settings/Settings.tscn")
|
|
|
|
|
@export var choose_scene: PackedScene = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
|
2021-05-08 15:54:58 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
@onready var stream_button: AudioStream = preload("res://assets/sounds/click-button.ogg")
|
|
|
|
|
@onready var home: TextureButton = $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect
|
2021-05-08 15:54:58 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _ready() -> void:
|
2021-05-13 20:10:43 +02:00
|
|
|
_translation()
|
2026-05-16 21:58:11 +02:00
|
|
|
home.focus_mode = Control.FOCUS_ALL
|
2021-06-03 22:18:50 +02:00
|
|
|
home.grab_focus()
|
2021-06-06 16:54:38 +02:00
|
|
|
_apply_scene(title)
|
2021-05-23 21:48:01 +02:00
|
|
|
_configure_sound()
|
|
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _configure_sound() -> void:
|
|
|
|
|
if stream_button is AudioStreamOggVorbis:
|
|
|
|
|
stream_button.loop = false
|
2021-05-23 21:48:01 +02:00
|
|
|
$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
|
2026-05-16 21:58:11 +02:00
|
|
|
func _translation() -> void:
|
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-06-06 19:11:21 +02:00
|
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ContainerVersion/LabelVersion.text = Setting.get_setting_version()
|
2021-05-15 00:35:15 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _apply_scene(actual_scene: PackedScene) -> void:
|
|
|
|
|
var node := get_node("MarginContainer/HBoxContainer/MarginContainer/")
|
2021-06-06 16:54:38 +02:00
|
|
|
if node.get_child_count() != 0:
|
|
|
|
|
node.get_child(0).queue_free()
|
2026-05-16 19:18:27 +02:00
|
|
|
node.add_child(actual_scene.instantiate())
|
2021-05-14 19:07:26 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_ButtonPuzzle_pressed() -> void:
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-06-06 16:54:38 +02:00
|
|
|
_apply_scene(choose_scene)
|
2021-05-14 19:07:26 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_ButtonSetting_pressed() -> void:
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-06-06 16:54:38 +02:00
|
|
|
_apply_scene(setting)
|
2021-05-15 00:35:15 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_TextureRect_pressed() -> void:
|
2021-05-23 21:48:01 +02:00
|
|
|
_sound_button()
|
2021-06-06 16:54:38 +02:00
|
|
|
_apply_scene(title)
|
2021-05-14 19:07:26 +02:00
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _on_ButtonQuit_pressed() -> void:
|
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
|
|
|
|
2026-05-16 21:58:11 +02:00
|
|
|
func _sound_button() -> void:
|
2021-05-23 21:48:01 +02:00
|
|
|
$MarginContainer/HBoxContainer/UI_summary/ClickButton.play()
|