allow custom question count in shuffle mode
This commit is contained in:
@@ -45,11 +45,13 @@ class MazeQuizGame extends EventManager {
|
|||||||
|
|
||||||
this.params = { ...params, mazeFile: data.style || 'quiz-s2.gltf', io: this }
|
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)=>{
|
return new Promise(async (resolve, reject)=>{
|
||||||
let questions = data.shuffle ? Utils.shuffleArray(data.questions) : data.questions;
|
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);
|
let def = this.generate(questions);
|
||||||
this.mazeObject = new MazeObject(engine, def, this.params)
|
this.mazeObject = new MazeObject(engine, def, this.params)
|
||||||
engine.addEventListener('collision', async e=>{
|
engine.addEventListener('collision', async e=>{
|
||||||
@@ -80,7 +82,7 @@ class MazeQuizGame extends EventManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ud.qid !== undefined && e.started){
|
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)
|
engine.dashboard.levelProgress.update(ud.qid / questions.length)
|
||||||
this.dispatchEvent({type:'interaction'});
|
this.dispatchEvent({type:'interaction'});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
<v-checkbox v-model="modelValue.shuffle" hide-details :label="l.shuffleQuestions"></v-checkbox>
|
<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.correctAnswerPoints" v-model="modelValue.questionPoints"></v-number-input>
|
||||||
<v-number-input density="compact" :label="l.wrongAnswerPenalty" v-model="modelValue.questionPenalty"></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>
|
<v-select v-model="modelValue.style" :items="styles" density="compact" :label="l.visualStyle"></v-select>
|
||||||
|
|||||||
Reference in New Issue
Block a user