Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package view
- import Screen
- import ViewModel
- import androidx.compose.foundation.layout.Column
- import androidx.compose.material.MaterialTheme
- import androidx.compose.runtime.Composable
- @Suppress("FunctionNaming")
- @Composable
- fun View(viewModel: ViewModel) {
- val state = viewModel.state
- Column {
- MaterialTheme {
- when (state.screen) {
- Screen.START_GAME -> {
- StartGame(viewModel::onStartGame)
- }
- Screen.MODE_CHOICE -> {
- GameModeChoice(viewModel::onChoiceSingleMode, viewModel::onChoiceBotMode)
- }
- Screen.SIDE_CHOICE -> {
- SideChoice(viewModel::onChoiceCrosses, viewModel::onChoiceNoughts)
- }
- Screen.GAME_FIELD -> {
- ButtonsList(
- state,
- viewModel::onButtonSelect
- )
- }
- Screen.END_GAME -> {
- EndGame(state)
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement