|
@@ -27,6 +27,7 @@ export class App {
|
|
|
this.lastSave = 0;
|
|
this.lastSave = 0;
|
|
|
this.lastRender = 0;
|
|
this.lastRender = 0;
|
|
|
this.fps = { n: 0, t: 0, v: 60 };
|
|
this.fps = { n: 0, t: 0, v: 60 };
|
|
|
|
|
+ this.readTune();
|
|
|
this.bindEvents();
|
|
this.bindEvents();
|
|
|
this.bindKeys();
|
|
this.bindKeys();
|
|
|
this.startLoop();
|
|
this.startLoop();
|
|
@@ -39,7 +40,8 @@ export class App {
|
|
|
const loop = (ts) => {
|
|
const loop = (ts) => {
|
|
|
const dt = Math.min(0.5, (ts - this.lastFrame) / 1000);
|
|
const dt = Math.min(0.5, (ts - this.lastFrame) / 1000);
|
|
|
this.lastFrame = ts;
|
|
this.lastFrame = ts;
|
|
|
- acc += dt;
|
|
|
|
|
|
|
+ const tsMul = (this.tune && this.tune.ts) || 1;
|
|
|
|
|
+ acc += dt * tsMul; // 手感调节:时间倍率
|
|
|
let guard = 0;
|
|
let guard = 0;
|
|
|
while (acc >= STEP && guard++ < 10) { acc -= STEP; this.step(STEP); }
|
|
while (acc >= STEP && guard++ < 10) { acc -= STEP; this.step(STEP); }
|
|
|
if (ts - this.lastRender > 100) { this.lastRender = ts; this.renderDynamic(); }
|
|
if (ts - this.lastRender > 100) { this.lastRender = ts; this.renderDynamic(); }
|
|
@@ -52,7 +54,9 @@ export class App {
|
|
|
|
|
|
|
|
step(dt) {
|
|
step(dt) {
|
|
|
const s = this.s;
|
|
const s = this.s;
|
|
|
|
|
+ const e0 = s.essence;
|
|
|
const out = S.tick(s, this.riftRun ? { run: this.riftRun } : null, dt);
|
|
const out = S.tick(s, this.riftRun ? { run: this.riftRun } : null, dt);
|
|
|
|
|
+ if (this.tune && this.tune.rs !== 1 && s.essence > e0) s.essence = e0 + (s.essence - e0) * this.tune.rs;
|
|
|
this.riftRun = s.planeRun;
|
|
this.riftRun = s.planeRun;
|
|
|
// 表现:跳关
|
|
// 表现:跳关
|
|
|
if (out.skip) { this.scene.burst(1); this.floatLayer(`跃迁 +${out.skip.k}`); }
|
|
if (out.skip) { this.scene.burst(1); this.floatLayer(`跃迁 +${out.skip.k}`); }
|
|
@@ -133,27 +137,39 @@ export class App {
|
|
|
$('.topbar').style.borderTopColor = C.PLANES[s.currentPlane].color;
|
|
$('.topbar').style.borderTopColor = C.PLANES[s.currentPlane].color;
|
|
|
// 里世界
|
|
// 里世界
|
|
|
if (this.riftRun) this.renderRiftLive();
|
|
if (this.riftRun) this.renderRiftLive();
|
|
|
|
|
+ // 手感调节(?speed=&prod=)
|
|
|
|
|
+ const tune = this.tune || { ts: 1, rs: 1 };
|
|
|
|
|
+ const th = $('#tune-hint');
|
|
|
|
|
+ if (th) { const text = (tune.ts !== 1 || tune.rs !== 1) ? `×${tune.ts} 时间 · ×${tune.rs} 产出` : ''; if (th.textContent !== text) th.textContent = text; }
|
|
|
// 引导
|
|
// 引导
|
|
|
this.refreshGuide(st);
|
|
this.refreshGuide(st);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
renderEnv(st) {
|
|
renderEnv(st) {
|
|
|
- const el = $('#env-strip');
|
|
|
|
|
- if (!el) return;
|
|
|
|
|
|
|
+ if (!this.envEls) {
|
|
|
|
|
+ this.envEls = true;
|
|
|
|
|
+ $('#env-strip').innerHTML = '<span class="env-dot"></span><b></b><span class="env-eff"></span><span class="env-prog"><i></i></span><span class="env-left"></span><span class="env-left" id="tune-hint" style="margin-left:auto;color:#cbd5e1"></span>';
|
|
|
|
|
+ }
|
|
|
const env = st.env;
|
|
const env = st.env;
|
|
|
if (!env) return;
|
|
if (!env) return;
|
|
|
|
|
+ const strip = $('#env-strip');
|
|
|
const D = Math.max(0, (this.s.layer || 0) - st.start);
|
|
const D = Math.max(0, (this.s.layer || 0) - st.start);
|
|
|
const prog = (D % 18) / 18;
|
|
const prog = (D % 18) / 18;
|
|
|
const fire = st.envFactors && st.envFactors.fire ? ` · 火种 ${Math.floor(this.s._fireAcc || 0)}/10` : '';
|
|
const fire = st.envFactors && st.envFactors.fire ? ` · 火种 ${Math.floor(this.s._fireAcc || 0)}/10` : '';
|
|
|
const boost = (this.s._fireBoost || 0) > Date.now() / 1000 ? ' · 星火 ×2.5' : '';
|
|
const boost = (this.s._fireBoost || 0) > Date.now() / 1000 ? ' · 星火 ×2.5' : '';
|
|
|
- const html = `<span class="env-dot" style="background:${env.color}"></span><b>${env.name}</b><span class="env-eff">${env.eff}</span><span class="env-prog"><i style="width:${(prog * 100).toFixed(0)}%;background:${env.color}"></i></span><span class="env-left">${env.desc}${fire}${boost}</span>`;
|
|
|
|
|
- this.html('#env-strip', html);
|
|
|
|
|
|
|
+ const set = (sel, v) => { const e = strip.querySelector(sel); if (e && e.textContent !== v) e.textContent = v; };
|
|
|
|
|
+ strip.querySelector('.env-dot').style.background = env.color;
|
|
|
|
|
+ set('b', env.name);
|
|
|
|
|
+ set('.env-eff', env.eff);
|
|
|
|
|
+ strip.querySelector('.env-prog i').style.cssText = `width:${(prog * 100).toFixed(0)}%;background:${env.color}`;
|
|
|
|
|
+ set('.env-left', env.desc + fire + boost);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
renderHud(st) {
|
|
renderHud(st) {
|
|
|
if (!this.hudBuilt) {
|
|
if (!this.hudBuilt) {
|
|
|
this.hudBuilt = true;
|
|
this.hudBuilt = true;
|
|
|
$('#hud').innerHTML = '<div><div class="layer" id="hud-layer">0<small>层</small></div><div class="meta" id="hud-sub"></div></div><div class="meta hud-meta" id="hud-meta"></div>';
|
|
$('#hud').innerHTML = '<div><div class="layer" id="hud-layer">0<small>层</small></div><div class="meta" id="hud-sub"></div></div><div class="meta hud-meta" id="hud-meta"></div>';
|
|
|
|
|
+ $('#env-strip').innerHTML = '<span class="env-dot"></span><b></b><span class="env-eff"></span><span class="env-prog"><i></i></span><span class="env-left"></span><span class="env-left" id="tune-hint" style="margin-left:auto;color:#cbd5e1"></span>';
|
|
|
}
|
|
}
|
|
|
const lf = this.s.layer;
|
|
const lf = this.s.layer;
|
|
|
this.html('#hud-layer', `${fmt(Math.floor(lf), { int: true })}<small>层</small>`);
|
|
this.html('#hud-layer', `${fmt(Math.floor(lf), { int: true })}<small>层</small>`);
|
|
@@ -338,7 +354,7 @@ export class App {
|
|
|
this.html('#rebirth', `
|
|
this.html('#rebirth', `
|
|
|
<div class="panel-title">时间回溯</div>
|
|
<div class="panel-title">时间回溯</div>
|
|
|
<div class="reb-card">
|
|
<div class="reb-card">
|
|
|
- <div class="k">预计炼化</div>
|
|
|
|
|
|
|
+ <div class="k">预计炼化 <span style="font-weight:400;letter-spacing:0">· 首次建议 ≥20 层</span></div>
|
|
|
<div class="v"><span id="reb-gain">0</span><small>结晶</small></div>
|
|
<div class="v"><span id="reb-gain">0</span><small>结晶</small></div>
|
|
|
<div class="line"><span>本轮深度 <b id="reb-depth">0</b></span><span>回溯代价 <b id="reb-cost">1</b></span><span>收益效率 <b id="reb-eff">—</b></span></div>
|
|
<div class="line"><span>本轮深度 <b id="reb-depth">0</b></span><span>回溯代价 <b id="reb-cost">1</b></span><span>收益效率 <b id="reb-eff">—</b></span></div>
|
|
|
</div>
|
|
</div>
|
|
@@ -514,6 +530,13 @@ export class App {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ───────────── 交互 ─────────────
|
|
// ───────────── 交互 ─────────────
|
|
|
|
|
+ readTune() {
|
|
|
|
|
+ const q = new URLSearchParams(location.search);
|
|
|
|
|
+ const ts = Math.max(0.5, Math.min(20, parseFloat(q.get('speed')) || 1));
|
|
|
|
|
+ const rs = Math.max(1, Math.min(1000, parseFloat(q.get('prod')) || 1));
|
|
|
|
|
+ this.tune = { ts, rs };
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
bindKeys() {
|
|
bindKeys() {
|
|
|
document.addEventListener('keydown', (e) => {
|
|
document.addEventListener('keydown', (e) => {
|
|
|
if (e.target && /INPUT|TEXTAREA/.test(e.target.tagName)) return;
|
|
if (e.target && /INPUT|TEXTAREA/.test(e.target.tagName)) return;
|