0debe0d2d3
Co-authored-by: stilobique-i7 <aurelienvlt@free.fr> Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com> Reviewed-on: Athena/game-source#66 Co-authored-by: darknight <vaillant.jeremy@dev-crea.com> Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
59 lines
1.8 KiB
GDScript
59 lines
1.8 KiB
GDScript
extends Node
|
|
|
|
export (PackedScene) var settings = load("res://scenes/UI/settings/Settings.tscn")
|
|
export (PackedScene) var scenes = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
|
|
|
|
onready var current_scene = "title"
|
|
onready var stream_button = preload("res://assets/sounds/click-button.ogg")
|
|
onready var home = $MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/CenterContainer/TextureRect
|
|
|
|
func _ready():
|
|
_translation()
|
|
home.set_focus_mode(2)
|
|
home.grab_focus()
|
|
_apply_scene("Title")
|
|
_configure_sound()
|
|
|
|
func _configure_sound():
|
|
stream_button.set_loop(false)
|
|
$MarginContainer/HBoxContainer/UI_summary/ClickButton.stream = stream_button
|
|
|
|
## PRIVATE
|
|
func _translation():
|
|
$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")
|
|
|
|
func _apply_scene(actual_scene):
|
|
var node = "MarginContainer/HBoxContainer/MarginContainer/"
|
|
|
|
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
|
|
|
|
# Load scene for select game
|
|
func _on_ButtonPuzzle_pressed():
|
|
_sound_button()
|
|
_apply_scene("ChooseScene")
|
|
|
|
# Load scene settings
|
|
func _on_ButtonSetting_pressed():
|
|
_sound_button()
|
|
_apply_scene("Settings")
|
|
|
|
# Click to icon game
|
|
func _on_TextureRect_pressed():
|
|
_sound_button()
|
|
_apply_scene("Title")
|
|
|
|
# Quit the game
|
|
func _on_ButtonQuit_pressed():
|
|
_sound_button()
|
|
get_tree().quit(0)
|
|
|
|
func _sound_button():
|
|
$MarginContainer/HBoxContainer/UI_summary/ClickButton.play()
|