Sfoglia il codice sorgente

fix: 环境条渲染顺序(HUD 未建时也不报错)、环境条点击提示

LiuYuYang 1 settimana fa
parent
commit
6e3541841f
2 ha cambiato i file con 3 aggiunte e 2 eliminazioni
  1. 3 2
      js/ui.js
  2. BIN
      tests/shots/desktop-11-env-and-progress.png

+ 3 - 2
js/ui.js

@@ -158,10 +158,10 @@ export class App {
     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 set = (sel, v) => { const e = strip.querySelector(sel); if (e && e.textContent !== v) e.textContent = v; };
-    strip.querySelector('.env-dot').style.background = env.color;
+    const dot = strip.querySelector('.env-dot'); if (dot) 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}`;
+    const bar = strip.querySelector('.env-prog i'); if (bar) bar.style.cssText = `width:${(prog * 100).toFixed(0)}%;background:${env.color}`;
     set('.env-left', env.desc + fire + boost);
   }
 
@@ -557,6 +557,7 @@ export class App {
   }
 
   bindEvents() {
+    $('#env-strip').addEventListener('click', (e) => { const d = e.target.closest('.env-dot, b, .env-eff, .env-left'); if (!d) return; e.stopPropagation(); this.toast('当前地质环境:' + ((this.stats && this.stats.env && this.stats.env.desc) || '') ); });
     $('#main').addEventListener('click', (e) => {
       const rb = e.target.closest('[data-r]');
       if (rb) { this.riftAction(rb.dataset.r, rb.dataset.k, rb.dataset.i); return; }

BIN
tests/shots/desktop-11-env-and-progress.png