Release: Meowdoku refinements and Scorekeeper name memory #18

Merged
devadmin merged 16 commits from dev into main 2026-10-26 10:55:04 -06:00
Showing only changes of commit ccf8d5a1ba - Show all commits
@@ -101,7 +101,7 @@ fun HudBuildColumn(
onDrag: (Offset) -> Unit,
onDragEnd: () -> Unit,
) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(6.dp), horizontalAlignment = Alignment.CenterHorizontally) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(3.dp), horizontalAlignment = Alignment.CenterHorizontally) {
kinds.forEach { kind ->
BuildChip(kind, enabled = kind in canBuild, armed = armed == kind, onTap, onDragStart, onDrag, onDragEnd)
}
@@ -127,7 +127,7 @@ private fun BuildChip(
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Box(
modifier = Modifier
.size(52.dp)
.size(46.dp)
.clip(shape)
.background(
when {
@@ -183,7 +183,7 @@ object CatanHudGlyphs {
}
}
/** ✓ over ✗: confirm or cancel a staged placement. Always laid out; enabled only while something is staged. */
/** ✓ beside ✗: confirm or cancel a staged placement. Always laid out; enabled only while something is staged. */
@Composable
fun HudConfirmButtons(
staged: Boolean,
@@ -191,9 +191,9 @@ fun HudConfirmButtons(
onConfirm: () -> Unit,
onCancel: () -> Unit,
) {
Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp), horizontalAlignment = Alignment.CenterHorizontally) {
HudRoundButton("✓", caption = CatanText.CONFIRM_BUILD, enabled = staged, tint = Color(0xFF2E7D32), onClick = onConfirm)
HudRoundButton("✕", caption = CatanText.CANCEL_BUILD, enabled = staged, tint = Color(0xFFC62828), onClick = onCancel)
Row(modifier, horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.Bottom) {
HudRoundButton("✓", caption = CatanText.CONFIRM_BUILD, enabled = staged, tint = Color(0xFF2E7D32), diameter = 48.dp, onClick = onConfirm)
HudRoundButton("✕", caption = CatanText.CANCEL_BUILD, enabled = staged, tint = Color(0xFFC62828), diameter = 48.dp, onClick = onCancel)
}
}
@@ -309,23 +309,24 @@ fun CatanHud(
onProgress: () -> Unit,
board: @Composable (Modifier) -> Unit,
) {
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Column(Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(2.dp)) {
HudPlayerStrip(state, seats, pointsOf, style)
Box(Modifier.weight(1f).fillMaxWidth()) {
ZoomPanBox(Modifier.fillMaxSize().padding(start = 76.dp, end = 76.dp, top = 52.dp, bottom = 96.dp)) {
// The island fills the whole area; controls float over its sea margin.
ZoomPanBox(Modifier.fillMaxSize().padding(start = 64.dp, end = 64.dp, top = 30.dp, bottom = 44.dp)) {
board(Modifier.onGloballyPositioned(onBoardCoords))
}
// What is going on, and the dice. Two lines, always.
Row(
Modifier.align(Alignment.TopCenter).fillMaxWidth().padding(horizontal = 8.dp)
.clip(RoundedCornerShape(12.dp))
.background(MaterialTheme.colorScheme.surface.copy(alpha = 0.78f))
.padding(horizontal = 10.dp, vertical = 2.dp),
Modifier.align(Alignment.TopCenter).padding(horizontal = 64.dp)
.clip(RoundedCornerShape(10.dp))
.background(MaterialTheme.colorScheme.surface.copy(alpha = 0.8f))
.padding(horizontal = 8.dp, vertical = 1.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
androidx.compose.material3.Text(
Text(
text = notice ?: prompt,
style = MaterialTheme.typography.bodySmall,
color = if (notice != null) MaterialTheme.colorScheme.error else Color.Unspecified,
@@ -341,32 +342,39 @@ fun CatanHud(
kinds = actions.buildKinds,
canBuild = actions.canBuild,
armed = building,
modifier = Modifier.align(Alignment.CenterStart).padding(start = 8.dp, top = 40.dp),
modifier = Modifier.align(Alignment.CenterStart).padding(start = 6.dp),
onTap = onArm,
onDragStart = onDragStart,
onDrag = onDrag,
onDragEnd = onDragEnd,
)
// Right, middle: place or cancel the lined-up piece.
HudConfirmButtons(
staged = staged != null,
modifier = Modifier.align(Alignment.CenterEnd).padding(end = 8.dp, top = 40.dp),
onConfirm = onConfirm,
onCancel = onCancelStaged,
)
// Right, middle: the card actions.
Column(
Modifier.align(Alignment.CenterEnd).padding(end = 6.dp),
verticalArrangement = Arrangement.spacedBy(4.dp),
horizontalAlignment = Alignment.CenterHorizontally,
) {
if (actions.ck) {
HudRoundButton("⬆", caption = CatanText.IMPROVE, enabled = actions.canImprove, diameter = 44.dp, onClick = onImprove)
HudRoundButton("🂠", caption = CatanText.CARDS_SHORT, enabled = actions.canPlayProgress, diameter = 44.dp, onClick = onProgress)
} else {
HudRoundButton("+", caption = CatanText.BUY_SHORT, enabled = actions.canBuyCard, diameter = 44.dp, onClick = onBuyCard)
HudRoundButton("🂠", caption = CatanText.CARDS_SHORT, enabled = actions.canPlayCard, diameter = 44.dp, onClick = onPlayCard)
}
}
// Bottom centre: your cards.
Box(
Modifier.align(Alignment.BottomCenter).padding(bottom = 10.dp, start = 120.dp, end = 250.dp)
.clip(RoundedCornerShape(14.dp))
Modifier.align(Alignment.BottomCenter).padding(bottom = 4.dp, start = 80.dp, end = 270.dp)
.clip(RoundedCornerShape(12.dp))
.background(MaterialTheme.colorScheme.surface.copy(alpha = 0.85f))
.horizontalScroll(rememberScrollState())
.padding(8.dp),
.padding(6.dp),
) { CatanHand(state, localSeat) }
// Bottom left: the log.
Column(Modifier.align(Alignment.BottomStart).padding(start = 8.dp, bottom = 10.dp)) {
Column(Modifier.align(Alignment.BottomStart).padding(start = 6.dp, bottom = 4.dp)) {
if (showLog) {
Surface(
modifier = Modifier.padding(bottom = 6.dp),
@@ -377,28 +385,18 @@ fun CatanHud(
CatanLog(state, Modifier.padding(8.dp).height(150.dp).width(260.dp))
}
}
HudRoundButton("☰", caption = CatanText.LOG_BUTTON, diameter = 44.dp, onClick = onToggleLog)
HudRoundButton("☰", caption = CatanText.LOG_BUTTON, diameter = 40.dp, onClick = onToggleLog)
}
// Bottom right: the turn button, trade, and the card actions.
Column(
Modifier.align(Alignment.BottomEnd).padding(end = 8.dp, bottom = 10.dp),
horizontalAlignment = Alignment.End,
verticalArrangement = Arrangement.spacedBy(4.dp),
// Bottom right: place / cancel a lined-up piece, trade, and the turn button.
Row(
Modifier.align(Alignment.BottomEnd).padding(end = 6.dp, bottom = 4.dp),
horizontalArrangement = Arrangement.spacedBy(6.dp),
verticalAlignment = Alignment.Bottom,
) {
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
if (actions.ck) {
HudRoundButton("⬆", caption = CatanText.IMPROVE, enabled = actions.canImprove, diameter = 44.dp, onClick = onImprove)
HudRoundButton("🂠", caption = CatanText.CARDS_SHORT, enabled = actions.canPlayProgress, diameter = 44.dp, onClick = onProgress)
} else {
HudRoundButton("+", caption = CatanText.BUY_SHORT, enabled = actions.canBuyCard, diameter = 44.dp, onClick = onBuyCard)
HudRoundButton("🂠", caption = CatanText.CARDS_SHORT, enabled = actions.canPlayCard, diameter = 44.dp, onClick = onPlayCard)
}
}
Row(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.Bottom) {
HudRoundButton("⇄", caption = CatanText.TRADE, enabled = actions.canTrade, diameter = 56.dp, onClick = onTrade)
PrimaryTurnButton(actions, onRoll, onEndTurn, onEndFreeRoads, onEndSmith, onRepickSetup)
}
HudConfirmButtons(staged = staged != null, onConfirm = onConfirm, onCancel = onCancelStaged)
HudRoundButton("⇄", caption = CatanText.TRADE, enabled = actions.canTrade, diameter = 48.dp, onClick = onTrade)
PrimaryTurnButton(actions, onRoll, onEndTurn, onEndFreeRoads, onEndSmith, onRepickSetup)
}
if (dragKind != null && dragAt == null) HudPill(CatanText.DRAG_HINT, Modifier.align(Alignment.TopCenter))
@@ -428,7 +426,7 @@ private fun PrimaryTurnButton(
private data class Quad(val glyph: String, val caption: String, val enabled: Boolean, val click: () -> Unit)
/** Everyone's colour, name, points and card count in one row across the top. */
/** Everyone's colour, name, points and card count in one thin row across the top. */
@Composable
private fun HudPlayerStrip(
state: org.prolibertate.games.game.catan.CatanState,
@@ -436,17 +434,25 @@ private fun HudPlayerStrip(
pointsOf: (Int) -> Int,
style: CatanStyle,
) {
Row(Modifier.fillMaxWidth().padding(horizontal = 6.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
Row(Modifier.fillMaxWidth().padding(horizontal = 6.dp, vertical = 2.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
(0 until state.playerCount).forEach { seat ->
CatanPlayerCard(
state = state,
seat = seat,
seats = seats,
points = pointsOf(seat),
modifier = Modifier.weight(1f),
style = style,
compact = true,
)
val onTurn = seat == state.turn
val shape = RoundedCornerShape(10.dp)
Row(
Modifier.weight(1f)
.clip(shape)
.background(MaterialTheme.colorScheme.surfaceVariant)
.border(if (onTurn) 2.dp else 1.dp, if (onTurn) MaterialTheme.colorScheme.primary else Color(0x33000000), shape)
.padding(horizontal = 8.dp, vertical = 4.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(6.dp),
) {
Box(
Modifier.size(14.dp).clip(CircleShape).background(style.seats[seat]).border(1.dp, style.pieceOutline, CircleShape),
)
Text(seats.label(seat), fontSize = 12.sp, fontWeight = FontWeight.Bold, maxLines = 1, modifier = Modifier.weight(1f))
Text("${pointsOf(seat)} VP · ${state.resourceCount(seat)}🂠", fontSize = 12.sp, maxLines = 1)
}
}
}
}