Add inspiration support in the game master screen.

This commit is contained in:
Andres Gomez, Thomas (ITDV RL) 2024-08-21 15:44:25 +02:00
parent 70148c9987
commit abdb39abc2
5 changed files with 52 additions and 16 deletions

View file

@ -34,6 +34,7 @@ data class AttributesSummaryUio(
val dc: SummaryRowUio, val dc: SummaryRowUio,
val initiative: SummaryRowUio, val initiative: SummaryRowUio,
val speed: SummaryRowUio, val speed: SummaryRowUio,
val inspiration: SummaryRowUio,
) )
@Composable @Composable
@ -74,6 +75,9 @@ fun AttributesSummary(
SummaryRow( SummaryRow(
row = attributes.speed, row = attributes.speed,
) )
SummaryRow(
row = attributes.inspiration,
)
} }
} }
Text( Text(

View file

@ -54,7 +54,7 @@ data class SummaryCellUio(
@Stable @Stable
data class Proficiency( data class Proficiency(
val label: String, val label: String?,
val multiplier: Int, val multiplier: Int,
) : Mode() ) : Mode()
@ -93,7 +93,7 @@ fun maxLabel(
@Stable @Stable
fun proficiency( fun proficiency(
label: String, label: String?,
multiplier: Int, multiplier: Int,
): SummaryCellUio { ): SummaryCellUio {
return SummaryCellUio( return SummaryCellUio(
@ -226,11 +226,13 @@ private fun SummaryProficiency(
.padding(start = 4.dp) .padding(start = 4.dp)
.then(other = modifier), .then(other = modifier),
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
) { ) {
MasteryCircle( MasteryCircle(
size = MaterialTheme.lexicon.dimens.summary.mastery, size = MaterialTheme.lexicon.dimens.summary.mastery,
multiplier = value.multiplier, multiplier = value.multiplier,
) )
if (value.label != null) {
AnimatedContent( AnimatedContent(
modifier = Modifier.weight(weight = 1f), modifier = Modifier.weight(weight = 1f),
targetState = value.label, targetState = value.label,
@ -247,6 +249,7 @@ private fun SummaryProficiency(
) )
} }
} }
}
} }
@Stable @Stable

View file

@ -157,6 +157,18 @@ private fun SummaryRowPreview() {
) )
} }
) )
SummaryRow(
row = remember {
SummaryRowUio(
label = R.string.character_sheet_proficiency_perception,
c1 = mutableStateOf(proficiency(null, 1)),
c2 = mutableStateOf(proficiency(null, 0)),
c3 = mutableStateOf(proficiency(null, 1)),
c4 = mutableStateOf(proficiency(null, 0)),
c5 = mutableStateOf(proficiency(null, 0)),
)
}
)
SummaryRow( SummaryRow(
row = remember { row = remember {
SummaryRowUio( SummaryRowUio(

View file

@ -8,6 +8,7 @@ import com.pixelized.rplexicon.R
import com.pixelized.rplexicon.ui.screens.summary.composable.AttributesSummaryUio import com.pixelized.rplexicon.ui.screens.summary.composable.AttributesSummaryUio
import com.pixelized.rplexicon.ui.screens.summary.composable.common.SummaryRowUio import com.pixelized.rplexicon.ui.screens.summary.composable.common.SummaryRowUio
import com.pixelized.rplexicon.ui.screens.summary.composable.common.label import com.pixelized.rplexicon.ui.screens.summary.composable.common.label
import com.pixelized.rplexicon.ui.screens.summary.composable.common.proficiency
@Composable @Composable
@Stable @Stable
@ -54,6 +55,14 @@ fun rememberAttributesSummary(): AttributesSummaryUio {
c4 = mutableStateOf(label(label = "10m")), c4 = mutableStateOf(label(label = "10m")),
c5 = mutableStateOf(label(label = "10m")), c5 = mutableStateOf(label(label = "10m")),
), ),
inspiration = SummaryRowUio(
label = R.string.character_sheet_title_inspiration,
c1 = mutableStateOf(proficiency(label = null, multiplier = 0)),
c2 = mutableStateOf(proficiency(label = null, multiplier = 1)),
c3 = mutableStateOf(proficiency(label = null, multiplier = 1)),
c4 = mutableStateOf(proficiency(label = null, multiplier = 1)),
c5 = mutableStateOf(proficiency(label = null, multiplier = 1)),
)
) )
} }
} }

View file

@ -76,6 +76,7 @@ class SummaryFactory @Inject constructor(
dc = SummaryRowUio(label = R.string.character_sheet_title_dc), dc = SummaryRowUio(label = R.string.character_sheet_title_dc),
initiative = SummaryRowUio(label = R.string.character_sheet_title_initiative), initiative = SummaryRowUio(label = R.string.character_sheet_title_initiative),
speed = SummaryRowUio(label = R.string.character_sheet_title_speed), speed = SummaryRowUio(label = R.string.character_sheet_title_speed),
inspiration = SummaryRowUio(label = R.string.character_sheet_title_inspiration),
) )
val characteristics = CharacteristicsSummaryUio( val characteristics = CharacteristicsSummaryUio(
strength = SummaryRowUio(label = R.string.character_sheet_stat_strength), strength = SummaryRowUio(label = R.string.character_sheet_stat_strength),
@ -217,12 +218,17 @@ class SummaryFactory @Inject constructor(
val speed = label( val speed = label(
label = "${max(sheet.speed + status[Property.SPEED].sum, 0)}m", label = "${max(sheet.speed + status[Property.SPEED].sum, 0)}m",
) )
val inspiration = proficiency(
label = null,
multiplier = fire?.skills?.get(INSPIRATION) ?: 0
)
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
attributes.hp.get(sheet)?.value = hitPoint attributes.hp.get(sheet)?.value = hitPoint
attributes.ac.get(sheet)?.value = armorClass attributes.ac.get(sheet)?.value = armorClass
attributes.dc.get(sheet)?.value = dC attributes.dc.get(sheet)?.value = dC
attributes.initiative.get(sheet)?.value = initiative attributes.initiative.get(sheet)?.value = initiative
attributes.speed.get(sheet)?.value = speed attributes.speed.get(sheet)?.value = speed
attributes.inspiration.get(sheet)?.value = inspiration
} }
} }
withContext(Dispatchers.Main) { withContext(Dispatchers.Main) {
@ -757,6 +763,8 @@ class SummaryFactory @Inject constructor(
private const val ENTER_ANIMATION_INITIAL_DELAY = 250L private const val ENTER_ANIMATION_INITIAL_DELAY = 250L
private const val ENTER_ANIMATION_DELAY = 100L private const val ENTER_ANIMATION_DELAY = 100L
private const val INSPIRATION = "Inspiration"
private const val PRONE = "À terre" private const val PRONE = "À terre"
private const val GRAPPLED = "Agrippé" private const val GRAPPLED = "Agrippé"
private const val DEAFENED = "Assourdi" private const val DEAFENED = "Assourdi"