extends Control const IN_GAME_MENU = preload("res://UI/InGameMenu/InGameMenu.tscn") const RULES = preload("res://UI/Rules/Rules.tscn") @onready var surrender_button = $VBoxContainer/SurrenderButton @onready var pass_round_button = $VBoxContainer/PassRoundButton var is_blacks_turn: bool = false # Called when the node enters the scene tree for the first time. func _ready(): GameEvents.turn_started.connect(_on_turn_started) func _on_turn_started(round_num: int, map: HexGrid, _is_blacks_turn: bool) -> void: is_blacks_turn = _is_blacks_turn surrender_button.disabled = GameData.is_player_black != _is_blacks_turn and not GameData.is_hot_seat pass_round_button.disabled = GameData.is_player_black != _is_blacks_turn and not GameData.is_hot_seat # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): pass func _on_rules_button_pressed(): var rules = RULES.instantiate() get_tree().root.add_child(rules) rules.show_panel() func _on_menu_button_pressed(): var in_game_menu = IN_GAME_MENU.instantiate() get_tree().root.add_child(in_game_menu) in_game_menu.show_panel() @rpc("any_peer", "call_local") func surrender() -> void: if is_blacks_turn: GameEvents.game_over.emit(true, false) else: GameEvents.game_over.emit(false, true) func _on_surrender_button_pressed(): surrender.rpc() func _on_pass_round_button_pressed(): GameEvents.pass_round.emit()