Commit 49f5d470 authored by 李维's avatar 李维

Bug fix

parent 63d5d00f
......@@ -529,6 +529,7 @@ export class PlayComponent implements OnInit, OnDestroy {
}
initWordLines() {
let totalCount = this.g_formData.bgItem.questions.length
this.g_formData.bgItem.questions.forEach((item, index) => {
let textAll = []
item.combin.forEach(combinIndex => {
......@@ -555,19 +556,36 @@ export class PlayComponent implements OnInit, OnDestroy {
sy: 46 * this.g_mapScale / h
}
}, (w, h) => {
let y = 0;
if (index > 3) {
y = this.g_cartoon.getOrigin().y + (509 + 46 / 2) * this.g_mapScale
if(totalCount<=6) {
let y = 0;
if (index > 2) {
y = this.g_cartoon.getOrigin().y + (509 + 46 / 2) * this.g_mapScale
} else {
y = this.g_cartoon.getOrigin().y + (383 + 46 / 2) * this.g_mapScale
}
let xIndex = index % 3
return {
x: 170 * this.g_mapScale + this.g_cartoon.getOrigin().x + (58 + 250 / 2) * this.g_mapScale + 295 * this.g_mapScale * xIndex,
y: y
}
} else {
y = this.g_cartoon.getOrigin().y + (383 + 46 / 2) * this.g_mapScale
}
let xIndex = index % 4
return {
x: this.g_cartoon.getOrigin().x + (58 + 250 / 2) * this.g_mapScale + 295 * this.g_mapScale * xIndex,
y: y
let y = 0;
if (index > 3) {
y = this.g_cartoon.getOrigin().y + (509 + 46 / 2) * this.g_mapScale
} else {
y = this.g_cartoon.getOrigin().y + (383 + 46 / 2) * this.g_mapScale
}
let xIndex = index % 4
return {
x: this.g_cartoon.getOrigin().x + (58 + 250 / 2) * this.g_mapScale + 295 * this.g_mapScale * xIndex,
y: y
}
}
})
element.questionIndex = index;
element.done = false;
element.audio_url = item.audio_url ? item.audio_url : ""
......@@ -612,6 +630,7 @@ export class PlayComponent implements OnInit, OnDestroy {
textShow.isShown = false;
textShow.ref.alpha = 0;
textShow.ref.x = startX + textShow.ref.width / 2
textShow.ref.y = -10
startX += textShow.ref.width
totalWidth += textShow.ref.width
element.ref.addChild(textShow.ref)
......@@ -647,21 +666,26 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
let right = false;
for (let index = 0; index < answerIndex.length; index++) {
if (dragElement.hotZooIndex == answerIndex[index]) {
let textShow = this.g_cartoon.getCartoonElement(`word-part-${this.m_currentQuestionIndex}-${dragElement.hotZooIndex}-${index}`)
if (!textShow.isShown) {
textShow.isShown = true;
textShow.ref.alpha = 1;
this.g_cartoon.playAudio("sm-choice-correct")
right = true;
break;
}
} else {
this.g_cartoon.stopAllAudio()
this.g_cartoon.playAudio("cuowu")
}
}
this.g_cartoon.stopAllAudio();
if(right) {
this.g_cartoon.playAudio("sm-choice-correct");
} else {
this.g_cartoon.playAudio("cuowu");
}
if (this.checkQuestionDone()) {
this.m_currentQuestionIndex++
element.done = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment