feat: 剧场化工具 theater.js(互动形态判定 + 开场演出数据提取)
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
// 剧场化工具:互动形态判定 + 开场演出数据提取(决策树模型零改动)
|
||||||
|
|
||||||
|
const INTERACTION_MAP = { 2: 'PropPick', 3: 'StepSort', 5: 'DragPlace', 7: 'FindSpot', 8: 'LinkMatch' }
|
||||||
|
|
||||||
|
// 互动形态判定:config 互动节点 → 对应触控组件;普通决策节点 → 动作卡
|
||||||
|
// (触控组件只有 success/fail 双出口,普通节点多分支选项语义由 ActionCard 完整保留)
|
||||||
|
export function pickInteraction(node) {
|
||||||
|
if (node && node.config && INTERACTION_MAP[node.interaction_type]) {
|
||||||
|
return INTERACTION_MAP[node.interaction_type]
|
||||||
|
}
|
||||||
|
return 'ActionCard'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开场演出道具:入口节点选项的道具名去重,最多 4 个
|
||||||
|
export function entryProps(entry) {
|
||||||
|
const names = []
|
||||||
|
for (const o of (entry && entry.options) || []) {
|
||||||
|
if (o.prop && o.prop.name && !names.includes(o.prop.name)) {
|
||||||
|
names.push(o.prop.name)
|
||||||
|
if (names.length >= 4) break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return names
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开场演出角色:入口节点人物(可能为空)
|
||||||
|
export function entryCharacter(entry) {
|
||||||
|
return entry && entry.character ? entry.character : null
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user