2024-03-15 18:05:58 +01:00
|
|
|
extends Control
|
|
|
|
|
|
2024-03-19 23:16:29 +01:00
|
|
|
@onready var exit_button = $PanelContainer/MarginContainer/VBoxContainer/ExitButton
|
2024-03-22 01:37:05 +01:00
|
|
|
@onready var lan_button = $PanelContainer/MarginContainer/VBoxContainer/LANButton
|
|
|
|
|
|
2024-03-23 17:49:33 +01:00
|
|
|
const SETTINGS = preload("res://UI/Settings/Settings.tscn")
|
|
|
|
|
const RULES = preload("res://UI/Rules/Rules.tscn")
|
2024-03-19 23:16:29 +01:00
|
|
|
|
2024-03-15 18:05:58 +01:00
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready() -> void:
|
2024-03-19 23:16:29 +01:00
|
|
|
if OS.has_feature("web"):
|
|
|
|
|
exit_button.visible = false
|
2024-03-22 01:37:05 +01:00
|
|
|
lan_button.visible = false
|
2024-03-19 23:16:29 +01:00
|
|
|
|
2024-03-22 01:37:05 +01:00
|
|
|
#WSClient.lobby_joined.connect(_on_lobby_joined)
|
2024-03-24 17:18:57 +01:00
|
|
|
Networking.offline_mode()
|
2024-03-16 19:56:22 +01:00
|
|
|
GameData.reset()
|
2024-03-15 18:05:58 +01:00
|
|
|
|
|
|
|
|
func _on_lobby_joined(lobby: String) -> void:
|
2024-03-16 02:36:45 +01:00
|
|
|
GameData.lobby_code = lobby
|
|
|
|
|
|
|
|
|
|
get_tree().change_scene_to_file("res://Multiplayer/Multiplayer.tscn")
|
2024-03-23 16:18:30 +01:00
|
|
|
|
2024-03-15 18:05:58 +01:00
|
|
|
|
2024-03-16 02:36:45 +01:00
|
|
|
func _on_host_button_pressed():
|
|
|
|
|
GameData.is_player_black = false
|
2024-03-22 01:37:05 +01:00
|
|
|
#WSClient.start(GameData.WEBSOCKET_ENDPOINT, "", false)
|
2024-03-16 02:36:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_join_button_pressed():
|
|
|
|
|
get_tree().change_scene_to_file("res://UI/join_menu.tscn")
|
|
|
|
|
|
2024-03-15 18:05:58 +01:00
|
|
|
|
2024-03-16 02:36:45 +01:00
|
|
|
func _on_exit_button_pressed():
|
|
|
|
|
get_tree().quit()
|
2024-03-16 19:56:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_rules_button_pressed():
|
2024-03-23 17:49:33 +01:00
|
|
|
var rules = RULES.instantiate()
|
|
|
|
|
|
|
|
|
|
get_tree().root.add_child(rules)
|
|
|
|
|
|
2024-03-22 01:37:05 +01:00
|
|
|
rules.show_panel()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_online_button_pressed():
|
2024-03-24 03:30:54 +01:00
|
|
|
get_tree().change_scene_to_file("res://UI/Lobby/WebRTCLobby.tscn")
|
2024-03-22 01:37:05 +01:00
|
|
|
|
|
|
|
|
func _on_local_button_pressed():
|
|
|
|
|
GameData.is_hot_seat = true
|
|
|
|
|
get_tree().change_scene_to_file("res://Game.tscn")
|
2024-03-23 16:18:30 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_settings_button_pressed():
|
2024-03-23 17:49:33 +01:00
|
|
|
var settings = SETTINGS.instantiate()
|
|
|
|
|
|
|
|
|
|
get_tree().root.add_child(settings)
|
|
|
|
|
|
2024-03-23 16:18:30 +01:00
|
|
|
settings.show_panel()
|
2024-03-24 03:30:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_lan_button_pressed():
|
|
|
|
|
get_tree().change_scene_to_file("res://UI/Lobby/LANLobby.tscn")
|