Commit c67f9a34 authored by Chen Jiping's avatar Chen Jiping

fix:去除备选答案的音频,增加卡片的个数

parent 99d631ee
...@@ -68,14 +68,6 @@ ...@@ -68,14 +68,6 @@
<span>删除</span> <span>删除</span>
</button> </button>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzFor="data.audioUrl"> 音频:</nz-form-label>
<nz-form-control [nzSpan]="12">
<app-audio-recorder [audioUrl]="data.audioUrl"
(audioUploaded)="onAudioUploadSuccess($event, data, 'audioUrl')">
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" >内容形式</nz-form-label> <nz-form-label [nzSpan]="6" >内容形式</nz-form-label>
<nz-form-control [nzSpan]="6"> <nz-form-control [nzSpan]="6">
......
...@@ -545,7 +545,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -545,7 +545,17 @@ export class PlayComponent implements OnInit, OnDestroy {
this.gameEndFlag = false; this.gameEndFlag = false;
this.answerArr.push(this.data.rightAnswer); let num = 2 + Math.ceil(Math.random() * 2);
for(let i = 0; i < num; ++ i){
let answer = getDefaultAnswer();
answer.audioUrl = this.data.rightAnswer.audioUrl;
answer.contentType = this.data.rightAnswer.contentType;
answer.isRight = "1";
answer.picUrl = this.data.rightAnswer.picUrl;
answer.val = this.data.rightAnswer.val;
this.answerArr.push(answer);
}
this.answerArr.push(...this.data.answerArr); this.answerArr.push(...this.data.answerArr);
...@@ -792,7 +802,27 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -792,7 +802,27 @@ export class PlayComponent implements OnInit, OnDestroy {
card = new Card(); card = new Card();
card.init(this.images, this.mapScale); card.init(this.images, this.mapScale);
card.bg.x = 260 * this.mapScale; card.bg.x = 160 * this.mapScale;
card.bg.y = this.canvasHeight + 110 * this.mapScale;
card.bg['renderZ'] = 19;
card['id'] = 1;
this.renderArr.push(card.bg);
this.holePosArr.push({ x: card.bg.x, y: card.bg.y, z: 19 });
this.cardArr.push(card);
card = new Card();
card.init(this.images, this.mapScale);
card.bg.x = 540 * this.mapScale;
card.bg.y = this.canvasHeight + 110 * this.mapScale;
card.bg['renderZ'] = 19;
card['id'] = 1;
this.renderArr.push(card.bg);
this.holePosArr.push({ x: card.bg.x, y: card.bg.y, z: 19 });
this.cardArr.push(card);
card = new Card();
card.init(this.images, this.mapScale);
card.bg.x = 760 * this.mapScale;
card.bg.y = this.canvasHeight + 110 * this.mapScale; card.bg.y = this.canvasHeight + 110 * this.mapScale;
card.bg['renderZ'] = 19; card.bg['renderZ'] = 19;
card['id'] = 1; card['id'] = 1;
...@@ -808,7 +838,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -808,7 +838,7 @@ export class PlayComponent implements OnInit, OnDestroy {
for (let i = 0; i < this.cardArr.length; i++) { for (let i = 0; i < this.cardArr.length; i++) {
clearTimeout(this.cardArr[i].timeId); clearTimeout(this.cardArr[i].timeId);
if (this.cardArr[i].tween) { if (this.cardArr[i].tween) {
this.cardArr[i].tween.stop(); //this.cardArr[i].tween.stop();
} }
} }
...@@ -880,7 +910,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -880,7 +910,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.getAnswer((answer) => { this.getAnswer((answer) => {
const holeArr = [0, 1, 2]; const holeArr = [0, 1, 2, 3 , 4];
for (let i = 0; i < this.holeExistArr.length; i++) { for (let i = 0; i < this.holeExistArr.length; i++) {
removeItemFromArr(holeArr, this.holeExistArr[i]); removeItemFromArr(holeArr, this.holeExistArr[i]);
} }
...@@ -889,7 +919,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -889,7 +919,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const pos = this.holePosArr[holeIndex]; const pos = this.holePosArr[holeIndex];
const cardIndexArr = [0, 1, 2]; const cardIndexArr = [0, 1, 2, 3 , 4];
for (let i = 0; i < this.cardExistArr.length; i++) { for (let i = 0; i < this.cardExistArr.length; i++) {
removeItemFromArr(cardIndexArr, this.cardExistArr[i]); removeItemFromArr(cardIndexArr, this.cardExistArr[i]);
} }
...@@ -973,7 +1003,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -973,7 +1003,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (!card.curAnswer.endFlag) { if (!card.curAnswer.endFlag) {
removeItemFromArr(this.cardExistArr, card.id); removeItemFromArr(this.cardExistArr, card.id);
} else { } else {
this.checkGameEnd(card.curAnswer); this.checkGameEnd();
} }
removeItemFromArr(this.holeExistArr, card.holeId); removeItemFromArr(this.holeExistArr, card.holeId);
...@@ -1020,11 +1050,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1020,11 +1050,14 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
checkGameEnd(answer) { checkGameEnd() {
for (let i = 0; i < this.answerArr2.length; i++) {
if (answer.endFlag) { if (this.answerArr2[i].isRight == '1' && !this.answerArr2[i].endFlag) {
this.showEnd(); return;
}
} }
console.log('play end...')
this.showEnd();
} }
......
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