feature/connect-level-and-reset-btn (#77)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com> Reviewed-on: Athena/game-source#77 Co-authored-by: darknight <vaillant.jeremy@dev-crea.com> Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
This commit is contained in:
+12
-13
@@ -1,7 +1,8 @@
|
||||
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")
|
||||
export (PackedScene) var title = load("res://scenes/UI/title/Title.tscn")
|
||||
export (PackedScene) var setting = load("res://scenes/UI/settings/Settings.tscn")
|
||||
export (PackedScene) var choose_scene = load("res://scenes/UI/choose_scenes/ChooseScene.tscn")
|
||||
|
||||
onready var current_scene = "title"
|
||||
onready var stream_button = preload("res://assets/sounds/click-button.ogg")
|
||||
@@ -11,7 +12,7 @@ func _ready():
|
||||
_translation()
|
||||
home.set_focus_mode(2)
|
||||
home.grab_focus()
|
||||
_apply_scene("Title")
|
||||
_apply_scene(title)
|
||||
_configure_sound()
|
||||
|
||||
func _configure_sound():
|
||||
@@ -25,29 +26,27 @@ func _translation():
|
||||
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ButtonQuit/Label.text = tr("MAIN_BUTTON_QUIT")
|
||||
|
||||
func _apply_scene(actual_scene):
|
||||
var node = "MarginContainer/HBoxContainer/MarginContainer/"
|
||||
var node = get_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
|
||||
if node.get_child_count() != 0:
|
||||
node.get_child(0).queue_free()
|
||||
|
||||
node.add_child(actual_scene.instance())
|
||||
|
||||
# Load scene for select game
|
||||
func _on_ButtonPuzzle_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("ChooseScene")
|
||||
_apply_scene(choose_scene)
|
||||
|
||||
# Load scene settings
|
||||
func _on_ButtonSetting_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("Settings")
|
||||
_apply_scene(setting)
|
||||
|
||||
# Click to icon game
|
||||
func _on_TextureRect_pressed():
|
||||
_sound_button()
|
||||
_apply_scene("Title")
|
||||
_apply_scene(title)
|
||||
|
||||
# Quit the game
|
||||
func _on_ButtonQuit_pressed():
|
||||
|
||||
Reference in New Issue
Block a user