Closed manueldidonna closed 4 years ago
// UI
@Composable
fun ModifyTime(val time: Time, onTimeChange: (Time) -> Unit) {
when(time) {
is Time.Date -> { /**TODO */ }
is Time.DayTime -> {
ShowSpinner(
options = listOf(Morning, Day, Night),
onSelection = { onTimeChange(time.copy(it)) }
)
}
}
}
@Composable
fun ModifyLocation(val saveData: SaveData, val locationId: Int, onLocationChange: (Int) -> Unit) {
val resources = PokemonResourcesAmbient.current.locations
val locations = remember { saveData.supportedLocationIds }
val list = remember { locations.map { Pair(it, resources.getLocationById(it, saveData.version) }
ShowSpinner(options = list, onSelection = onLocationChange)
}
Expose locations by wrapping them in a data class
data class Locations(val ids: List<Int>)
interface SaveData {
val locations: Locations
}
Needed information