Skip to content

Commit

Permalink
renamed target2 to TwoTargets
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurKun21 committed Nov 13, 2024
1 parent 995c575 commit 5c72f3b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChoice3
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerKukulkan
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerKukulkanTarget
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerSpaceIshtar
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerTarget2
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerTwoTargets

@AndroidEntryPoint
class SkillMakerActivity : AppCompatActivity() {
Expand Down Expand Up @@ -101,8 +101,8 @@ fun SkillMakerUI(
)
}

is SkillMakerNav.Target2 -> {
SkillMakerTarget2(
is SkillMakerNav.TwoTargets -> {
SkillMakerTwoTargets(
onTargetLeft = { vm.targetSkill(ServantTarget.Left) },
onTargetRight = { vm.targetSkill(ServantTarget.Right) }
)
Expand Down Expand Up @@ -141,9 +141,9 @@ fun SkillMakerUI(
is SkillMakerNav.SkillTarget -> {
SkillMakerTarget(
onSkillTarget = { vm.targetSkill(it) },
showTarget2 = nav.skill in Skill.Servant.skill3,
onTarget2 = {
navigate(SkillMakerNav.Target2(nav.skill))
showTwoTargets = nav.skill in Skill.Servant.skill3,
onTwoTargets = {
navigate(SkillMakerNav.TwoTargets(nav.skill))
},
showSpaceIshtar = nav.skill in Skill.Servant.skill2,
onSpaceIshtar = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sealed class SkillMakerNav {
data object Atk : SkillMakerNav()
data object OrderChange : SkillMakerNav()
data class SkillTarget(val skill: Skill) : SkillMakerNav()
data class Target2(val skill: Skill) : SkillMakerNav()
data class TwoTargets(val skill: Skill) : SkillMakerNav()
data class SpaceIshtar(val skill: Skill) : SkillMakerNav()
data class Kukulkan(val skill: Skill) : SkillMakerNav()
data class KukulkanTarget(val skill: Skill, val firstTarget: ServantTarget) : SkillMakerNav()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import kotlinx.coroutines.launch
@Composable
fun SkillMakerTarget(
onSkillTarget: (ServantTarget?) -> Unit,
showTarget2: Boolean,
onTarget2: () -> Unit,
showTwoTargets: Boolean,
onTwoTargets: () -> Unit,
showSpaceIshtar: Boolean,
onSpaceIshtar: () -> Unit,
showKukulkan: Boolean,
Expand Down Expand Up @@ -98,11 +98,11 @@ fun SkillMakerTarget(
}
}

if (showTarget2) {
if (showTwoTargets) {
ButtonWithHint(
onClick = onTarget2,
text = stringResource(R.string.skill_maker_target_2),
hint = stringArrayResource(R.array.skill_maker_target_2_array).joinToString("\n")
onClick = onTwoTargets,
text = stringResource(R.string.skill_maker_two_targets),
hint = stringArrayResource(R.array.skill_maker_two_targets_array).joinToString("\n")
)
}

Expand Down Expand Up @@ -240,8 +240,8 @@ private fun TestSkillMaker(
FGATheme {
SkillMakerTarget(
onSkillTarget = {},
showTarget2 = showEmiya,
onTarget2 = {},
showTwoTargets = showEmiya,
onTwoTargets = {},
showSpaceIshtar = showSpaceIshtar,
onSpaceIshtar = {},
showKukulkan = showKukulkan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ import io.github.fate_grand_automata.ui.FGATheme
import io.github.fate_grand_automata.ui.FGATitle

@Composable
fun SkillMakerTarget2(
fun SkillMakerTwoTargets(
onTargetLeft: () -> Unit,
onTargetRight: () -> Unit
) {
var target2Type by remember { mutableStateOf(Target2Type.Emiya) }
var twoTargetsType by remember { mutableStateOf(TwoTargetsType.Emiya) }

Column(
modifier = Modifier
.fillMaxHeight()
.padding(16.dp)
) {
FGATitle(
stringResource(target2Type.stringRes),
stringResource(twoTargetsType.stringRes),
)

Row(
Expand All @@ -58,13 +58,13 @@ fun SkillMakerTarget2(
TargetButton(
onClick = onTargetLeft,
color = colorResource(R.color.colorArtsResist),
text = stringResource(target2Type.targetAStringRes)
text = stringResource(twoTargetsType.targetAStringRes)
)

TargetButton(
onClick = onTargetRight,
color = colorResource(R.color.colorBuster),
text = stringResource(target2Type.targetBStringRes)
text = stringResource(twoTargetsType.targetBStringRes)
)
}

Expand All @@ -85,13 +85,13 @@ fun SkillMakerTarget2(
modifier = Modifier
.fillMaxWidth()
) {
Target2Type.entries.forEach { entry ->
TwoTargetsType.entries.forEach { entry ->
Button(
onClick = {
target2Type = entry
twoTargetsType = entry
},
enabled = target2Type != entry,
border = if (target2Type == entry) {
enabled = twoTargetsType != entry,
border = if (twoTargetsType == entry) {
BorderStroke(
width = Dp.Hairline,
color = MaterialTheme.colorScheme.primary,
Expand Down Expand Up @@ -127,31 +127,31 @@ fun TargetButton(
@Preview(name = "Light Mode", widthDp = 600, heightDp = 300)
@Preview(name = "Dark Mode", widthDp = 600, heightDp = 300, uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
fun TestEmiya() {
fun TestTwoTargets() {
FGATheme {
SkillMakerTarget2(onTargetLeft = { }, onTargetRight = { })
SkillMakerTwoTargets(onTargetLeft = { }, onTargetRight = { })
}
}

private enum class Target2Type {
private enum class TwoTargetsType {
Emiya,
BBDubai
}

private val Target2Type.stringRes
private val TwoTargetsType.stringRes
get() = when (this) {
Target2Type.Emiya -> R.string.skill_maker_emiya
Target2Type.BBDubai -> R.string.skill_maker_bb_dubai
TwoTargetsType.Emiya -> R.string.skill_maker_emiya
TwoTargetsType.BBDubai -> R.string.skill_maker_bb_dubai
}

private val Target2Type.targetAStringRes
private val TwoTargetsType.targetAStringRes
get() = when (this) {
Target2Type.Emiya -> R.string.skill_maker_arts
Target2Type.BBDubai -> R.string.skill_maker_bb_dubai_target_1
TwoTargetsType.Emiya -> R.string.skill_maker_arts
TwoTargetsType.BBDubai -> R.string.skill_maker_bb_dubai_target_1
}

private val Target2Type.targetBStringRes
private val TwoTargetsType.targetBStringRes
get() = when (this) {
Target2Type.Emiya -> R.string.skill_maker_buster
Target2Type.BBDubai -> R.string.skill_maker_bb_dubai_target_2
TwoTargetsType.Emiya -> R.string.skill_maker_buster
TwoTargetsType.BBDubai -> R.string.skill_maker_bb_dubai_target_2
}
4 changes: 2 additions & 2 deletions app/src/main/res/values/localized.xml
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ After pressing on the button, switch the app filter from \"Not optimized\" to \"
<item>"Charlotte"</item>
<item>"Hakunon"</item>
</string-array>
<string name="skill_maker_target_2">"Two Targets"</string>
<string-array name="skill_maker_target_2_array">
<string name="skill_maker_two_targets">"Two Targets"</string>
<string-array name="skill_maker_two_targets_array">
<item>"Emiya"</item>
<item>"BB Dubai"</item>
</string-array>
Expand Down

0 comments on commit 5c72f3b

Please sign in to comment.