[M] Move setting descriptions to i18n

pull/29/head
Azalea 2024-04-02 00:16:34 -04:00
parent 6a475434ad
commit 7728b4b1ab
6 changed files with 20 additions and 21 deletions

View File

@ -116,8 +116,6 @@ export interface MusicMeta {
export type AllMusic = { [key: string]: MusicMeta }
export interface GameOption {
name: string
desc: string
key: string
value: any
type: "Boolean"

View File

@ -87,6 +87,15 @@ export const EN_REF_SETTINGS = {
'settings.title': 'Settings',
'settings.tabs.profile': 'Profile',
'settings.tabs.game': 'Game',
'settings.fields.unlockMusic.name': 'Unlock All Music',
'settings.fields.unlockMusic.desc': 'Unlock all music and master difficulty in game.',
'settings.fields.unlockChara.name': 'Unlock All Characters',
'settings.fields.unlockChara.desc': 'Unlock all characters, voices, and partners in game.',
'settings.fields.unlockCollectables.name': 'Unlock All Collectables',
'settings.fields.unlockCollectables.desc': 'Unlock all collectables (nameplate, title, icon, frame) in game. ' +
'This setting is not relevant in chusan because in-game user box is disabled.',
'settings.fields.unlockTickets.name': 'Unlock All Tickets',
'settings.fields.unlockTickets.desc': 'Infinite map/ex tickets (note: maimai still limits which tickets can be used).',
}
export const EN_REF = { ...EN_REF_USER, ...EN_REF_Welcome, ...EN_REF_GENERAL,

View File

@ -134,11 +134,11 @@
<div class="field">
{#if field.type === "Boolean"}
<div class="bool">
<input id={field.name} type="checkbox" bind:checked={field.value}
<input id={field.key} type="checkbox" bind:checked={field.value}
on:change={() => submitGameOption(field.key, field.value)} />
<label for={field.name}>
<span class="name">{field.name}</span>
<span class="desc">{field.desc}</span>
<label for={field.key}>
<span class="name">{ts(`settings.fields.${field.key}.name`)}</span>
<span class="desc">{ts(`settings.fields.${field.key}.desc`)}</span>
</label>
</div>
{/if}

View File

@ -47,7 +47,7 @@ annotation class Doc(
@Target(AnnotationTarget.PROPERTY)
@Retention(AnnotationRetention.RUNTIME)
annotation class SettingField(val name: Str, val desc: Str)
annotation class SettingField
// Reflection
@Suppress("UNCHECKED_CAST")

View File

@ -20,11 +20,8 @@ class SettingsApi(
val fields = AquaGameOptions::class.vars()
.mapNotNull { it.findAnnotation<SettingField>()?.let { an -> it to an } }
val fieldMap = fields.associate { (f, _) -> f.name to f }
val fieldDesc = fields.map { (f, an) -> mapOf(
"key" to f.name,
"name" to an.name,
"desc" to an.desc,
"type" to f.returnType.jvmErasure.simpleName
val fieldDesc = fields.map { (f, _) -> mapOf(
"key" to f.name, "type" to f.returnType.jvmErasure.simpleName
) }
@API("get")

View File

@ -14,21 +14,16 @@ class AquaGameOptions(
@GeneratedValue(strategy = GenerationType.IDENTITY)
var id: Long = 0,
@SettingField("Unlock All Music",
"Unlock all music and master difficulty in game")
@SettingField
var unlockMusic: Boolean = false,
@SettingField("Unlock All Chara",
"Unlock all characters and partners in game")
@SettingField
var unlockChara: Boolean = false,
@SettingField("Unlock All Collectables",
"Unlock all collectables (nameplate, title, icon, frame) in game. " +
"This setting is not relevant in chusan because in-game user box is disabled in chusan.")
@SettingField
var unlockCollectables: Boolean = false,
@SettingField("Unlock All Tickets" ,
"Unlock all map tickets (the game still limits which tickets can be used)")
@SettingField
var unlockTickets: Boolean = false,
)