01ea3af253
Apply Godot 4.6 automated conversion: renames Spatial.translate->position, margin_*->offset_*, tool->@tool, .empty()->.is_empty(), DynamicFont->FontFile, onready->@onready, export()->@export, and many more. 127 files changed by the tool. Manual fixes still required for: - godot_db_manager plugin (incompatible APIs: WindowDialog, Tabs, etc.) - lod plugin (Spatial -> Node3D renames) - ResourceLoader.load_interactive removed -> load_threaded_request - OS.set_window_fullscreen removed -> DisplayServer - Viewport.set_size_override removed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
59 lines
1.9 KiB
GDScript
59 lines
1.9 KiB
GDScript
extends Node
|
|
|
|
@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")
|
|
|
|
@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")
|
|
$MarginContainer/HBoxContainer/UI_summary/PanelWood/VBoxContainer/ContainerVersion/LabelVersion.text = Setting.get_setting_version()
|
|
|
|
func _apply_scene(actual_scene):
|
|
var node = get_node("MarginContainer/HBoxContainer/MarginContainer/")
|
|
|
|
if node.get_child_count() != 0:
|
|
node.get_child(0).queue_free()
|
|
|
|
node.add_child(actual_scene.instantiate())
|
|
|
|
# Load scene for select game
|
|
func _on_ButtonPuzzle_pressed():
|
|
_sound_button()
|
|
_apply_scene(choose_scene)
|
|
|
|
# Load scene settings
|
|
func _on_ButtonSetting_pressed():
|
|
_sound_button()
|
|
_apply_scene(setting)
|
|
|
|
# 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()
|