Toast tidak lagi menutupi bilah atas layar VS: toast info lawan Arcade/Survival dihapus (sudah ada di bilah VS) dan toast lain ditahan selama VS tampil, lalu muncul penuh sesudahnya
This commit is contained in:
parent
fb6abadc92
commit
10a826cdce
7
meta.js
7
meta.js
|
|
@ -70,8 +70,11 @@
|
||||||
const esc = t => String(t).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
const esc = t => String(t).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c]));
|
||||||
|
|
||||||
// ---- toasts ----
|
// ---- toasts ----
|
||||||
let toastBox;
|
let toastBox, held = [];
|
||||||
|
// Selama layar VS tampil toast ditahan (menutupi bilah atas VS), lalu dimunculkan penuh setelah layar selesai atau dibatalkan.
|
||||||
|
function holdToasts() { setTimeout(() => { if (window.VS?.active) return holdToasts(); const q = held; held = []; for (const [m, k] of q) toast(m, k); }, 150); }
|
||||||
function toast(msg, kind = '') {
|
function toast(msg, kind = '') {
|
||||||
|
if (window.VS?.active) { held.push([msg, kind]); if (held.length === 1) holdToasts(); return; }
|
||||||
if (!toastBox) { toastBox = document.createElement('div'); toastBox.id = 'meta-toasts'; document.body.append(toastBox); }
|
if (!toastBox) { toastBox = document.createElement('div'); toastBox.id = 'meta-toasts'; document.body.append(toastBox); }
|
||||||
const el = document.createElement('div'); el.className = 'meta-toast ' + kind; el.textContent = msg; toastBox.append(el);
|
const el = document.createElement('div'); el.className = 'meta-toast ' + kind; el.textContent = msg; toastBox.append(el);
|
||||||
setTimeout(() => el.classList.add('out'), 3200); setTimeout(() => el.remove(), 3800);
|
setTimeout(() => el.classList.add('out'), 3200); setTimeout(() => el.remove(), 3800);
|
||||||
|
|
@ -136,8 +139,6 @@
|
||||||
const g = window.__game, stages = Object.keys(window.MatchRules?.stages || { bellora: 1 });
|
const g = window.__game, stages = Object.keys(window.MatchRules?.stages || { bellora: 1 });
|
||||||
const enemy = run.kind === 'arcade' ? run.queue[run.wins] : shuffle(roster().filter(x => x !== run.player))[0];
|
const enemy = run.kind === 'arcade' ? run.queue[run.wins] : shuffle(roster().filter(x => x !== run.player))[0];
|
||||||
const level = run.kind === 'arcade' ? 'medium' : run.wins < 3 ? 'easy' : run.wins < 6 ? 'medium' : run.wins < 9 ? 'hard' : 'excellent';
|
const level = run.kind === 'arcade' ? 'medium' : run.wins < 3 ? 'easy' : run.wins < 6 ? 'medium' : run.wins < 9 ? 'hard' : 'excellent';
|
||||||
const total = run.kind === 'arcade' ? '/' + run.queue.length : '';
|
|
||||||
toast((run.kind === 'arcade' ? 'ARCADE' : 'SURVIVAL') + ' · LAWAN ' + (run.wins + 1) + total + ': ' + fname(enemy) + ' (' + level + ')');
|
|
||||||
let ok = false;
|
let ok = false;
|
||||||
for (const st of shuffle(stages.slice()).concat('bellora')) { ok = g.startMatch({ player: run.player, enemy, stage: st, level, mode: 'versus', vs: { label: (run.kind === 'arcade' ? 'ARCADE · LAWAN ' + (run.wins + 1) + ' / ' + run.queue.length : 'SURVIVAL · LAWAN ' + (run.wins + 1)) } }); if (ok) break; }
|
for (const st of shuffle(stages.slice()).concat('bellora')) { ok = g.startMatch({ player: run.player, enemy, stage: st, level, mode: 'versus', vs: { label: (run.kind === 'arcade' ? 'ARCADE · LAWAN ' + (run.wins + 1) + ' / ' + run.queue.length : 'SURVIVAL · LAWAN ' + (run.wins + 1)) } }); if (ok) break; }
|
||||||
if (!ok) { toast('Aset belum siap, coba lagi.'); run = null; window.FrontEnd?.home(); }
|
if (!ok) { toast('Aset belum siap, coba lagi.'); run = null; window.FrontEnd?.home(); }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue