docs: add battle system, conditional routing, key moments, and creators guide docs

This commit is contained in:
2026-06-14 16:42:16 +08:00
parent 02a82e9801
commit c75db2886f
5 changed files with 255 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ interface SceneNode {
choices?: Choice[]
hotspots?: Hotspot[]
qte?: QTEDefinition
nextScene?: string
nextScene?: string | Choice[]
onEnter?: Effect[]
loopStart?: number
loopEnd?: number
@@ -59,6 +59,9 @@ interface SceneNode {
bgmDuckFade?: number
videoMuted?: boolean
skippable?: boolean
keyMoment?: boolean
battleHUD?: BattleHUDEntry[]
battleResult?: BattleResultDef
}
```
@@ -76,7 +79,7 @@ interface SceneNode {
| `choices` | Choice[] | 选项列表 |
| `hotspots` | Hotspot[] | 可点击热点区域 |
| `qte` | QTEDefinition | QTE 定义 |
| `nextScene` | string | 无选项时的默认跳转场景 |
| `nextScene` | string \| Choice[] | 无选项时的默认跳转。字符串为单一场景 ID数组为条件路由遍历第一个满足 conditions 的跳转。末尾无条件项作为默认目标 |
| `onEnter` | Effect[] | 进入场景时触发的效果 |
| `loopStart` | number | 循环起始时间(秒) |
| `loopEnd` | number | 循环结束时间(秒)。视频播放到 loopEnd 时跳回 loopStart |
@@ -87,6 +90,9 @@ interface SceneNode {
| `bgmDuckFade` | number | BGM Duck 过渡时长(秒),默认 0.5 |
| `videoMuted` | boolean | 视频静音(配合独立 BGM 使用) |
| `skippable` | boolean | `false` = 禁止跳过(用于 QTE 等关键场景) |
| `keyMoment` | boolean | StoryGallery 中是否展示为关键节点。`true`=强制展示,`false`=强制隐藏,未设置时自动判断(章节起始/有 choice/是结局) |
| `battleHUD` | BattleHUDEntry[] | 战斗场景中显示的角色属性 HUD。每个 entry 为一个角色(头像 + stats 列表) |
| `battleResult` | BattleResultDef | 胜利结算面板。视频结束后弹出,展示战斗统计数据。战败场景不配置此字段 |
---
@@ -111,7 +117,6 @@ interface Choice {
| `textKey` | i18n key优先于 `text`。如 `"intro.choice.left_door"` |
| `prompt` | 选择后浮现的提示文字(回退值) |
| `promptKey` | prompt 的 i18n key。如 `"left_door.prompt.handshake"`。优先于 `prompt` |
| `promptKey` | prompt 的 i18n key。如 `"left_door.prompt.handshake"` |
| `targetScene` | 目标场景 ID |
| `conditions` | 显示条件,不满足的选项隐藏 |
| `effects` | 选择后触发的效果 |
@@ -178,7 +183,6 @@ interface QTEDefinition {
| `triggerTime` | 触发时间(秒),视频播放到此时间弹出 QTE |
| `prompt` | 提示文字(回退值) |
| `promptKey` | i18n key。如 `"right_door.qte.dodge"`。优先于 `prompt` |
| `promptKey` | i18n key。如 `"right_door.qte.dodge"` |
| `keys` | 有效按键列表,如 `["ArrowLeft", "ArrowRight", "a", "d"]` |
| `timeLimit` | 限时秒数 |
| `successScene` | 成功跳转场景 |
@@ -295,3 +299,56 @@ interface LocalesConfig {
|------|------|
| `path` | 语言文件目录(相对于 `assetBase`),如 `"locales/"` |
| `languages` | 支持的语言列表,如 `["zh", "en", "ja"]` |
### BattleHUDEntry / BattleHUDStat
战斗场景中显示的角色属性 HUD。配置在 `SceneNode.battleHUD`
```typescript
interface BattleHUDEntry {
label: string
labelKey?: string
portrait?: string
stats: BattleHUDStat[]
}
interface BattleHUDStat {
variable: string
label: string
labelKey?: string
max?: number
style?: 'bar' | 'number'
}
```
| 字段 | 说明 |
|------|------|
| `label` | 角色名称(回退值) |
| `labelKey` | 角色名称 i18n key |
| `portrait` | 角色头像路径 |
| `stats` | 属性数组。`variable`/`label`/`labelKey`/`max`/`style``style` 缺省时根据有无 `max` 自动判断(有则为 bar无则为 number |
### BattleResultDef / BattleResultStat
战斗胜利结算面板。配置在 `SceneNode.battleResult`
```typescript
interface BattleResultDef {
title: string
titleKey?: string
stats: BattleResultStat[]
}
interface BattleResultStat {
label: string
labelKey?: string
variable: string
max?: number
}
```
| 字段 | 说明 |
|------|------|
| `title` | 结算标题(回退值) |
| `titleKey` | 标题 i18n key |
| `stats` | 统计项数组。`variable`/`label`/`labelKey`/`max` |