59 lines
1.8 KiB
Kotlin
59 lines
1.8 KiB
Kotlin
import androidx.compose.foundation.layout.*
|
|
import androidx.compose.material.Button
|
|
import androidx.compose.material.Text
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.unit.dp
|
|
import components.GameHeader
|
|
import components.PlayerBar
|
|
import components.QuestionGrid
|
|
import components.QuestionResolution
|
|
import data.Game
|
|
import data.Player
|
|
import data.QuestionData
|
|
|
|
@Composable
|
|
@Suppress("FunctionName")
|
|
fun GameBoard(
|
|
gameData: Game,
|
|
reviewModeActive: Boolean,
|
|
secondRoundDouble: Boolean,
|
|
playerPointMap: Map<Player, Long>,
|
|
questionsResolved: Map<QuestionData, QuestionResolution>,
|
|
onDisableReviewMode: () -> Unit,
|
|
onPointsChange: (Player, Long) -> Unit,
|
|
onQuestionDone: (QuestionData, QuestionResolution) -> Unit,
|
|
onExit: () -> Unit
|
|
) {
|
|
Column(modifier = Modifier.fillMaxHeight().fillMaxWidth()) {
|
|
GameHeader(
|
|
title = gameData.title,
|
|
color = gameData.headerColor,
|
|
onExit = onExit
|
|
)
|
|
Spacer(modifier = Modifier.height(5.dp))
|
|
Row(
|
|
modifier = Modifier.fillMaxHeight()
|
|
) {
|
|
if (reviewModeActive) {
|
|
Button(onClick = onDisableReviewMode) {
|
|
Text(text = "Back")
|
|
}
|
|
}
|
|
Column(Modifier.fillMaxWidth(0.8f)) {
|
|
QuestionGrid(
|
|
gameData,
|
|
secondRoundDouble,
|
|
questionsResolved,
|
|
onResolveQuestion = onQuestionDone,
|
|
onPointsChange = onPointsChange
|
|
)
|
|
}
|
|
Spacer(modifier = Modifier.width(5.dp))
|
|
Column(Modifier.fillMaxWidth()) {
|
|
PlayerBar(players = playerPointMap)
|
|
}
|
|
}
|
|
}
|
|
}
|