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

Bug fix

parent 63d5d00f
...@@ -529,6 +529,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -529,6 +529,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
initWordLines() { initWordLines() {
let totalCount = this.g_formData.bgItem.questions.length
this.g_formData.bgItem.questions.forEach((item, index) => { this.g_formData.bgItem.questions.forEach((item, index) => {
let textAll = [] let textAll = []
item.combin.forEach(combinIndex => { item.combin.forEach(combinIndex => {
...@@ -555,19 +556,36 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -555,19 +556,36 @@ export class PlayComponent implements OnInit, OnDestroy {
sy: 46 * this.g_mapScale / h sy: 46 * this.g_mapScale / h
} }
}, (w, h) => { }, (w, h) => {
let y = 0; if(totalCount<=6) {
if (index > 3) { let y = 0;
y = this.g_cartoon.getOrigin().y + (509 + 46 / 2) * this.g_mapScale 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 { } else {
y = this.g_cartoon.getOrigin().y + (383 + 46 / 2) * this.g_mapScale let y = 0;
} if (index > 3) {
y = this.g_cartoon.getOrigin().y + (509 + 46 / 2) * this.g_mapScale
let xIndex = index % 4 } else {
return { y = this.g_cartoon.getOrigin().y + (383 + 46 / 2) * this.g_mapScale
x: this.g_cartoon.getOrigin().x + (58 + 250 / 2) * this.g_mapScale + 295 * this.g_mapScale * xIndex, }
y: y
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.questionIndex = index;
element.done = false; element.done = false;
element.audio_url = item.audio_url ? item.audio_url : "" element.audio_url = item.audio_url ? item.audio_url : ""
...@@ -612,6 +630,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -612,6 +630,7 @@ export class PlayComponent implements OnInit, OnDestroy {
textShow.isShown = false; textShow.isShown = false;
textShow.ref.alpha = 0; textShow.ref.alpha = 0;
textShow.ref.x = startX + textShow.ref.width / 2 textShow.ref.x = startX + textShow.ref.width / 2
textShow.ref.y = -10
startX += textShow.ref.width startX += textShow.ref.width
totalWidth += textShow.ref.width totalWidth += textShow.ref.width
element.ref.addChild(textShow.ref) element.ref.addChild(textShow.ref)
...@@ -647,21 +666,26 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -647,21 +666,26 @@ export class PlayComponent implements OnInit, OnDestroy {
return; return;
} }
let right = false;
for (let index = 0; index < answerIndex.length; index++) { for (let index = 0; index < answerIndex.length; index++) {
if (dragElement.hotZooIndex == answerIndex[index]) { if (dragElement.hotZooIndex == answerIndex[index]) {
let textShow = this.g_cartoon.getCartoonElement(`word-part-${this.m_currentQuestionIndex}-${dragElement.hotZooIndex}-${index}`) let textShow = this.g_cartoon.getCartoonElement(`word-part-${this.m_currentQuestionIndex}-${dragElement.hotZooIndex}-${index}`)
if (!textShow.isShown) { if (!textShow.isShown) {
textShow.isShown = true; textShow.isShown = true;
textShow.ref.alpha = 1; textShow.ref.alpha = 1;
this.g_cartoon.playAudio("sm-choice-correct") right = true;
break; 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()) { if (this.checkQuestionDone()) {
this.m_currentQuestionIndex++ this.m_currentQuestionIndex++
element.done = true; 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