分支剧情节点图谱 (JSON Graph)
{
"slug": "rebirth-top-star",
"title": "重生为顶流:星光迷局",
"en_title": "Reborn as a Top Star: Starlight Mystery",
"player_url": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/index.html",
"start": "open",
"nodes": {
"open": {
"id": "open",
"title": "第1幕:面对逆转重生的机会,你选择",
"act": 1,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/open-4a3f6a8969bbca46.mp4",
"ending": false,
"choices": [
{
"label": "立刻进入记忆深处查明真相",
"to": "memory"
},
{
"label": "犹豫不决先考虑一下",
"to": "think"
}
]
},
"think": {
"id": "think",
"title": "第1幕:在迷雾中犹豫徘徊",
"act": 1,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/think-40e585308c7fe2fb.mp4",
"ending": "BAD END",
"choices": []
},
"memory": {
"id": "memory",
"title": "第2幕:潜入记忆碎片,直面昔日恋情",
"act": 2,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/memory-c87434c1355cff80.mp4",
"ending": false,
"choices": [
{
"label": "珍惜这段刻骨铭心的感情",
"to": "contract"
},
{
"label": "彻底放手专心搞事业",
"to": "e_career"
}
]
},
"contract": {
"id": "contract",
"title": "第3幕:面对经纪公司的严苛恋爱合约",
"act": 3,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/contract-a233e41919c76bac.mp4",
"ending": false,
"choices": [
{
"label": "暂时隐忍签下合约",
"to": "role"
},
{
"label": "拒签合约全凭实力说话",
"to": "e_talent"
}
]
},
"role": {
"id": "role",
"title": "第4幕:面对男一号试镜的明争暗斗",
"act": 4,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/role-5bb773d29232d7ca.mp4",
"ending": false,
"choices": [
{
"label": "全力争取拿下核心角色",
"to": "hotel"
},
{
"label": "大度让出机会",
"to": "e_yield"
}
]
},
"hotel": {
"id": "hotel",
"title": "第5幕:庆功宴微醺夜,是否送雷初夏回酒店?",
"act": 5,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/hotel-664017a61a24c3f5.mp4",
"ending": false,
"choices": [
{
"label": "亲自护送雷初夏回酒店",
"to": "confess"
},
{
"label": "借口不顺路独自离开",
"to": "e_road"
}
]
},
"confess": {
"id": "confess",
"title": "第6幕:深夜走廊的心跳告白,你的回应是",
"act": 6,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/confess-9692bbc0b696530d.mp4",
"ending": false,
"choices": [
{
"label": "为了保护她先婉拒告白",
"to": "trust"
},
{
"label": "不顾一切接受她的告白",
"to": "e_accept"
}
]
},
"trust": {
"id": "trust",
"title": "第7幕:克制情感后,面对流言风暴",
"act": 7,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/trust-75ce85a8eeeae513.mp4",
"ending": false,
"choices": [
{
"label": "保持警惕表示存疑,展开调查",
"to": "quiz"
},
{
"label": "毫无保留选择相信",
"to": "e_believe"
}
]
},
"quiz": {
"id": "quiz",
"title": "第8幕【推理时刻】:究竟是谁在幕后泄露了私密照?",
"act": 8,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/quiz-5c67a4bbd0b833b6.mp4",
"ending": false,
"choices": [
{
"label": "锁定幕后真凶:江君",
"to": "truth"
},
{
"label": "怀疑商业对手:袁帅",
"to": "w_yuan"
},
{
"label": "怀疑合伙人:萧闯",
"to": "w_xiao"
},
{
"label": "怀疑顶流女星:乔晶晶",
"to": "w_qiao"
}
]
},
"w_yuan": {
"id": "w_yuan",
"title": "指认袁帅:线索中断,真凶另有其人",
"act": 8,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_yuan-2e1b29fc9ac0b273.mp4",
"ending": false,
"choices": [
{
"label": "推理错误,返回重新指认",
"to": "quiz"
}
]
},
"w_xiao": {
"id": "w_xiao",
"title": "指认萧闯:判断失误,陷入舆论被动",
"act": 8,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_xiao-f898b088351d6704.mp4",
"ending": false,
"choices": [
{
"label": "推理错误,返回重新指认",
"to": "quiz"
}
]
},
"w_qiao": {
"id": "w_qiao",
"title": "指认乔晶晶:错怪红颜,错失关键证据",
"act": 8,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_qiao-3c224d8436066c52.mp4",
"ending": false,
"choices": [
{
"label": "推理错误,返回重新指认",
"to": "quiz"
}
]
},
"truth": {
"id": "truth",
"title": "第9幕:锁定幕后推手江君,真相浮出水面",
"act": 9,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/truth-2c4ff6f54c21bf9e.mp4",
"ending": false,
"choices": [
{
"label": "揭开前世坠落的终极真相",
"to": "death"
}
]
},
"death": {
"id": "death",
"title": "第9幕:揭开前世坠落与阴谋的完整真相",
"act": 9,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/death-f6083d81eff79958.mp4",
"ending": false,
"choices": [
{
"label": "重启宿命进入新世界",
"to": "reborn"
}
]
},
"reborn": {
"id": "reborn",
"title": "第10幕:冲破宿命枷锁,重返星光之巅",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/reborn-f03470ae842cd634.mp4",
"ending": false,
"choices": [
{
"label": "迎接属于你的巅峰真结局",
"to": "e_true"
}
]
},
"e_career": {
"id": "e_career",
"title": "结局一:斩断情丝,独登百亿影帝王座",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_career-41177212f1da1698.mp4",
"ending": "NORMAL END",
"choices": []
},
"e_talent": {
"id": "e_talent",
"title": "结局二:拒签霸王合约,凭硬核实力逆风翻盘",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_talent-5c76171b31b9e335.mp4",
"ending": "HAPPY END",
"choices": []
},
"e_yield": {
"id": "e_yield",
"title": "结局三:拱手让出角色,错失黄金上升期",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_yield-9881d354a6e32e3d.mp4",
"ending": "BAD END",
"choices": []
},
"e_road": {
"id": "e_road",
"title": "结局四:一句不顺路,与真爱擦肩而过",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_road-808014936c728632.mp4",
"ending": "BAD END",
"choices": []
},
"e_accept": {
"id": "e_accept",
"title": "结局五:秘密恋情曝光,甜蜜却伴随风波",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_accept-c29bda43a815bebf.mp4",
"ending": "NORMAL END",
"choices": []
},
"e_believe": {
"id": "e_believe",
"title": "结局六:轻信伪装,跌入对手设下的温柔陷阱",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_believe-bac914b1ff84ed73.mp4",
"ending": "BAD END",
"choices": []
},
"e_true": {
"id": "e_true",
"title": "真结局:星光与她皆入怀,登顶娱乐圈传奇",
"act": 10,
"route": "星光主线",
"video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_true-80606c2546ab233a.mp4",
"ending": "TRUE END",
"choices": []
}
}
}
HTML5 互动短剧独立播放器 (index.html)
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>重生为顶流:星光迷局 · Reborn as a Top Star: Starlight Mystery | 互动短剧播放器</title>
<style>
:root {
--bg: #0c0a12; --surface: #161222; --surface-2: #221c34;
--line: rgba(255,255,255,0.14); --text: #f8f5ff; --muted: rgba(248,245,255,0.65);
--accent: #a855f7; --accent2: #f472b6;
--good: #34d399; --gold: #fbbf24; --bad: #f87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; min-height: 100svh; }
button { font: inherit; color: inherit; cursor: pointer; }
.app { max-width: 1024px; margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(22,18,34,0.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar h1 { flex: 1; margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub { font-size: 12px; color: var(--muted); margin-left: 8px; font-weight: 400; }
.chip { border: 1px solid var(--line); background: rgba(255,255,255,0.05); border-radius: 999px; padding: 5px 12px; font-size: 12px; white-space: nowrap; transition: .2s; }
.chip:hover { border-color: var(--accent); background: rgba(255,255,255,0.12); }
.stage-wrap { position: relative; background: #000; width: 100%; aspect-ratio: 16 / 9; max-height: 76svh; overflow: hidden; }
video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage-wrap.frozen video { filter: brightness(0.48) saturate(0.85) blur(2px); transition: filter .35s; }
.hud { position: absolute; inset: auto 0 0; padding: 20px 14px 10px; background: linear-gradient(transparent, rgba(0,0,0,0.82)); display: flex; align-items: center; gap: 10px; font-size: 12px; }
.track { flex: 1; height: 5px; border-radius: 99px; background: rgba(255,255,255,0.24); position: relative; cursor: pointer; }
.fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; width: 0%; }
.skip-btn { position: absolute; right: 14px; top: 14px; border: 1px solid rgba(255,255,255,0.35); background: rgba(12,10,18,0.68); backdrop-filter: blur(8px); border-radius: 999px; padding: 6px 14px; font-size: 13px; z-index: 5; }
.skip-btn:hover { border-color: var(--accent); }
.choice-overlay { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: flex-end; padding: 28px 24px; background: linear-gradient(180deg, rgba(12,10,18,0.15) 0%, rgba(12,10,18,0.92) 65%); z-index: 10; }
.choice-overlay.show { display: flex; animation: fadeIn .3s ease; }
.choice-kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent2); font-weight: 700; margin-bottom: 4px; }
.choice-title { margin: 0 0 14px; font-size: 20px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,0.22); background: rgba(22,18,34,0.82); backdrop-filter: blur(10px); text-align: left; transition: transform .15s, border-color .15s, background .15s; }
.opt:hover { transform: translateY(-2px); border-color: var(--accent); background: rgba(255,255,255,0.12); }
.opt .key { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.opt .lbl { flex: 1; font-size: 15px; font-weight: 600; }
.timer-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.16); overflow: hidden; margin-top: 12px; }
.timer-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 100%; transition: width 12s linear; }
.below { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.status-card { padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.status-card .route-tag { color: var(--accent2); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.status-card h2 { margin: 2px 0 0; font-size: 17px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs span { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.ending-modal { display: none; padding: 20px; border-radius: 16px; background: linear-gradient(145deg, var(--surface), var(--surface-2)); border: 1px solid var(--accent); flex-direction: column; gap: 12px; }
.ending-modal.show { display: flex; }
.ending-badge { display: inline-block; align-self: flex-start; padding: 4px 12px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.map-sheet { position: fixed; inset: 0; background: rgba(0,0,0,0.78); z-index: 30; display: none; align-items: center; justify-content: center; padding: 16px; }
.map-sheet.show { display: flex; }
.map-box { width: min(680px, 100%); max-height: 84svh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.map-node { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.map-node.visited { border-color: var(--accent); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
</style>
</head>
<body>
<div class="app">
<header class="bar">
<button class="chip" id="restartBtn">↺ 重头开始</button>
<h1>重生为顶流:星光迷局 <span class="sub">Reborn as a Top Star: Starlight Mystery</span></h1>
<button class="chip" id="endingsBtn">结局 0/8</button>
<button class="chip" id="mapBtn">剧情图谱</button>
</header>
<div class="stage-wrap" id="stageWrap">
<video id="video" playsinline preload="auto" controls></video>
<button class="skip-btn" id="skipBtn">跳到选择 ›</button>
<div class="choice-overlay" id="choiceOverlay">
<div class="choice-kicker" id="choiceKicker">MAKE YOUR CHOICE · 关键抉择</div>
<h3 class="choice-title" id="choiceTitle"></h3>
<div class="options" id="optionsBox"></div>
<div class="timer-bar"><i id="timerFill"></i></div>
</div>
</div>
<div class="below">
<div class="status-card">
<div>
<div class="route-tag" id="routeTag">第 1 幕 · 主线</div>
<h2 id="nodeTitle">重生为顶流:星光迷局</h2>
</div>
<div class="breadcrumbs" id="pathBox"></div>
</div>
<div class="ending-modal" id="endingModal">
<span class="ending-badge" id="endingBadge">TRUE END</span>
<h3 id="endingTitle" style="margin:0;font-size:22px;"></h3>
<p id="endingHint" style="margin:0;color:var(--muted);">已收录至你的互动结局图鉴。你可以回溯到任意分支节点解锁其他路线!</p>
<div style="display:flex;gap:10px;flex-wrap:wrap;">
<button class="chip" id="backChoiceBtn" style="background:var(--accent);color:#fff;border:0;padding:8px 16px;font-weight:700;">返回上一选择</button>
<button class="chip" id="openMapEndBtn">查看完整剧情图谱</button>
<button class="chip" id="restartEndBtn">重新开始</button>
</div>
</div>
</div>
</div>
<div class="map-sheet" id="mapSheet">
<div class="map-box">
<div style="display:flex;justify-content:space-between;align-items:center;">
<h3 style="margin:0;">互动剧情分支图谱 · 重生为顶流:星光迷局</h3>
<button class="chip" id="closeMapBtn">关闭 ✕</button>
</div>
<div id="mapList" style="display:flex;flex-direction:column;gap:8px;"></div>
</div>
</div>
<script>
const NODES = {"open": {"id": "open", "title": "第1幕:面对逆转重生的机会,你选择", "act": 1, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/open-4a3f6a8969bbca46.mp4", "ending": false, "choices": [{"label": "立刻进入记忆深处查明真相", "to": "memory"}, {"label": "犹豫不决先考虑一下", "to": "think"}]}, "think": {"id": "think", "title": "第1幕:在迷雾中犹豫徘徊", "act": 1, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/think-40e585308c7fe2fb.mp4", "ending": "BAD END", "choices": []}, "memory": {"id": "memory", "title": "第2幕:潜入记忆碎片,直面昔日恋情", "act": 2, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/memory-c87434c1355cff80.mp4", "ending": false, "choices": [{"label": "珍惜这段刻骨铭心的感情", "to": "contract"}, {"label": "彻底放手专心搞事业", "to": "e_career"}]}, "contract": {"id": "contract", "title": "第3幕:面对经纪公司的严苛恋爱合约", "act": 3, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/contract-a233e41919c76bac.mp4", "ending": false, "choices": [{"label": "暂时隐忍签下合约", "to": "role"}, {"label": "拒签合约全凭实力说话", "to": "e_talent"}]}, "role": {"id": "role", "title": "第4幕:面对男一号试镜的明争暗斗", "act": 4, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/role-5bb773d29232d7ca.mp4", "ending": false, "choices": [{"label": "全力争取拿下核心角色", "to": "hotel"}, {"label": "大度让出机会", "to": "e_yield"}]}, "hotel": {"id": "hotel", "title": "第5幕:庆功宴微醺夜,是否送雷初夏回酒店?", "act": 5, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/hotel-664017a61a24c3f5.mp4", "ending": false, "choices": [{"label": "亲自护送雷初夏回酒店", "to": "confess"}, {"label": "借口不顺路独自离开", "to": "e_road"}]}, "confess": {"id": "confess", "title": "第6幕:深夜走廊的心跳告白,你的回应是", "act": 6, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/confess-9692bbc0b696530d.mp4", "ending": false, "choices": [{"label": "为了保护她先婉拒告白", "to": "trust"}, {"label": "不顾一切接受她的告白", "to": "e_accept"}]}, "trust": {"id": "trust", "title": "第7幕:克制情感后,面对流言风暴", "act": 7, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/trust-75ce85a8eeeae513.mp4", "ending": false, "choices": [{"label": "保持警惕表示存疑,展开调查", "to": "quiz"}, {"label": "毫无保留选择相信", "to": "e_believe"}]}, "quiz": {"id": "quiz", "title": "第8幕【推理时刻】:究竟是谁在幕后泄露了私密照?", "act": 8, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/quiz-5c67a4bbd0b833b6.mp4", "ending": false, "choices": [{"label": "锁定幕后真凶:江君", "to": "truth"}, {"label": "怀疑商业对手:袁帅", "to": "w_yuan"}, {"label": "怀疑合伙人:萧闯", "to": "w_xiao"}, {"label": "怀疑顶流女星:乔晶晶", "to": "w_qiao"}]}, "w_yuan": {"id": "w_yuan", "title": "指认袁帅:线索中断,真凶另有其人", "act": 8, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_yuan-2e1b29fc9ac0b273.mp4", "ending": false, "choices": [{"label": "推理错误,返回重新指认", "to": "quiz"}]}, "w_xiao": {"id": "w_xiao", "title": "指认萧闯:判断失误,陷入舆论被动", "act": 8, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_xiao-f898b088351d6704.mp4", "ending": false, "choices": [{"label": "推理错误,返回重新指认", "to": "quiz"}]}, "w_qiao": {"id": "w_qiao", "title": "指认乔晶晶:错怪红颜,错失关键证据", "act": 8, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/w_qiao-3c224d8436066c52.mp4", "ending": false, "choices": [{"label": "推理错误,返回重新指认", "to": "quiz"}]}, "truth": {"id": "truth", "title": "第9幕:锁定幕后推手江君,真相浮出水面", "act": 9, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/truth-2c4ff6f54c21bf9e.mp4", "ending": false, "choices": [{"label": "揭开前世坠落的终极真相", "to": "death"}]}, "death": {"id": "death", "title": "第9幕:揭开前世坠落与阴谋的完整真相", "act": 9, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/death-f6083d81eff79958.mp4", "ending": false, "choices": [{"label": "重启宿命进入新世界", "to": "reborn"}]}, "reborn": {"id": "reborn", "title": "第10幕:冲破宿命枷锁,重返星光之巅", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/reborn-f03470ae842cd634.mp4", "ending": false, "choices": [{"label": "迎接属于你的巅峰真结局", "to": "e_true"}]}, "e_career": {"id": "e_career", "title": "结局一:斩断情丝,独登百亿影帝王座", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_career-41177212f1da1698.mp4", "ending": "NORMAL END", "choices": []}, "e_talent": {"id": "e_talent", "title": "结局二:拒签霸王合约,凭硬核实力逆风翻盘", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_talent-5c76171b31b9e335.mp4", "ending": "HAPPY END", "choices": []}, "e_yield": {"id": "e_yield", "title": "结局三:拱手让出角色,错失黄金上升期", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_yield-9881d354a6e32e3d.mp4", "ending": "BAD END", "choices": []}, "e_road": {"id": "e_road", "title": "结局四:一句不顺路,与真爱擦肩而过", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_road-808014936c728632.mp4", "ending": "BAD END", "choices": []}, "e_accept": {"id": "e_accept", "title": "结局五:秘密恋情曝光,甜蜜却伴随风波", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_accept-c29bda43a815bebf.mp4", "ending": "NORMAL END", "choices": []}, "e_believe": {"id": "e_believe", "title": "结局六:轻信伪装,跌入对手设下的温柔陷阱", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_believe-bac914b1ff84ed73.mp4", "ending": "BAD END", "choices": []}, "e_true": {"id": "e_true", "title": "真结局:星光与她皆入怀,登顶娱乐圈传奇", "act": 10, "route": "星光主线", "video": "https://media.huangguodrama.ai/motion/interactive/rebirth-top-star/e_true-80606c2546ab233a.mp4", "ending": "TRUE END", "choices": []}};
const START = "open";
const ENDINGS = ["think", "e_career", "e_talent", "e_yield", "e_road", "e_accept", "e_believe", "e_true"];
const STORAGE_KEY = "hg-interactive-rebirth-top-star-v1";
let state = JSON.parse(localStorage.getItem(STORAGE_KEY) || "null") || {
current: START,
history: [],
visited: [START],
endings: []
};
let autoTimer = null;
const video = document.getElementById("video");
const stageWrap = document.getElementById("stageWrap");
const choiceOverlay = document.getElementById("choiceOverlay");
const endingModal = document.getElementById("endingModal");
function saveState() {
try { localStorage.setItem(STORAGE_KEY, JSON.stringify(state)); } catch (e) {}
}
function enterNode(nodeId, pushHistory = false) {
clearTimeout(autoTimer);
const node = NODES[nodeId] || NODES[START];
state.current = node.id;
if (!state.visited.includes(node.id)) state.visited.push(node.id);
stageWrap.classList.remove("frozen");
choiceOverlay.classList.remove("show");
endingModal.classList.remove("show");
document.getElementById("routeTag").textContent = `第 ${node.act || 1} 幕 · ${node.route || "主线"}`;
document.getElementById("nodeTitle").textContent = node.title;
document.getElementById("endingsBtn").textContent = `结局 ${state.endings.length}/${ENDINGS.length}`;
const pathBox = document.getElementById("pathBox");
pathBox.innerHTML = "";
state.history.slice(-5).forEach(h => {
const s = document.createElement("span");
s.textContent = h.label;
pathBox.appendChild(s);
});
video.src = node.video;
video.currentTime = 0;
video.play().catch(() => {});
saveState();
}
function onClipEnd() {
const node = NODES[state.current];
if (!node) return;
stageWrap.classList.add("frozen");
if (node.ending) {
if (!state.endings.includes(node.id)) state.endings.push(node.id);
document.getElementById("endingsBtn").textContent = `结局 ${state.endings.length}/${ENDINGS.length}`;
document.getElementById("endingBadge").textContent = `${node.ending} · 已收集 ${state.endings.length}/${ENDINGS.length}`;
document.getElementById("endingTitle").textContent = node.title;
endingModal.classList.add("show");
saveState();
return;
}
if (!node.choices || !node.choices.length) return;
document.getElementById("choiceTitle").textContent = node.title;
const box = document.getElementById("optionsBox");
box.innerHTML = "";
node.choices.forEach((c, idx) => {
const btn = document.createElement("button");
btn.className = "opt";
btn.innerHTML = `<span class="key">${"ABCD"[idx] || (idx+1)}</span><span class="lbl"></span>`;
btn.querySelector(".lbl").textContent = c.label;
btn.onclick = () => {
state.history.push({ from: node.id, label: c.label });
enterNode(c.to);
};
box.appendChild(btn);
});
choiceOverlay.classList.add("show");
const fill = document.getElementById("timerFill");
fill.style.transition = "none";
fill.style.width = "100%";
requestAnimationFrame(() => {
requestAnimationFrame(() => {
fill.style.transition = "width 12s linear";
fill.style.width = "0%";
});
});
autoTimer = setTimeout(() => {
if (choiceOverlay.classList.contains("show") && node.choices[0]) {
state.history.push({ from: node.id, label: node.choices[0].label });
enterNode(node.choices[0].to);
}
}, 12000);
}
video.addEventListener("ended", onClipEnd);
document.getElementById("skipBtn").onclick = () => {
video.pause();
onClipEnd();
};
document.getElementById("restartBtn").onclick = () => {
state.history = [];
enterNode(START);
};
document.getElementById("restartEndBtn").onclick = () => {
state.history = [];
enterNode(START);
};
document.getElementById("backChoiceBtn").onclick = () => {
const last = state.history.pop();
enterNode(last ? last.from : START);
};
function openMap() {
const list = document.getElementById("mapList");
list.innerHTML = "";
Object.values(NODES).forEach(n => {
const visited = state.visited.includes(n.id);
const row = document.createElement("div");
row.className = "map-node" + (visited ? " visited" : "");
row.innerHTML = `<div><strong>${visited ? n.title : "??? (未解锁节点)"}</strong><div style="font-size:12px;color:var(--muted);">第 ${n.act || 1} 幕 · ${n.ending || n.route || "分支"}</div></div>`;
if (visited) {
const jb = document.createElement("button");
jb.className = "chip";
jb.textContent = "跳转至此";
jb.onclick = () => {
document.getElementById("mapSheet").classList.remove("show");
enterNode(n.id);
};
row.appendChild(jb);
}
list.appendChild(row);
});
document.getElementById("mapSheet").classList.add("show");
}
document.getElementById("mapBtn").onclick = openMap;
document.getElementById("endingsBtn").onclick = openMap;
document.getElementById("openMapEndBtn").onclick = openMap;
document.getElementById("closeMapBtn").onclick = () => document.getElementById("mapSheet").classList.remove("show");
enterNode(state.current || START);
</script>
</body>
</html>