Weiter am Chastity Ingame gearbeitet
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled

This commit is contained in:
2026-04-27 17:41:00 +02:00
parent 0aa794600e
commit 34e5fcd777
53 changed files with 905 additions and 847 deletions

View File

@@ -658,6 +658,23 @@
<button class="btn-hygiene" id="hygieneBtn" style="display:none;" onclick="openHygieneModal()">🚿 Hygiene-Öffnung</button>
</div>
<!-- Geparkte Spiel-Karte -->
<div id="gameCardPanel" class="hygiene-panel" style="display:none;border-color:var(--color-primary);">
<div>
<div class="hygiene-panel-title" style="color:var(--color-primary);">🎮 Spiel-Karte gezogen</div>
<div class="hygiene-countdown" id="gameCardCountdown"></div>
</div>
<button class="btn-hygiene" onclick="startParkedGame()">▶ Spiel starten</button>
</div>
<div id="gameActivePanel" class="hygiene-panel" style="display:none;border-color:var(--color-primary);">
<div>
<div class="hygiene-panel-title" style="color:var(--color-primary);">🎮 Minispiel läuft</div>
<div style="font-size:0.82rem;color:var(--color-muted);">Das Lock ist gesperrt, bis das Spiel abgeschlossen ist.</div>
</div>
<button class="btn-hygiene" onclick="goToActiveGame()">▶ Zum Spiel</button>
</div>
<!-- Speed-Effekt-Panel -->
<div id="speedPanel" style="display:none;background:var(--color-card);border:1px solid var(--color-secondary);border-radius:12px;padding:0.85rem 1.1rem;gap:0.35rem;">
<div style="font-size:0.75rem;text-transform:uppercase;letter-spacing:0.06em;color:var(--color-muted);" id="speedPanelTitle">Slow Motion aktiv</div>
@@ -909,6 +926,8 @@
renderKeyholderBar(lock);
renderAssignedTasks(lock);
renderNextCardPanel(lock);
renderGameCardPanel(lock);
renderGameActivePanel(lock);
renderHygienePanel(lock);
renderSpeedPanel(lock);
renderVerificationPanel(lock);
@@ -1170,6 +1189,9 @@
const panel = document.getElementById('nextcardPanel');
const cardsDiv = document.getElementById('nextcardCards');
const overlay = document.getElementById('nextcardOverlay');
if (lock.gameActive) { panel.style.display = 'none'; return; }
panel.style.display = '';
panel.classList.remove('drawable');
@@ -1286,6 +1308,45 @@
tickInterval = setInterval(tick, 1000);
}
let gameCardPanelTick = null;
function renderGameCardPanel(lock) {
if (gameCardPanelTick) { clearInterval(gameCardPanelTick); gameCardPanelTick = null; }
const panel = document.getElementById('gameCardPanel');
if (!lock.gameCardParkedAt || !lock.gameCardDeadline) {
panel.style.display = 'none';
return;
}
panel.style.display = '';
const deadline = new Date(lock.gameCardDeadline);
const cdEl = document.getElementById('gameCardCountdown');
function tick() {
const diff = deadline - Date.now();
if (diff <= 0) { panel.style.display = 'none'; clearInterval(gameCardPanelTick); gameCardPanelTick = null; return; }
cdEl.textContent = fmtCountdown(diff);
}
tick();
gameCardPanelTick = setInterval(tick, 1000);
}
async function startParkedGame() {
const res = await fetch('/keyholder/cardlock/' + lockId + '/game/start', { method: 'POST' });
if (!res.ok) { alert('Fehler beim Starten des Spiels.'); return; }
const data = await res.json();
const gameSetId = data.gameSetId;
const url = '/games/chastity/taskgame.html?lockId=' + lockId
+ (gameSetId ? '&gameSetId=' + gameSetId : '');
window.location.href = url;
}
function renderGameActivePanel(lock) {
document.getElementById('gameActivePanel').style.display = lock.gameActive ? '' : 'none';
}
function goToActiveGame() {
window.location.href = '/games/chastity/taskgame.html?lockId=' + lockId;
}
function renderHygienePanel(lock) {
if (hygienePanelTick) { clearInterval(hygienePanelTick); hygienePanelTick = null; }
if (!lock.hygieneEnabled) return;
@@ -1714,10 +1775,8 @@
if (dto.card === 'GAME_CARD') {
const btn = document.getElementById('btnDrawOk');
btn.textContent = '▶ Spiel starten';
btn.onclick = function() {
window.location.href = '/games/chastity/taskgame.html?lockId=' + lockId;
};
btn.textContent = 'OK';
btn.onclick = closeDrawModal;
}
}, 700);
}, 1000);