2022-02-24 05:23:47 +00:00
|
|
|
extends Control
|
2022-02-24 04:31:14 +00:00
|
|
|
|
|
|
|
|
2024-02-18 08:02:01 +00:00
|
|
|
@onready var quit_button: Button = %QuitButton
|
|
|
|
@onready var credits: ColorRect = %Credits
|
|
|
|
|
2024-03-20 02:04:49 +00:00
|
|
|
@onready var random_buttons = [%Random3, %Random4, %Random6, %Random7, %Random8]
|
|
|
|
|
2024-02-18 08:02:01 +00:00
|
|
|
|
2022-02-24 04:31:14 +00:00
|
|
|
func _ready() -> void:
|
2024-02-18 08:02:01 +00:00
|
|
|
if OS.has_feature("web"):
|
|
|
|
quit_button.hide()
|
2022-02-24 04:31:14 +00:00
|
|
|
|
2024-03-20 02:04:49 +00:00
|
|
|
for button in random_buttons:
|
|
|
|
button.pressed.connect(start_random_game.bind(int(button.text[0])))
|
|
|
|
|
|
|
|
|
|
|
|
func start_random_game(length := -1) -> void:
|
|
|
|
Global.game_mode = Global.GameMode.RANDOM
|
|
|
|
Global.custom_word_length = length
|
|
|
|
var error := get_tree().change_scene_to_file("res://src/main.tscn")
|
|
|
|
assert(not error)
|
|
|
|
|
2022-02-24 04:31:14 +00:00
|
|
|
|
|
|
|
func _on_DailyButton_pressed() -> void:
|
2024-03-08 02:59:31 +00:00
|
|
|
Global.game_mode = Global.GameMode.DAILY
|
2024-03-20 02:04:49 +00:00
|
|
|
Global.custom_word_length = -1
|
2024-02-18 07:22:48 +00:00
|
|
|
var error := get_tree().change_scene_to_file("res://src/main.tscn")
|
2022-02-24 04:31:14 +00:00
|
|
|
assert(not error)
|
|
|
|
|
|
|
|
|
|
|
|
func _on_RandomButton_pressed() -> void:
|
2024-03-20 02:04:49 +00:00
|
|
|
start_random_game()
|
2022-02-24 04:31:14 +00:00
|
|
|
|
|
|
|
|
2024-03-08 04:14:05 +00:00
|
|
|
func _on_custom_button_pressed() -> void:
|
|
|
|
var error := get_tree().change_scene_to_file("res://src/custom_setup.tscn")
|
|
|
|
assert(not error)
|
|
|
|
|
|
|
|
|
2022-02-24 04:31:14 +00:00
|
|
|
func _on_CreditsButton_pressed() -> void:
|
2024-02-18 08:02:01 +00:00
|
|
|
credits.show()
|
2022-02-24 04:31:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_QuitButton_pressed() -> void:
|
2024-02-18 07:22:48 +00:00
|
|
|
get_tree().get_root().propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
|
2022-02-24 05:23:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_CreditsBackButton_pressed() -> void:
|
2024-02-18 08:02:01 +00:00
|
|
|
credits.hide()
|