Skip to content

Commit c3fedca

Browse files
erectorOpsJusKIdding
authored andcommitted
feat: add support for Grand duels support selection (Fate-Grand-Automata#2065)
1 parent ac47c45 commit c3fedca

File tree

24 files changed

+301
-18
lines changed

24 files changed

+301
-18
lines changed
935 Bytes
Loading
644 Bytes
Loading
925 Bytes
Loading

app/src/main/java/io/github/fate_grand_automata/ui/pref_support/PreferredSupportScreen.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@ import androidx.lifecycle.viewmodel.compose.viewModel
2727
import io.github.fate_grand_automata.R
2828
import io.github.fate_grand_automata.prefs.core.Pref
2929
import io.github.fate_grand_automata.prefs.core.SupportPrefsCore
30+
import io.github.fate_grand_automata.scripts.enums.BondCEEffectEnum
3031
import io.github.fate_grand_automata.ui.Heading
3132
import io.github.fate_grand_automata.ui.OnResume
3233
import io.github.fate_grand_automata.ui.icon
34+
import io.github.fate_grand_automata.ui.prefs.ListPreference
3335
import io.github.fate_grand_automata.ui.prefs.Preference
3436
import io.github.fate_grand_automata.ui.prefs.PreferenceGroupHeader
3537
import io.github.fate_grand_automata.ui.prefs.SwitchPreference
3638
import io.github.fate_grand_automata.ui.prefs.remember
39+
import io.github.fate_grand_automata.util.stringRes
3740
import kotlinx.coroutines.Dispatchers
3841
import kotlinx.coroutines.launch
3942

@@ -100,6 +103,10 @@ private fun PreferredSupport(
100103
title = stringResource(R.string.p_battle_config_support_max_ascended)
101104
)
102105

106+
config.grandServant.SwitchPreference(
107+
title = stringResource(R.string.p_battle_config_support_grand_servant)
108+
)
109+
103110
Row(
104111
verticalAlignment = Alignment.CenterVertically,
105112
modifier = Modifier.padding(16.dp)
@@ -148,6 +155,16 @@ private fun PreferredSupport(
148155
config.mlb.SwitchPreference(
149156
title = stringResource(R.string.p_battle_config_support_mlb)
150157
)
158+
159+
config.bondCEEffect.ListPreference(
160+
title = stringResource(R.string.p_battle_config_support_bond_ce_effect_preference),
161+
entries = BondCEEffectEnum.entries
162+
.associateWith { stringResource(it.stringRes) }
163+
)
164+
165+
config.requireBothNormalAndRewardMatch.SwitchPreference(
166+
title = stringResource(R.string.p_battle_config_support_require_both_normal_and_reward_match)
167+
)
151168
}
152169
}
153170
}

app/src/main/java/io/github/fate_grand_automata/ui/support_img_namer/SupportImageNamer.kt

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,38 @@ private fun getSupportEntries(
5555
SupportImageKind.CE,
5656
frame.findViewById(R.id.support_img_ce_1)
5757
)
58-
58+
val ce2 = SupportImgEntry(
59+
SupportImageMaker.getCeImgPath(
60+
tempDir,
61+
2
62+
),
63+
SupportImageKind.CE,
64+
frame.findViewById(R.id.support_img_ce_2)
65+
)
66+
val ce3 = SupportImgEntry(
67+
SupportImageMaker.getCeImgPath(
68+
tempDir,
69+
3
70+
),
71+
SupportImageKind.CE,
72+
frame.findViewById(R.id.support_img_ce_3)
73+
)
74+
val ce4 = SupportImgEntry(
75+
SupportImageMaker.getCeImgPath(
76+
tempDir,
77+
4
78+
),
79+
SupportImageKind.CE,
80+
frame.findViewById(R.id.support_img_ce_4)
81+
)
82+
val ce5 = SupportImgEntry(
83+
SupportImageMaker.getCeImgPath(
84+
tempDir,
85+
5
86+
),
87+
SupportImageKind.CE,
88+
frame.findViewById(R.id.support_img_ce_5)
89+
)
5990
val friend0 = SupportImgEntry(
6091
SupportImageMaker.getFriendImgPath(
6192
tempDir,
@@ -73,7 +104,7 @@ private fun getSupportEntries(
73104
frame.findViewById(R.id.support_img_friend_1)
74105
)
75106

76-
return listOf(servant0, servant1, ce0, ce1, friend0, friend1)
107+
return listOf(servant0, servant1, ce0, ce1, ce2, ce3, ce4, ce5, friend0, friend1)
77108
}
78109

79110
suspend fun showSupportImageNamer(context: Context, storageProvider: StorageProvider) = withContext(Dispatchers.Main) {

app/src/main/java/io/github/fate_grand_automata/util/ImageLoader.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ class ImageLoader @Inject constructor(
134134
Images.OkKR -> "ok-kr.png"
135135
Images.Execute -> "execute.png"
136136
Images.SupportBlankCE -> "support_blank_ce.png"
137+
Images.GrandCeLabel -> "grand_ce_label.png"
138+
Images.BondCeEffectDefault -> "bond_ce_effect_default.png"
139+
Images.BondCeEffectNP -> "bond_ce_effect_np.png"
137140
}
138141

139142
override operator fun get(img: Images, gameServer: GameServer?): Pattern = synchronized(regionCachedPatterns) {

app/src/main/java/io/github/fate_grand_automata/util/LocalizationExtensions.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package io.github.fate_grand_automata.util
22

33
import io.github.fate_grand_automata.R
44
import io.github.fate_grand_automata.prefs.core.GameAreaMode
5+
import io.github.fate_grand_automata.scripts.enums.BondCEEffectEnum
56
import io.github.fate_grand_automata.scripts.enums.BraveChainEnum
67
import io.github.fate_grand_automata.scripts.enums.GameServer
78
import io.github.fate_grand_automata.scripts.enums.MaterialEnum
@@ -56,6 +57,13 @@ val SupportSelectionModeEnum.stringRes
5657
SupportSelectionModeEnum.Preferred -> R.string.p_support_mode_preferred
5758
}
5859

60+
val BondCEEffectEnum.stringRes
61+
get() = when (this) {
62+
BondCEEffectEnum.Ignore -> R.string.bond_ce_effect_ignore
63+
BondCEEffectEnum.Default -> R.string.bond_ce_effect_default
64+
BondCEEffectEnum.NP -> R.string.bond_ce_effect_np
65+
}
66+
5967
val ShuffleCardsEnum.stringRes
6068
get() = when (this) {
6169
ShuffleCardsEnum.None -> R.string.p_shuffle_cards_when_none

app/src/main/res/layout/support_img_namer.xml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,41 @@
8282
app:layout_constraintTop_toBottomOf="@id/support_img_ce_0"
8383
app:layout_constraintStart_toStartOf="parent"
8484
app:layout_constraintEnd_toEndOf="parent" />
85+
<include
86+
android:id="@+id/support_img_ce_2"
87+
layout="@layout/support_img_namer_item"
88+
android:layout_width="match_parent"
89+
android:layout_height="wrap_content"
90+
app:layout_constraintEnd_toEndOf="parent"
91+
app:layout_constraintStart_toStartOf="parent"
92+
app:layout_constraintTop_toBottomOf="@id/support_img_ce_1" />
93+
94+
<include
95+
android:id="@+id/support_img_ce_3"
96+
layout="@layout/support_img_namer_item"
97+
android:layout_width="match_parent"
98+
android:layout_height="wrap_content"
99+
app:layout_constraintEnd_toEndOf="parent"
100+
app:layout_constraintStart_toStartOf="parent"
101+
app:layout_constraintTop_toBottomOf="@id/support_img_ce_2" />
102+
103+
<include
104+
android:id="@+id/support_img_ce_4"
105+
layout="@layout/support_img_namer_item"
106+
android:layout_width="match_parent"
107+
android:layout_height="wrap_content"
108+
app:layout_constraintEnd_toEndOf="parent"
109+
app:layout_constraintStart_toStartOf="parent"
110+
app:layout_constraintTop_toBottomOf="@id/support_img_ce_3" />
111+
112+
<include
113+
android:id="@+id/support_img_ce_5"
114+
layout="@layout/support_img_namer_item"
115+
android:layout_width="match_parent"
116+
android:layout_height="wrap_content"
117+
app:layout_constraintEnd_toEndOf="parent"
118+
app:layout_constraintStart_toStartOf="parent"
119+
app:layout_constraintTop_toBottomOf="@id/support_img_ce_4" />
85120

86121
<!-- Friend Header -->
87122
<TextView
@@ -92,7 +127,7 @@
92127
android:text="@string/support_img_namer_friend_names"
93128
android:textSize="20sp"
94129
app:layout_constraintStart_toStartOf="parent"
95-
app:layout_constraintTop_toBottomOf="@id/support_img_ce_1" />
130+
app:layout_constraintTop_toBottomOf="@id/support_img_ce_5" />
96131

97132
<!-- Friend 0 -->
98133
<include

app/src/main/res/values-b+zh+CN/localized.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ Order Change"</string>
9999
<string name="p_battle_config_support_pref_servants">"偏好从者"</string>
100100
<string name="p_battle_config_support_max_ascended">"最终再临"</string>
101101
<string name="p_battle_config_support_pref_ces">"偏好礼装"</string>
102+
<string name="p_battle_config_support_grand_servant">"冠位从者"</string>
103+
<string name="p_battle_config_support_bond_ce_effect_preference">"Bond CE effect preference"</string>
104+
<string name="p_battle_config_support_require_both_normal_and_reward_match">"Match both free slot &amp; bonus-up (Bond/FP/QP/EXP) slot"</string>
105+
<string name="bond_ce_effect_ignore">"Ignore"</string>
106+
<string name="bond_ce_effect_default">"Default effects"</string>
107+
<string name="bond_ce_effect_np">"NP charge"</string>
102108
<string name="p_battle_config_support_mlb">"满破礼装"</string>
103109
<string name="p_battle_config_support_friend_names">"好友名称"</string>
104110
<string name="p_battle_config_support_friends_only">"只选择好友从者"</string>

app/src/main/res/values-b+zh+TW/localized.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ Order Change"</string>
9898
<string name="p_battle_config_support_fallback_selection_mode">"備用選取方式"</string>
9999
<string name="p_battle_config_support_pref_servants">"偏好從者"</string>
100100
<string name="p_battle_config_support_max_ascended">"最終再臨"</string>
101+
<string name="p_battle_config_support_grand_servant">"冠位從者"</string>
102+
<string name="p_battle_config_support_bond_ce_effect_preference">"Bond CE effect preference"</string>
103+
<string name="p_battle_config_support_require_both_normal_and_reward_match">"Match both free slot &amp; bonus-up (Bond/FP/QP/EXP) slot"</string>
104+
<string name="bond_ce_effect_ignore">"Ignore"</string>
105+
<string name="bond_ce_effect_default">"Default effects"</string>
106+
<string name="bond_ce_effect_np">"NP charge"</string>
101107
<string name="p_battle_config_support_pref_ces">"偏好禮裝"</string>
102108
<string name="p_battle_config_support_mlb">"滿破禮裝"</string>
103109
<string name="p_battle_config_support_friend_names">"好友名稱"</string>

0 commit comments

Comments
 (0)