Commit 2d4d3d00 authored by Dumplings X's avatar Dumplings X

fix

parent d4dde87d
......@@ -104,6 +104,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 是否游戏进行中
isGaming;
@HostListener('window:resize', ['$event'])
onResize(event) {
this.winResizeEventStream.next();
......@@ -277,6 +278,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.gameEndFlag = true;
}
serverPicArr;
initData() {
this.canvasWidth = this.wrap.nativeElement.clientWidth;
this.canvasHeight = this.wrap.nativeElement.clientHeight;
......@@ -302,10 +305,34 @@ export class PlayComponent implements OnInit, OnDestroy {
this.data.contentObj.picArr = [];
}
this.picArr = this.data.contentObj.picArr;
this.serverPicArr = JSON.parse(JSON.stringify(this.picArr));
this.picIndex = 0;
}
setServerPicArr(data) {
const tmpData = this.serverPicArr[this.curPageIndex];
tmpData.finish = true;
let score = 0;
for (let i = 0; i < this.serverPicArr.length; i++) {
if (this.serverPicArr[i].finish) {
score++;
}
}
let finishFlag = true;
for (let i = 0; i < this.serverPicArr.length; i++) {
if (!this.serverPicArr[i].finish) {
finishFlag = false;
break;
}
}
const scoreData = {};
scoreData['user'] = window['air'].airClassInfo.user;
scoreData['serverPicArr'] = this.serverPicArr;
scoreData['score'] = score;
scoreData['finish'] = finishFlag;
this.sendServerEvent('score_data', scoreData);
}
......@@ -953,6 +980,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const options = data.options;
if (options[index] && options[index].checked) {
console.log('right');
this.setServerPicArr(data);
this.showFrame(index);
} else {
console.log('wrong');
......
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