Skip to content

Commit

Permalink
feat(character): add childhood trait
Browse files Browse the repository at this point in the history
relates to #7
  • Loading branch information
Patrick Hoefer committed Dec 31, 2020
1 parent c803916 commit 07c4393
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.preferredSize
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class TraitSelection {

interface LeveledTrait : Trait

enum class ChildhoodTrait(override val code: String, override val label: String) : LeveledTrait {
BOSSY("bossy", "Bossy"),
CHARMING("charming", "Charming"),
CURIOUS("curious", "Curious"),
PENSIVE("pensive", "Pensive"),
ROWDY("rowdy", "Rowdy"),
}

enum class CopingTrait(override val code: String, override val label: String) : LeveledTrait {
DRUNKARD("drunkard", "Drunkard"),
FLAGELLANT("flagellant", "Flagellant"),
Expand Down Expand Up @@ -196,6 +204,20 @@ class TraitSelection {
SADISTIC("sadistic", "Sadistic"),
}

@Composable
fun ChildhoodTraits(
selectionState: SnapshotStateMap<Trait, Boolean>
) {
val chunks = enumValues<ChildhoodTrait>().toList().chunked(5)
chunks.forEach {
Row {
it.forEach {
TraitIcon(it, selectionState)
}
}
}
}

@Composable
fun CopingTraits(
selectionState: SnapshotStateMap<Trait, Boolean>
Expand Down Expand Up @@ -281,7 +303,7 @@ class TraitSelection {
fun LeveledLifestyleTraits(selectionState: SnapshotStateMap<LeveledTrait, Int>) {
Row {
enumValues<LeveledLifestyleTrait>().forEach { trait ->
TraitIcon(trait, selectionState, 3)
TraitIcon(trait, selectionState, 3)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ fun CharacterFactoryView() {
val commanderTraitSelectionState = remember { mutableStateMapOf<TraitSelection.Trait, Boolean>() }
val criminalTraitSelectionState = remember { mutableStateMapOf<TraitSelection.Trait, Boolean>() }
val copingTraitSelectionState = remember { mutableStateMapOf<TraitSelection.Trait, Boolean>() }
val childhoodTraitSelectionState = remember { mutableStateMapOf<TraitSelection.Trait, Boolean>() }

val educationalTraitSelectionState = remember { mutableStateMapOf<TraitSelection.LeveledTrait, Int>() }
val leveledLifestyleTraitSelectionState = remember { mutableStateMapOf<TraitSelection.LeveledTrait, Int>() }
Expand Down Expand Up @@ -120,6 +121,9 @@ fun CharacterFactoryView() {
TraitSection("Coping Traits") {
traitSelection.CopingTraits(copingTraitSelectionState)
}
TraitSection("Childhood Traits") {
traitSelection.ChildhoodTraits(childhoodTraitSelectionState)
}
TraitSection("Educational Traits") {
traitSelection.EducationalTraits(educationalTraitSelectionState)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07c4393

Please sign in to comment.