allow custom question count in shuffle mode

This commit is contained in:
2026-04-10 11:22:26 +03:00
parent cb29d2494d
commit 1493d2ae34
2 changed files with 7 additions and 4 deletions
@@ -44,12 +44,14 @@ class MazeQuizGame extends EventManager {
this.data = data;
this.params = { ...params, mazeFile: data.style || 'quiz-s2.gltf', io: this }
this.maxPoints = (data.points || 0) + (data.questionPoints||0) * data.questions.length;
this.minPoints = this.maxPoints - (data.questionPenalty||0) * data.questions.length;
return new Promise(async (resolve, reject)=>{
let questions = data.shuffle ? Utils.shuffleArray(data.questions) : data.questions;
if (data.shuffle && questions.length > data.questionsCount){
questions.length = data.questionsCount;
}
this.maxPoints = (data.points || 0) + (data.questionPoints||0) * questions.length;
this.minPoints = this.maxPoints - (data.questionPenalty||0) * questions.length;
let def = this.generate(questions);
this.mazeObject = new MazeObject(engine, def, this.params)
engine.addEventListener('collision', async e=>{
@@ -80,7 +82,7 @@ class MazeQuizGame extends EventManager {
}
}
if (ud.qid !== undefined && e.started){
engine.dashboard.updateText(ud.question.q)
//engine.dashboard.updateText(ud.question.q)
engine.dashboard.levelProgress.update(ud.qid / questions.length)
this.dispatchEvent({type:'interaction'});
}
@@ -40,6 +40,7 @@
</template>
</v-dialog>
<v-checkbox v-model="modelValue.shuffle" hide-details :label="l.shuffleQuestions"></v-checkbox>
<v-number-input density="compact" v-if="modelValue.shuffle" :label="`Брой въпроси в един тест`" v-model="modelValue.questionsCount"></v-number-input>
<v-number-input density="compact" :label="l.correctAnswerPoints" v-model="modelValue.questionPoints"></v-number-input>
<v-number-input density="compact" :label="l.wrongAnswerPenalty" v-model="modelValue.questionPenalty"></v-number-input>
<v-select v-model="modelValue.style" :items="styles" density="compact" :label="l.visualStyle"></v-select>