GamePageViewModel
class GamePageViewModel(val game: Game, val scope: CoroutineScope, val setGame: (Game) -> Unit, val audioPlayMove: () -> Unit, val setPage: (Page) -> Unit = {}, val globalError: ReversiException? = null, val setGlobalError: (Exception?, ErrorType?) -> Unit) : ViewModel<GameUiState>
View model for the game page managing game state, UI updates, and user interactions. Handles game move execution, state polling for multiplayer games, and sound effects.
Constructors
Properties
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Starts a coroutine that periodically polls the game state to refresh it. If the game has a winner, it navigates to the winner page. If the game has not started yet or is corrupted, it sets an appropriate error. The polling runs every 50 milliseconds until cancelled.
Link copied to clipboard