From f044ed0b60dafd6465b2b672fd6313b8b9148e49 Mon Sep 17 00:00:00 2001 From: cocos02 Date: Tue, 9 Jun 2026 15:54:55 +0800 Subject: [PATCH] refactor: switch to key-based i18n for choices, revert inline textEn approach --- engine/types.ts | 1 - public/scenes/demo.json | 16 ---------------- src/components/ChoicePanel.vue | 11 +++-------- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/engine/types.ts b/engine/types.ts index 22dd3c3..3634474 100644 --- a/engine/types.ts +++ b/engine/types.ts @@ -24,7 +24,6 @@ export interface SceneNode { export interface Choice { text: string textKey?: string - textEn?: string targetScene: string conditions?: Condition[] effects?: Effect[] diff --git a/public/scenes/demo.json b/public/scenes/demo.json index 957db82..8640120 100644 --- a/public/scenes/demo.json +++ b/public/scenes/demo.json @@ -44,7 +44,6 @@ "choices": [ { "text": "走向左边那扇发光的门", - "textEn": "Walk towards the glowing door on the left", "textKey": "scene.intro.choice.left_door", "targetScene": "left_door", "effects": [ @@ -53,7 +52,6 @@ }, { "text": "走向右边那扇普通的门", - "textEn": "Walk towards the plain door on the right", "textKey": "scene.intro.choice.right_door", "targetScene": "right_door", "effects": [ @@ -62,13 +60,11 @@ }, { "text": "仔细搜索房间", - "textEn": "Search the room carefully", "textKey": "scene.intro.choice.search", "targetScene": "investigation_site" }, { "text": "留在原地,什么也不做", - "textEn": "Stay where you are, do nothing", "textKey": "scene.intro.choice.stay", "targetScene": "stay" } @@ -111,7 +107,6 @@ } ], "choices": [ - { "text": "离开房间", "textEn": "Leave the room", "targetScene": "corridor" } ] }, "corridor": { @@ -151,7 +146,6 @@ "choices": [ { "text": "与陌生人握手", - "textEn": "Shake hands with the stranger", "targetScene": "trust_ending", "effects": [ { "type": "add", "target": "trust", "value": 30 } @@ -159,7 +153,6 @@ }, { "text": "拒绝握手,保持警惕", - "textEn": "Refuse to shake hands, stay alert", "targetScene": "alone_ending" } ] @@ -191,12 +184,10 @@ "choices": [ { "text": "继续前进", - "textEn": "Continue forward", "targetScene": "continue_ending" }, { "text": "回头", - "textEn": "Turn back", "targetScene": "intro" } ] @@ -207,12 +198,10 @@ "choices": [ { "text": "继续前进", - "textEn": "Continue forward", "targetScene": "continue_ending" }, { "text": "回头", - "textEn": "Turn back", "targetScene": "intro" } ] @@ -223,12 +212,10 @@ "choices": [ { "text": "返回调查现场", - "textEn": "Return to the investigation scene", "targetScene": "investigation_site" }, { "text": "离开", - "textEn": "Leave", "targetScene": "corridor" } ] @@ -243,7 +230,6 @@ "loopStart": 3.0, "loopEnd": 6.0, "choices": [ - { "text": "站起来离开", "textEn": "Stand up and leave", "targetScene": "alone_ending" } ] }, "trust_ending": { @@ -252,7 +238,6 @@ "choices": [ { "text": "开启信任的旅程(需要 trust >= 80)", - "textEn": "Embark on a journey of trust (requires trust >= 80)", "targetScene": "secret_ending", "conditions": [ { "variable": "trust", "op": ">=", "value": 80 } @@ -260,7 +245,6 @@ }, { "text": "离开这里", - "textEn": "Leave this place", "targetScene": "alone_ending" } ] diff --git a/src/components/ChoicePanel.vue b/src/components/ChoicePanel.vue index 4998e15..81c4b16 100644 --- a/src/components/ChoicePanel.vue +++ b/src/components/ChoicePanel.vue @@ -1,5 +1,5 @@