save code

This commit is contained in:
xsl
2026-05-18 19:44:07 +08:00
parent 380868500a
commit b2a3d20761
2 changed files with 37 additions and 2 deletions
+23 -2
View File
@@ -2,8 +2,8 @@
class GameEngine {
constructor() {
// 游戏状态
this.state = 'idle'; // idle→playing→ringing→in_call→msg_incoming→msg_playing→await_reply→detail_reply→inbox→ending
// 游戏状态(通过 setter 自动更新提示栏)
this._state = 'idle'; // idle→playing→ringing→in_call→msg_incoming→msg_playing→await_reply→detail_reply→inbox→ending
// 剧情变量
this.vars = {
@@ -42,6 +42,27 @@ class GameEngine {
this._doorbell = false;
}
// ── state getter/setter(自动更新提示栏)──
get state() { return this._state; }
set state(s) {
this._state = s;
const el = document.getElementById('hint');
if (!el) return;
const H = {
playing: '↓ 查状态 ↑ 收件箱',
ringing: '单点 接听 左滑 拒接',
in_call: '左滑 挂断',
msg_incoming: '单点 播放 左滑 忽略',
msg_playing: '播放中…',
await_reply: '单点 嗯 双点 标准 长按 细回复 左滑 不回',
detail_reply: '上下左右 选择 单点 重听',
inbox: '单点 进入 左滑 返回',
ending: '',
idle: '',
};
el.textContent = H[s] ?? '';
}
// ══════════════════════════════════════════
// 初始化
// ══════════════════════════════════════════