diff --git a/www/html/Game/public/js/play.js b/www/html/Game/public/js/play.js index f91f460..76e12d7 100644 --- a/www/html/Game/public/js/play.js +++ b/www/html/Game/public/js/play.js @@ -749,6 +749,32 @@ panel.setAttribute('aria-hidden', 'false'); } + /** เอดิเตอร์ embed quiz_carry: แผงทองทับกลางถูกปิด — แสดงคำถามแถบล่างแทน (ไม่บังจอ) */ + function syncQuizCarryEmbedQuestionStrip() { + const wrap = document.getElementById('quiz-carry-embed-q-strip'); + const p = document.getElementById('quiz-carry-embed-q-strip-text'); + if (!wrap || !p) return; + if (!(previewMode && editorEmbedReturn && isQuizCarry())) { + wrap.classList.add('is-hidden'); + wrap.setAttribute('aria-hidden', 'true'); + return; + } + if (isQuizCarryEmbedCountdownBlockingMovement()) { + wrap.classList.add('is-hidden'); + wrap.setAttribute('aria-hidden', 'true'); + return; + } + const t = (playQuizText || '').trim(); + if (!t) { + wrap.classList.add('is-hidden'); + wrap.setAttribute('aria-hidden', 'true'); + return; + } + p.textContent = t; + wrap.classList.remove('is-hidden'); + wrap.setAttribute('aria-hidden', 'false'); + } + function updatePlayQuizTimerDisplay() { const el = document.getElementById('quiz-game-timer'); if (!el) return; @@ -1863,6 +1889,10 @@ const qEl = document.getElementById('quiz-game-question'); if (qEl) qEl.textContent = playQuizText; quizCarryRestoreEmbedPhaseLabel(); + others.forEach((o) => { + if (!o) return; + o.botQuizCarryPathfindAfter = 0; + }); return; } const elapsed = now - quizCarryEmbedCountdownStartAt; @@ -1900,7 +1930,8 @@ if (!o) return; o.botPath = []; o.botPathStuckTicks = 0; - o.botQuizCarryPathfindAfter = quizCarryEmbedCountdownEndAt + 50; + /* ต้องใช้ performance.now() ช่วงกับ stepQuizCarryPreviewBots — ห้ามใช้ Date.now() epoch ไม่งั้นบอทค้าง pathfind ตลอด */ + o.botQuizCarryPathfindAfter = 0; }); const qEl = document.getElementById('quiz-game-question'); if (qEl) qEl.textContent = '…'; @@ -7292,7 +7323,10 @@ ctx.fillText('Space / คลิก = ปล่อย', 10, 44); } } - if (isQuiz() || isQuizCarry() || isQuizBattle()) syncPlayQuizMapPanel(); + if (isQuiz() || isQuizCarry() || isQuizBattle()) { + syncPlayQuizMapPanel(); + syncQuizCarryEmbedQuestionStrip(); + } if (previewFillBots && mapData && !useCyberPlayHud()) { const human = countPlayHumans(); const bots = [...others.keys()].filter(isPreviewBotId).length; diff --git a/www/html/Game/public/play.html b/www/html/Game/public/play.html index 21ae70b..17a9390 100644 --- a/www/html/Game/public/play.html +++ b/www/html/Game/public/play.html @@ -121,6 +121,30 @@ text-shadow: 0 0 48px rgba(255, 224, 102, 0.55), 0 4px 24px rgba(0, 0, 0, 0.65); letter-spacing: -0.04em; } + #quiz-carry-embed-q-strip { + position: fixed; + left: 50%; + bottom: max(52px, calc(env(safe-area-inset-bottom) + 44px)); + transform: translateX(-50%); + z-index: 10075; + max-width: min(92vw, 640px); + padding: 0.45rem 0.75rem 0.5rem; + border-radius: 12px; + background: rgba(12, 14, 28, 0.94); + border: 1px solid rgba(122, 162, 247, 0.45); + box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); + pointer-events: none; + } + #quiz-carry-embed-q-strip.is-hidden { display: none !important; } + #quiz-carry-embed-q-strip-text { + margin: 0; + font: 600 clamp(0.78rem, 2.2vmin, 1.05rem) / 1.45 system-ui, "Kanit", sans-serif; + color: #f1f5f9; + text-align: center; + text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55); + max-height: 22vh; + overflow: auto; + } #play-quiz-scoreboard { position: fixed; top: max(56px, env(safe-area-inset-top)); @@ -634,6 +658,9 @@ +