Remove translation from the alteration class.
This commit is contained in:
parent
8a212ce69d
commit
073b8ac61d
3 changed files with 17 additions and 17 deletions
|
|
@ -31,7 +31,6 @@ class SpellBookParser @Inject constructor() {
|
||||||
row is List<*> -> {
|
row is List<*> -> {
|
||||||
val name = row.parse(NAME)
|
val name = row.parse(NAME)
|
||||||
val level = row.parse(LEVEL)?.toIntOrNull()
|
val level = row.parse(LEVEL)?.toIntOrNull()
|
||||||
val originalName = row.parse(T_NAME)
|
|
||||||
val school = parseSchool(row.parse(SCHOOL))
|
val school = parseSchool(row.parse(SCHOOL))
|
||||||
val castingTime = row.parse(CASTING_TIME)
|
val castingTime = row.parse(CASTING_TIME)
|
||||||
val range = row.parse(RANGE)
|
val range = row.parse(RANGE)
|
||||||
|
|
@ -40,7 +39,6 @@ class SpellBookParser @Inject constructor() {
|
||||||
val ritual = row.parse(RITUAL)?.toBoolean() ?: false
|
val ritual = row.parse(RITUAL)?.toBoolean() ?: false
|
||||||
if (name != null
|
if (name != null
|
||||||
&& level != null
|
&& level != null
|
||||||
&& originalName != null
|
|
||||||
&& school != null
|
&& school != null
|
||||||
&& castingTime != null
|
&& castingTime != null
|
||||||
&& range != null
|
&& range != null
|
||||||
|
|
@ -49,7 +47,6 @@ class SpellBookParser @Inject constructor() {
|
||||||
) {
|
) {
|
||||||
Spell(
|
Spell(
|
||||||
name = name,
|
name = name,
|
||||||
originalName = originalName,
|
|
||||||
level = level,
|
level = level,
|
||||||
school = school,
|
school = school,
|
||||||
castingTime = castingTime,
|
castingTime = castingTime,
|
||||||
|
|
@ -77,7 +74,6 @@ class SpellBookParser @Inject constructor() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val NAME = "Nom"
|
private const val NAME = "Nom"
|
||||||
private const val T_NAME = "Traduction"
|
|
||||||
private const val SCHOOL = "École"
|
private const val SCHOOL = "École"
|
||||||
private const val LEVEL = "Niveau"
|
private const val LEVEL = "Niveau"
|
||||||
private const val CASTING_TIME = "Temps d'incantation"
|
private const val CASTING_TIME = "Temps d'incantation"
|
||||||
|
|
@ -89,7 +85,6 @@ class SpellBookParser @Inject constructor() {
|
||||||
private val COLUMNS
|
private val COLUMNS
|
||||||
get() = listOf(
|
get() = listOf(
|
||||||
NAME,
|
NAME,
|
||||||
T_NAME,
|
|
||||||
LEVEL,
|
LEVEL,
|
||||||
SCHOOL,
|
SCHOOL,
|
||||||
CASTING_TIME,
|
CASTING_TIME,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ import com.pixelized.rplexicon.utilitary.extentions.local.icon
|
||||||
data class SpellUio(
|
data class SpellUio(
|
||||||
@DrawableRes val icon: Int,
|
@DrawableRes val icon: Int,
|
||||||
val name: String,
|
val name: String,
|
||||||
val translated: String,
|
val translated: String?,
|
||||||
val castingTime: String,
|
val castingTime: String,
|
||||||
val range: String,
|
val range: String,
|
||||||
val duration: String,
|
val duration: String,
|
||||||
|
|
@ -95,6 +95,7 @@ fun Spell(
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
text = spell.name,
|
text = spell.name,
|
||||||
)
|
)
|
||||||
|
spell.translated?.let {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.alignByBaseline(),
|
modifier = Modifier.alignByBaseline(),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
|
|
@ -102,9 +103,10 @@ fun Spell(
|
||||||
fontStyle = FontStyle.Italic,
|
fontStyle = FontStyle.Italic,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
text = spell.translated,
|
text = it,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.spacedBy(space = 4.dp),
|
horizontalArrangement = Arrangement.spacedBy(space = 4.dp),
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,16 @@ package com.pixelized.rplexicon.ui.screens.character.factory
|
||||||
import com.pixelized.rplexicon.model.AssignedSpell
|
import com.pixelized.rplexicon.model.AssignedSpell
|
||||||
import com.pixelized.rplexicon.model.CharacterSheet
|
import com.pixelized.rplexicon.model.CharacterSheet
|
||||||
import com.pixelized.rplexicon.model.Property
|
import com.pixelized.rplexicon.model.Property
|
||||||
|
import com.pixelized.rplexicon.repository.data.DescriptionRepository
|
||||||
import com.pixelized.rplexicon.ui.screens.character.composable.actions.SpellUio
|
import com.pixelized.rplexicon.ui.screens.character.composable.actions.SpellUio
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.icon
|
import com.pixelized.rplexicon.utilitary.extentions.icon
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.local.icon
|
import com.pixelized.rplexicon.utilitary.extentions.local.icon
|
||||||
import com.pixelized.rplexicon.utilitary.extentions.modifier
|
import com.pixelized.rplexicon.utilitary.extentions.modifier
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class SpellUioFactory @Inject constructor() {
|
class SpellUioFactory @Inject constructor(
|
||||||
|
private val descriptionRepository: DescriptionRepository,
|
||||||
|
) {
|
||||||
|
|
||||||
fun toUio(assignedSpell: AssignedSpell, characterSheet: CharacterSheet): SpellUio {
|
fun toUio(assignedSpell: AssignedSpell, characterSheet: CharacterSheet): SpellUio {
|
||||||
val hit = assignedSpell.hit?.let { dice ->
|
val hit = assignedSpell.hit?.let { dice ->
|
||||||
|
|
@ -48,7 +51,7 @@ class SpellUioFactory @Inject constructor() {
|
||||||
return SpellUio(
|
return SpellUio(
|
||||||
icon = assignedSpell.spell.school.icon,
|
icon = assignedSpell.spell.school.icon,
|
||||||
name = assignedSpell.spell.name,
|
name = assignedSpell.spell.name,
|
||||||
translated = assignedSpell.spell.originalName,
|
translated = descriptionRepository.find(name = assignedSpell.spell.name)?.original,
|
||||||
castingTime = assignedSpell.spell.castingTime,
|
castingTime = assignedSpell.spell.castingTime,
|
||||||
range = assignedSpell.spell.range,
|
range = assignedSpell.spell.range,
|
||||||
duration = assignedSpell.spell.duration,
|
duration = assignedSpell.spell.duration,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue