Add gdlint and gdformat scripts

This commit is contained in:
2025-09-27 20:40:13 +04:00
parent 86439abea8
commit 06f0f87970
40 changed files with 2314 additions and 732 deletions

View File

@@ -1,17 +1,19 @@
extends Control
@onready var splash_screen = $SplashScreen
var current_menu = null
@onready var splash_screen: Node = $SplashScreen
var current_menu: Control = null
const MAIN_MENU_SCENE = preload("res://scenes/ui/MainMenu.tscn")
const SETTINGS_MENU_SCENE = preload("res://scenes/ui/SettingsMenu.tscn")
func _ready():
func _ready() -> void:
DebugManager.log_debug("Main scene ready", "Main")
# Use alternative connection method with input handling
_setup_splash_screen_connection()
func _setup_splash_screen_connection():
func _setup_splash_screen_connection() -> void:
# Wait for all nodes to be ready
await get_tree().process_frame
await get_tree().process_frame
@@ -41,45 +43,53 @@ func _setup_splash_screen_connection():
DebugManager.log_error("Could not find SplashScreen node", "Main")
_use_fallback_input_handling()
func _use_fallback_input_handling():
func _use_fallback_input_handling() -> void:
# Fallback: handle input directly in the main scene
set_process_unhandled_input(true)
func _unhandled_input(event):
func _unhandled_input(event: InputEvent) -> void:
if splash_screen and splash_screen.is_inside_tree():
# Forward input to splash screen or handle directly
if event.is_action_pressed("action_south"):
_on_any_key_pressed()
get_viewport().set_input_as_handled()
func _on_any_key_pressed():
func _on_any_key_pressed() -> void:
DebugManager.log_debug("Transitioning to main menu", "Main")
splash_screen.queue_free()
show_main_menu()
func show_main_menu():
func show_main_menu() -> void:
clear_current_menu()
var main_menu = MAIN_MENU_SCENE.instantiate()
main_menu.open_settings.connect(_on_open_settings)
add_child(main_menu)
current_menu = main_menu
func show_settings_menu():
func show_settings_menu() -> void:
clear_current_menu()
var settings_menu = SETTINGS_MENU_SCENE.instantiate()
settings_menu.back_to_main_menu.connect(_on_back_to_main_menu)
add_child(settings_menu)
current_menu = settings_menu
func clear_current_menu():
func clear_current_menu() -> void:
if current_menu:
current_menu.queue_free()
current_menu = null
func _on_open_settings():
func _on_open_settings() -> void:
DebugManager.log_debug("Opening settings menu", "Main")
show_settings_menu()
func _on_back_to_main_menu():
func _on_back_to_main_menu() -> void:
DebugManager.log_debug("Back to main menu", "Main")
show_main_menu()

View File

@@ -2,15 +2,26 @@ extends Control
signal any_key_pressed
func _ready():
func _ready() -> void:
DebugManager.log_debug("SplashScreen ready", "SplashScreen")
update_text()
func _input(event):
if event.is_action_pressed("action_south") or event is InputEventScreenTouch or (event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed):
func _input(event: InputEvent) -> void:
if (
event.is_action_pressed("action_south")
or event is InputEventScreenTouch
or (
event is InputEventMouseButton
and event.button_index == MOUSE_BUTTON_LEFT
and event.pressed
)
):
DebugManager.log_debug("Action pressed: " + str(event), "SplashScreen")
any_key_pressed.emit()
get_viewport().set_input_as_handled()
func update_text():
func update_text() -> void:
$SplashContainer/ContinueLabel.text = tr("press_ok_continue")