online multiplayer chess game (note server currently down)
fix flipping when hosting for black
| -rw-r--r-- | networking/PacketHandler.gd | 15 | ||||
| -rw-r--r-- | ui/menus/lobby/GameConfig.gd | 3 |
2 files changed, 6 insertions, 12 deletions
diff --git a/networking/PacketHandler.gd b/networking/PacketHandler.gd index a10ffd1..ddfbf1d 100644 --- a/networking/PacketHandler.gd +++ b/networking/PacketHandler.gd @@ -127,20 +127,11 @@ func _connection_error() -> void: func join_result(accepted) -> void: - if handle_result(accepted, "Joined!"): - flip_if_black() - - -func flip_if_black(): - yield(get_tree(), "idle_frame") - if Globals.team == Chess.BLACK: - Globals.grid.flip_board() + handle_result(accepted, "Joined!") func host_result(accepted) -> void: - if handle_result(accepted, "Hosted!"): - set_hosting(true) - flip_if_black() + set_hosting(handle_result(accepted, "Hosted!")) func handle_result(accepted, resultstring: String) -> bool: @@ -170,6 +161,8 @@ func _start_game() -> void: lobby.toggle(false) emit_signal("start_game") lobby.set_buttons(false) + if Globals.team == Chess.BLACK: + board.get_board().flip_board() ## packet sending wrapper functions diff --git a/ui/menus/lobby/GameConfig.gd b/ui/menus/lobby/GameConfig.gd index 7fe77d3..b822146 100644 --- a/ui/menus/lobby/GameConfig.gd +++ b/ui/menus/lobby/GameConfig.gd @@ -24,13 +24,14 @@ func open(_lobby: Lobby): func _on_Stop_pressed(): + lobby.set_buttons(true) reset() func reset(): moves = [] white = true - $Advanced/H/Pgn.text_changed("") + $Advanced/H/Pgn.text = "" hide() |