dtult
This commit is contained in:
parent
fea2a99b62
commit
a5e2e6c638
@ -750,36 +750,81 @@
|
||||
});
|
||||
}
|
||||
|
||||
/* ── Zurück zum Arena-Popup (nicht zum Launcher) ─────── */
|
||||
function closeToArena() {
|
||||
if (window.parent && window.parent !== window) {
|
||||
window.parent.document.getElementById("arena-backdrop")?.remove();
|
||||
window.parent.document.getElementById("arena-popup")?.remove();
|
||||
} else {
|
||||
window.location.href = "/launcher";
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Nachricht anzeigen + weiterleiten ──────────────── */
|
||||
function showSurrenderMessage(iWon) {
|
||||
const overlay = document.createElement("div");
|
||||
overlay.style.cssText = "position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,0.9);display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:'Cinzel',serif;";
|
||||
overlay.innerHTML = iWon
|
||||
? `<div style="font-size:48px;margin-bottom:16px;">🏆</div>
|
||||
<div style="font-size:28px;color:#f0d060;letter-spacing:4px;">SIEG!</div>
|
||||
<p style="color:#a0e090;font-size:13px;margin-top:12px;">Dein Gegner hat aufgegeben.</p>
|
||||
<p style="color:#606060;font-size:11px;margin-top:8px;">Du wirst weitergeleitet…</p>`
|
||||
: `<div style="font-size:48px;margin-bottom:16px;">🏳️</div>
|
||||
<div style="font-size:28px;color:#e74c3c;letter-spacing:4px;">AUFGEGEBEN</div>
|
||||
<p style="color:#a08060;font-size:13px;margin-top:12px;">Du hast das Match aufgegeben.</p>
|
||||
<p style="color:#606060;font-size:11px;margin-top:8px;">Du wirst weitergeleitet…</p>`;
|
||||
overlay.id = "surrender-result-overlay";
|
||||
overlay.style.cssText = `
|
||||
position:fixed;inset:0;z-index:9999;
|
||||
background:rgba(0,0,0,0.92);
|
||||
display:flex;flex-direction:column;
|
||||
align-items:center;justify-content:center;
|
||||
font-family:'Cinzel',serif;
|
||||
animation:fadeIn 0.4s ease;`;
|
||||
|
||||
if (iWon) {
|
||||
overlay.innerHTML = `
|
||||
<div style="font-size:64px;margin-bottom:20px;filter:drop-shadow(0 0 20px rgba(255,215,0,0.6));">🏆</div>
|
||||
<div style="font-size:34px;color:#f0d060;letter-spacing:6px;margin-bottom:12px;
|
||||
text-shadow:0 0 30px rgba(255,215,0,0.5);">SIEG!</div>
|
||||
<div style="font-size:16px;color:#a0d090;letter-spacing:2px;margin-bottom:6px;">
|
||||
Dein Gegner hat aufgegeben.</div>
|
||||
<div style="font-size:12px;color:#606060;margin-bottom:32px;letter-spacing:1px;">
|
||||
Du erhältst die Arena-Punkte für dieses Match.</div>
|
||||
<button id="surrender-close-btn" style="
|
||||
background:linear-gradient(135deg,#1a5a18,#27ae60);
|
||||
border:2px solid rgba(100,220,100,0.6);
|
||||
border-radius:10px;color:#fff;
|
||||
font-family:'Cinzel',serif;font-size:14px;
|
||||
letter-spacing:3px;padding:12px 36px;
|
||||
cursor:pointer;transition:0.2s;
|
||||
box-shadow:0 4px 20px rgba(0,150,0,0.4);">
|
||||
✔ WEITER
|
||||
</button>`;
|
||||
} else {
|
||||
overlay.innerHTML = `
|
||||
<div style="font-size:64px;margin-bottom:20px;opacity:0.7;">🏳️</div>
|
||||
<div style="font-size:34px;color:#e74c3c;letter-spacing:6px;margin-bottom:12px;">AUFGEGEBEN</div>
|
||||
<div style="font-size:16px;color:#a08060;letter-spacing:2px;margin-bottom:6px;">
|
||||
Du hast das Match aufgegeben.</div>
|
||||
<div style="font-size:12px;color:#606060;margin-bottom:32px;letter-spacing:1px;">
|
||||
Keine Punkte für dieses Match.</div>
|
||||
<button id="surrender-close-btn" style="
|
||||
background:linear-gradient(135deg,#3a2810,#2a1a08);
|
||||
border:2px solid rgba(200,150,60,0.5);
|
||||
border-radius:10px;color:#c8a860;
|
||||
font-family:'Cinzel',serif;font-size:14px;
|
||||
letter-spacing:3px;padding:12px 36px;
|
||||
cursor:pointer;transition:0.2s;">
|
||||
← ZURÜCK ZUR ARENA
|
||||
</button>`;
|
||||
}
|
||||
|
||||
document.body.appendChild(overlay);
|
||||
|
||||
setTimeout(() => {
|
||||
// Immer zur Startseite (launcher) weiterleiten
|
||||
if (window.parent && window.parent !== window) {
|
||||
window.parent.document.getElementById("arena-backdrop")?.remove();
|
||||
window.parent.document.getElementById("arena-popup")?.remove();
|
||||
}
|
||||
window.top.location.href = "/launcher";
|
||||
}, 2500);
|
||||
// Button-Klick → zurück zum Arena-Popup
|
||||
document.getElementById("surrender-close-btn")
|
||||
.addEventListener("click", closeToArena);
|
||||
|
||||
// Auto-Close nach 8s
|
||||
setTimeout(closeToArena, 8000);
|
||||
}
|
||||
|
||||
/* ── Spielende Events ───────────────────────────────── */
|
||||
socket.on("player_surrendered", data => {
|
||||
const iLost = data.slot === mySlot;
|
||||
if (!iLost) {
|
||||
// Ich habe gewonnen (Gegner hat aufgegeben)
|
||||
// Ich habe gewonnen – Gegner hat aufgegeben
|
||||
showSurrenderMessage(true);
|
||||
}
|
||||
// Wenn ich selbst aufgegeben habe, läuft showSurrenderMessage(false) schon
|
||||
@ -848,13 +893,9 @@
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/* ── Popup schließen → immer zu Launcher ──────────── */
|
||||
/* ── Popup schließen → zurück zum Arena-Popup ────────── */
|
||||
function closePopup() {
|
||||
if (window.parent && window.parent !== window) {
|
||||
window.parent.document.getElementById("arena-backdrop")?.remove();
|
||||
window.parent.document.getElementById("arena-popup")?.remove();
|
||||
}
|
||||
window.top.location.href = "/launcher";
|
||||
closeToArena();
|
||||
}
|
||||
|
||||
document.getElementById("result-close-btn").addEventListener("click", closePopup);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user