feat: i18n for choice prompt via promptKey, with fallback
This commit is contained in:
@@ -26,6 +26,7 @@ export interface Choice {
|
|||||||
text: string
|
text: string
|
||||||
textKey?: string
|
textKey?: string
|
||||||
prompt?: string
|
prompt?: string
|
||||||
|
promptKey?: string
|
||||||
targetScene: string
|
targetScene: string
|
||||||
conditions?: Condition[]
|
conditions?: Condition[]
|
||||||
effects?: Effect[]
|
effects?: Effect[]
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"handshake": "Shake hands with the stranger",
|
"handshake": "Shake hands with the stranger",
|
||||||
"reject": "Refuse to shake, stay alert"
|
"reject": "Refuse to shake, stay alert"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"handshake": "The stranger will remember your kindness"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_door": {
|
"right_door": {
|
||||||
@@ -26,6 +29,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"journey": "Embark on a journey of trust (requires trust >= 80)",
|
"journey": "Embark on a journey of trust (requires trust >= 80)",
|
||||||
"leave": "Leave this place"
|
"leave": "Leave this place"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"journey": "Your bond will change everything"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"investigation_site": {
|
"investigation_site": {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"handshake": "見知らぬ人と握手する",
|
"handshake": "見知らぬ人と握手する",
|
||||||
"reject": "握手を断り、警戒を続ける"
|
"reject": "握手を断り、警戒を続ける"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"handshake": "見知らぬ人はあなたの優しさを覚えている"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_door": {
|
"right_door": {
|
||||||
@@ -26,6 +29,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"journey": "信頼の旅に出る(trust >= 80 が必要)",
|
"journey": "信頼の旅に出る(trust >= 80 が必要)",
|
||||||
"leave": "ここを去る"
|
"leave": "ここを去る"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"journey": "あなたの絆が全てを変える"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"investigation_site": {
|
"investigation_site": {
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"handshake": "与陌生人握手",
|
"handshake": "与陌生人握手",
|
||||||
"reject": "拒绝握手,保持警惕"
|
"reject": "拒绝握手,保持警惕"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"handshake": "陌生人会记住你的善意"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"right_door": {
|
"right_door": {
|
||||||
@@ -26,6 +29,9 @@
|
|||||||
"choice": {
|
"choice": {
|
||||||
"journey": "开启信任的旅程(需要 trust >= 80)",
|
"journey": "开启信任的旅程(需要 trust >= 80)",
|
||||||
"leave": "离开这里"
|
"leave": "离开这里"
|
||||||
|
},
|
||||||
|
"prompt": {
|
||||||
|
"journey": "你们的羁绊将改变一切"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"investigation_site": {
|
"investigation_site": {
|
||||||
|
|||||||
@@ -211,6 +211,7 @@
|
|||||||
"text": "与陌生人握手",
|
"text": "与陌生人握手",
|
||||||
"textKey": "left_door.choice.handshake",
|
"textKey": "left_door.choice.handshake",
|
||||||
"prompt": "陌生人会记住你的善意",
|
"prompt": "陌生人会记住你的善意",
|
||||||
|
"promptKey": "left_door.prompt.handshake",
|
||||||
"targetScene": "trust_ending",
|
"targetScene": "trust_ending",
|
||||||
"effects": [
|
"effects": [
|
||||||
{ "type": "add", "target": "trust", "value": 30 }
|
{ "type": "add", "target": "trust", "value": 30 }
|
||||||
@@ -322,6 +323,7 @@
|
|||||||
"text": "开启信任的旅程(需要 trust >= 80)",
|
"text": "开启信任的旅程(需要 trust >= 80)",
|
||||||
"textKey": "trust_ending.choice.journey",
|
"textKey": "trust_ending.choice.journey",
|
||||||
"prompt": "你们的羁绊将改变一切",
|
"prompt": "你们的羁绊将改变一切",
|
||||||
|
"promptKey": "trust_ending.prompt.journey",
|
||||||
"targetScene": "secret_ending",
|
"targetScene": "secret_ending",
|
||||||
"conditions": [
|
"conditions": [
|
||||||
{ "variable": "trust", "op": ">=", "value": 80 }
|
{ "variable": "trust", "op": ">=", "value": 80 }
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ function handleChoose(index: number) {
|
|||||||
if (!choiceEnabled.value) return
|
if (!choiceEnabled.value) return
|
||||||
const choice = props.choices[index]
|
const choice = props.choices[index]
|
||||||
if (choice?.prompt) {
|
if (choice?.prompt) {
|
||||||
emit('prompt', choice.prompt)
|
emit('prompt', t(choice.promptKey || choice.prompt))
|
||||||
}
|
}
|
||||||
emit('choose', index)
|
emit('choose', index)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user