Reset game buffer when joining a new match

main
Trevor Slocum 2023-09-18 23:15:32 -07:00
parent 40acdc03e1
commit 379ec0197c
1 changed files with 8 additions and 4 deletions

12
app.go
View File

@ -690,11 +690,15 @@ func HandleEvents(c *Client, b *GameBoard) {
b.Board.Player2.Name = ev.Player
}
b.Update()
gameInProgress = true
showCreateGameDialog = false
showJoinGameDialog = false
setScreen(ScreenGame)
if ev.Player == c.Username {
gameInProgress = true
showCreateGameDialog = false
showJoinGameDialog = false
setScreen(ScreenGame)
gameBuffer.SetText("")
gameLogged = false
} else {
lg(fmt.Sprintf("%s joined the match.", ev.Player))
}