Advertisement
Artyom_Kopan

view/EndGame.kt

May 30th, 2022
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.26 KB | None | 0 0
  1. package view
  2.  
  3. import ViewModel
  4. import androidx.compose.foundation.layout.Box
  5. import androidx.compose.foundation.layout.Column
  6. import androidx.compose.foundation.layout.fillMaxHeight
  7. import androidx.compose.foundation.layout.fillMaxWidth
  8. import androidx.compose.foundation.layout.height
  9. import androidx.compose.foundation.layout.width
  10. import androidx.compose.material.Button
  11. import androidx.compose.material.Text
  12. import androidx.compose.runtime.Composable
  13. import androidx.compose.ui.Alignment
  14. import androidx.compose.ui.Modifier
  15. import androidx.compose.ui.text.style.TextAlign
  16. import androidx.compose.ui.unit.dp
  17. import androidx.compose.ui.unit.sp
  18.  
  19. @Suppress("FunctionNaming")
  20.  
  21. @Composable
  22. fun EndGame(state: ViewModel.State) =
  23.     Box(modifier = Modifier.fillMaxWidth().fillMaxHeight(), contentAlignment = Alignment.Center) {
  24.         if (state.winStatus != WinStatus.CONTINUES) {
  25.             state.screen = Screen.END_GAME
  26.             when (state.winStatus) {
  27.                 WinStatus.CROSSES -> Text("Крестики выиграли!", fontSize = 35.sp)
  28.                 WinStatus.NOUGHTS -> Text("Нолики выиграли!", fontSize = 35.sp)
  29.                 WinStatus.BALANCE -> Text("Ничья!", fontSize = 35.sp)
  30.             }
  31.         }
  32.     }
  33.  
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement