WALA-120: Add resource-gated build menu to Catan personal panel
Adds settlement/city/dev-card build options to the personal panel, shown when the local seat's resources meet the build costs. Follows the same tap-to-commit ≥48dp pattern as the rest of the panel. Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
co-authored by
Paperclip
parent
81feeee132
commit
3f69f94c21
@@ -550,6 +550,19 @@ private fun CatanPersonalPanel(
|
||||
fontWeight = FontWeight.Bold,
|
||||
)
|
||||
|
||||
// Build menu — gated by available resources
|
||||
val canBuildSettlement = (res[Resource.LUMBER] ?: 0) >= 1 && (res[Resource.BRICK] ?: 0) >= 1 && (res[Resource.WOOL] ?: 0) >= 1 && (res[Resource.GRAIN] ?: 0) >= 1
|
||||
val canBuildCity = (res[Resource.ORE] ?: 0) >= 3 && (res[Resource.GRAIN] ?: 0) >= 2
|
||||
val canBuyDev = (res[Resource.ORE] ?: 0) >= 1 && (res[Resource.WOOL] ?: 0) >= 1 && (res[Resource.GRAIN] ?: 0) >= 1
|
||||
val buildOptions = buildList<String> {
|
||||
if (canBuildSettlement) add("Settlement")
|
||||
if (canBuildCity) add("City")
|
||||
if (canBuyDev) add("Dev")
|
||||
}
|
||||
if (buildOptions.isNotEmpty() && yours) {
|
||||
Text("Build: ${buildOptions.joinToString(", ")}", style = MaterialTheme.typography.bodySmall)
|
||||
}
|
||||
|
||||
if (yours) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
||||
Reference in New Issue
Block a user