update canvas winning team glow effect (#1326)

This commit is contained in:
NotSoToothless
2026-06-14 22:47:37 -07:00
committed by GitHub
parent deb4e0fb12
commit 186cd49649
2 changed files with 20 additions and 22 deletions
+6 -15
View File
@@ -736,32 +736,21 @@ class ReplayCanvas {
}
// ── Tickets meter ──────────────────────────────────────────────────────
_teamSlotName(slot) {
return (this._teamNames && this._teamNames[String(slot)])
|| (slot === this._winnerSlot ? 'Winner' : 'Loser');
}
_buildTicketsBar(center) {
if (!this._tickets) return;
const winSlot = this._winnerSlot || 1;
const loseSlot = winSlot === 1 ? 2 : 1;
this._tkWinSlot = winSlot;
this._tkLoseSlot = loseSlot;
this._tkLoseSlot = winSlot === 1 ? 2 : 1;
const bar = document.createElement('div');
bar.className = 'rc-tickets';
// No team names here — the win/lose team sections flank the bar already.
bar.innerHTML = `
<div class="rc-tk-side rc-tk-win">
<span class="rc-tk-name">${this._esc(this._teamSlotName(winSlot))}</span>
<span class="rc-tk-val rc-tk-val-win">0</span>
</div>
<span class="rc-tk-val rc-tk-val-win">0</span>
<div class="rc-tk-track">
<div class="rc-tk-fill rc-tk-fill-win"></div>
<div class="rc-tk-fill rc-tk-fill-lose"></div>
</div>
<div class="rc-tk-side rc-tk-lose">
<span class="rc-tk-val rc-tk-val-lose">0</span>
<span class="rc-tk-name">${this._esc(this._teamSlotName(loseSlot))}</span>
</div>`;
<span class="rc-tk-val rc-tk-val-lose">0</span>`;
center.appendChild(bar);
this.ticketsBar = bar;
this._tkWinFill = bar.querySelector('.rc-tk-fill-win');
@@ -780,6 +769,8 @@ class ReplayCanvas {
this._tkLoseFill.style.width = (100 - wPct).toFixed(1) + '%';
this._tkWinVal.textContent = w;
this._tkLoseVal.textContent = l;
// Game over (loser bled out) → glow the winning side.
this.ticketsBar.classList.toggle('rc-tk-finished', l <= 0);
}
async _loadEntityIcons() {