คำถามเกม (ถูก / ผิด)
- ใช้กับฉากประเภท เกมตอบคำถาม ใน Editor — สุ่มสูงสุด 10 ข้อ ต่อรอบ · เวลาเป็นวินาที (เก็บที่เซิร์ฟเวอร์เกม /Game/data/quiz-settings.json)
+ ใช้กับฉากประเภท เกมตอบคำถาม ใน Editor — จำนวนข้อที่สุ่มต่อรอบตั้งได้ด้านล่าง (สูงสุด 50, ค่าเริ่ม 10) · เวลาเป็นวินาที (เก็บที่เซิร์ฟเวอร์เกม /Game/data/quiz-settings.json) · English: True/false quiz draws up to N shuffled questions per game session.
เวลาในเกม
@@ -154,6 +154,11 @@
พักระหว่างข้อ (วินาที)
+
+ จำนวนข้อต่อรอบ
+ สุ่มจากชุดคำถามทั้งหมด (Admin + แมป) แล้วเล่นตามลำดับ — ไม่เกินจำนวนข้อที่มีจริง · เก็บที่ quizRoundQuestionCount ใน quiz-settings.json · English: How many shuffled true/false questions per game (1–50, default 10).
+ สุ่มสูงสุดกี่ข้อต่อรอบ
+
แผงคำถามบนแผนที่ (โซนทองใน Editor)
ใช้กับ #quiz-map-question-panel ในโหมด เกมตอบคำถามถูก/ผิด · เก็บที่ quizMapPanelTheme ใน quiz-settings.json · English: Panel BG, border, text — same as carry panel theme pickers.
diff --git a/www/html/Game/data/quiz-settings.json b/www/html/Game/data/quiz-settings.json
index c0cbd39..70089df 100644
--- a/www/html/Game/data/quiz-settings.json
+++ b/www/html/Game/data/quiz-settings.json
@@ -1,5 +1,5 @@
{
- "readMs": 30000,
+ "readMs": 5000,
"answerMs": 5000,
"betweenMs": 3000,
"carryReadMs": 3000,
@@ -8,14 +8,14 @@
"carryMapPanelTheme": {
"panelBg": "rgba(255, 0, 0, 0)",
"panelBorder": "rgba(255, 255, 255, 0)",
- "textColor": "rgba(241, 245, 249, 1)",
"borderWidthPx": 0,
+ "textColor": "rgba(241, 245, 249, 1)",
"questionFontMinPx": 10,
"questionFontMaxPx": 24
},
"quizMapPanelTheme": {
- "panelBg": "rgba(12, 14, 28, 0.88)",
- "panelBorder": "rgba(255, 214, 102, 0.7)",
+ "panelBg": "rgba(12, 14, 28, 0)",
+ "panelBorder": "rgba(255, 214, 102, 0)",
"textColor": "rgba(255, 224, 102, 1)",
"borderWidthPx": 2,
"questionFontMinPx": 10,
@@ -175,6 +175,7 @@
"carryChoicePlaqueMapScale": 1.9,
"carryWalkSpeedMultForMapId": "",
"carryWalkSpeedMult": null,
+ "quizRoundQuestionCount": 3,
"questions": [
{
"text": "test1",
diff --git a/www/html/Game/public/js/play.js b/www/html/Game/public/js/play.js
index f158dcf..95de77f 100644
--- a/www/html/Game/public/js/play.js
+++ b/www/html/Game/public/js/play.js
@@ -1003,6 +1003,8 @@
let playQuizTimerInterval = null;
/** Preview-only: real question pool + phased timer (matches server quiz-settings / map quizQuestions). */
let previewQuizPool = [];
+ /** ดัชนีข้อในรอบพรีวิว (0..len-1) — หลังสับแล้วตัดตาม quizRoundQuestionCount เหมือนเซิร์ฟเวอร์ */
+ let previewQuizQIndex = 0;
let previewQuizTiming = { readMs: 10000, answerMs: 5000, betweenMs: 3500 };
let previewQuizStep = 'read';
let previewQuizCurrent = null;
@@ -2090,9 +2092,53 @@
.map((q) => ({ text: String(q.text).trim(), answerTrue: !!q.answerTrue }));
}
- function pickRandomQuizFromPool(pool) {
- if (!pool || !pool.length) return null;
- return pool[Math.floor(Math.random() * pool.length)];
+ function shufflePreviewQuizQuestionsPlay(arr) {
+ const a = (arr || []).slice();
+ for (let i = a.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [a[i], a[j]] = [a[j], a[i]];
+ }
+ return a;
+ }
+
+ /** ตรงกับ server clampQuizRoundQuestionCount — 1–50 ค่าเริ่ม 10 */
+ function clampPreviewQuizRoundQuestionCount(settings) {
+ const v = Number(settings && settings.quizRoundQuestionCount);
+ if (!Number.isFinite(v)) return 10;
+ return Math.max(1, Math.min(50, Math.floor(v)));
+ }
+
+ function finishPreviewQuizSessionPlay() {
+ previewQuizStep = 'done';
+ playQuizPhaseLocal = null;
+ previewQuizCurrent = null;
+ playQuizPhaseEndsAt = 0;
+ if (playQuizTimerInterval) {
+ clearInterval(playQuizTimerInterval);
+ playQuizTimerInterval = null;
+ }
+ const qov = document.getElementById('quiz-game-overlay');
+ if (qov) qov.classList.add('is-hidden');
+ const mapPanel = document.getElementById('quiz-map-question-panel');
+ if (mapPanel) {
+ mapPanel.classList.add('is-hidden');
+ mapPanel.setAttribute('aria-hidden', 'true');
+ }
+ if (isQuizQuestionMissionUiMapPlay()) {
+ quizQuestionMissionPhase = 'ended';
+ applyQuizQuestionMissionPanelImages();
+ const mission = quizQuestionMissionBuildPayload();
+ showGauntletCrownMissionOverlay(mission);
+ return;
+ }
+ playQuizText = 'ครบทุกข้อในรอบทดสอบแล้ว';
+ if (qov) qov.classList.remove('is-hidden');
+ const phaseEl = document.getElementById('quiz-game-phase-label');
+ if (phaseEl) phaseEl.textContent = '[ทดสอบ] จบรอบ';
+ const qEl = document.getElementById('quiz-game-question');
+ if (qEl) qEl.textContent = playQuizText;
+ const leg = document.getElementById('quiz-play-legend');
+ if (leg) leg.textContent = 'จำนวนข้อต่อรอบใช้ค่าเดียวกับ Admin (quizRoundQuestionCount)';
}
function clearPreviewBotAnswerPaths() {
@@ -2123,7 +2169,9 @@
playQuizText = q.text;
playQuizPhaseEndsAt = Date.now() + previewQuizTiming.readMs;
const phaseEl = document.getElementById('quiz-game-phase-label');
- if (phaseEl) phaseEl.textContent = '[ทดสอบ] อ่านคำถาม · สุ่มจากชุด ' + poolLen + ' ข้อ';
+ if (phaseEl) {
+ phaseEl.textContent = '[ทดสอบ] อ่านคำถาม · ข้อ ' + (previewQuizQIndex + 1) + ' / ' + poolLen;
+ }
const qEl = document.getElementById('quiz-game-question');
if (qEl) qEl.textContent = playQuizText;
const leg = document.getElementById('quiz-play-legend');
@@ -2156,7 +2204,7 @@
const qEl = document.getElementById('quiz-game-question');
if (qEl) qEl.textContent = playQuizText;
const leg = document.getElementById('quiz-play-legend');
- if (leg) leg.textContent = 'รอสักครู่แล้วจะสุ่มคำถามใหม่จากชุดเดิม';
+ if (leg) leg.textContent = 'รอสักครู่แล้วไปข้อถัดไป (สับแล้วตามจำนวนข้อต่อรอบ)';
}
function quizCellOnPlay(grid, x, y) {
@@ -2691,6 +2739,7 @@
function advancePreviewQuizIfDue() {
if (isQuizQuestionMissionUiMapPlay() && isQuizQuestionMissionPregameBlockingPlay()) return;
+ if (previewQuizStep === 'done') return;
if (!previewMode || !isQuiz() || !playQuizPhaseEndsAt || Date.now() < playQuizPhaseEndsAt) return;
const pool = previewQuizPool;
if (!pool || !pool.length) return;
@@ -2704,7 +2753,12 @@
return;
}
if (previewQuizStep === 'between') {
- const q = pickRandomQuizFromPool(pool);
+ previewQuizQIndex += 1;
+ if (previewQuizQIndex >= pool.length) {
+ finishPreviewQuizSessionPlay();
+ return;
+ }
+ const q = pool[previewQuizQIndex];
if (q) applyPreviewReadPhase(q, pool.length);
}
}
@@ -2723,7 +2777,10 @@
.map((q) => ({ text: String(q.text).trim(), answerTrue: !!q.answerTrue }));
}
if (!pool.length && mapData) pool = buildQuizPoolFromMap(mapData);
- previewQuizPool = pool;
+ const cap = clampPreviewQuizRoundQuestionCount(settings);
+ const shuffled = shufflePreviewQuizQuestionsPlay(pool);
+ previewQuizPool = shuffled.slice(0, Math.min(cap, shuffled.length));
+ previewQuizQIndex = 0;
const dRead = 10000;
const dAns = 5000;
const dBet = 3500;
@@ -2748,8 +2805,9 @@
startPlayQuizTimer();
return;
}
- const q = pickRandomQuizFromPool(pool);
- if (q) applyPreviewReadPhase(q, pool.length);
+ const session = previewQuizPool;
+ const q = session[0];
+ if (q) applyPreviewReadPhase(q, session.length);
initPlayLiveQuizScoresZeros();
startPlayQuizTimer();
}
@@ -2782,6 +2840,7 @@
playQuizText = '';
playQuizPhaseEndsAt = 0;
previewQuizPool = [];
+ previewQuizQIndex = 0;
previewQuizCurrent = null;
previewQuizStep = 'read';
playLiveQuizScores = {};
@@ -2800,6 +2859,9 @@
clearTimeout(quizQuestionMissionCountdownTimer);
quizQuestionMissionCountdownTimer = null;
}
+ const gcmTeardown = document.getElementById('gauntlet-crown-mission-overlay');
+ if (gcmTeardown) gcmTeardown.classList.add('is-hidden');
+ cancelEmbedPreviewLobbyReturnTimer();
const grabBtnTeardown = document.getElementById('quiz-carry-grab-btn');
if (grabBtnTeardown) {
grabBtnTeardown.classList.add('is-hidden');
@@ -7095,7 +7157,14 @@
btn.onclick = function () {
if (previewMode && editorEmbedReturn) {
ov.classList.add('is-hidden');
- showQuizCarryTimeupOnDeskLayer(function () { return gauntletCrownEmbedMissionAnyOk(disp); });
+ if (mission && mission.uiSkin === 'question_mission') {
+ cancelQuizCarryResultEndAfterTimeup();
+ hideQuizCarryTimeupOnDeskLayer();
+ hideQuizCarryResultEndLayer();
+ scheduleEmbedPreviewReturnToLobbyAfterResultEnd();
+ } else {
+ showQuizCarryTimeupOnDeskLayer(function () { return gauntletCrownEmbedMissionAnyOk(disp); });
+ }
} else {
goLobby();
}
diff --git a/www/html/Game/public/play.html b/www/html/Game/public/play.html
index 4e229e2..3b2f11c 100644
--- a/www/html/Game/public/play.html
+++ b/www/html/Game/public/play.html
@@ -1966,7 +1966,7 @@
-
+
v —