Commit 46168354 authored by limingzhe's avatar limingzhe

feat: 不可选

feat: 添加err log文件
feat: 新样式

fix: 重进后icon图标异常
fix: 首次进入异常
fix: 游戏结束后 进入异常
fix: ok后不可点击
fix: 最终成绩 显示成绩数量异常
parent 83e23f5b
import { ErrorHandler } from '@angular/core';
export class MyErrorHandler implements ErrorHandler {
handleError(error) {
console.log(error.stack);
(<any> window).courseware.sendErrorLog(error);
}
}
\ No newline at end of file
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule, ErrorHandler } from '@angular/core';
import {MyErrorHandler} from './MyError';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd'; import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
...@@ -50,7 +52,10 @@ registerLocaleData(zh); ...@@ -50,7 +52,10 @@ registerLocaleData(zh);
BrowserAnimationsModule, BrowserAnimationsModule,
FontAwesomeModule FontAwesomeModule
], ],
providers: [{ provide: NZ_I18N, useValue: zh_CN }], providers: [
{provide: ErrorHandler, useClass: MyErrorHandler},
{ provide: NZ_I18N, useValue: zh_CN }
],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
height: 100%; height: 100%;
background: #ffffff; background: #ffffff;
background-size: cover; background-size: cover;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
} }
#canvas { #canvas {
......
...@@ -151,6 +151,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -151,6 +151,8 @@ export class PlayComponent implements OnInit, OnDestroy {
gameResultArr = []; gameResultArr = [];
drawIcon;
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(event) { onResize(event) {
this.winResizeEventStream.next(); this.winResizeEventStream.next();
...@@ -262,6 +264,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -262,6 +264,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.canvas.nativeElement.height = this.canvasHeight; this.canvas.nativeElement.height = this.canvasHeight;
// window['curCtx'] = this.ctx; // window['curCtx'] = this.ctx;
// window['curCanvas'] = this.canvas;
// const canvas = new OffscreenCanvas(this.canvasWidth, this.canvasHeight); // const canvas = new OffscreenCanvas(this.canvasWidth, this.canvasHeight);
...@@ -304,6 +307,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -304,6 +307,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// if (this.teachFlag) { // if (this.teachFlag) {
this.syncAllUser(data.all_user); this.syncAllUser(data.all_user);
this.initCurRole();
// } // }
next(); next();
...@@ -321,7 +326,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -321,7 +326,6 @@ export class PlayComponent implements OnInit, OnDestroy {
// const date = new Date().getTime(); // const date = new Date().getTime();
const {roleData, roleIndex, wordArr} = data; const {roleData, roleIndex, wordArr} = data;
this.initRole(roleData);
this.coverPageArr.length = 0; this.coverPageArr.length = 0;
this.startFlag = true; this.startFlag = true;
...@@ -338,6 +342,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -338,6 +342,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curWordIndex = this.roleIndex; this.curWordIndex = this.roleIndex;
this.initRole(roleData);
this.initCurRole(); this.initCurRole();
this.initCurView(); this.initCurView();
...@@ -457,10 +462,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -457,10 +462,12 @@ export class PlayComponent implements OnInit, OnDestroy {
syncAllUser(allUserData) { syncAllUser(allUserData) {
console.log(' syncAllUser 1 ');
if (!this.serverRoleArr) { if (!this.serverRoleArr) {
this.serverRoleArr = []; this.serverRoleArr = [];
} }
console.log(' syncAllUser 2 ');
for (let i = 0; i < allUserData.length; i++) { for (let i = 0; i < allUserData.length; i++) {
...@@ -481,9 +488,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -481,9 +488,11 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
if (this.roleArr && this.roleArr.length > 0) { console.log(' syncAllUser 3 ', this.serverRoleArr);
// if (this.roleArr && this.roleArr.length > 0) {
this.initRole(this.serverRoleArr); this.initRole(this.serverRoleArr);
} // }
} }
...@@ -886,6 +895,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -886,6 +895,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initBg(); this.initBg();
// this.initRole();
this.initServerRole(); this.initServerRole();
this.initGuessView(); this.initGuessView();
...@@ -954,10 +964,18 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -954,10 +964,18 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curWordIndex = this.roleIndex; this.curWordIndex = this.roleIndex;
if (this.roleIndex >= this.roleArr.length) {
console.log('game end');
this.gameEnd();
} else {
this.initCurRole(); this.initCurRole();
this.initCurView(); this.initCurView();
this.onServerRoundStart(); this.onServerRoundStart();
}
if (this.teachFlag) { if (this.teachFlag) {
this.teacherPage.visible = true; this.teacherPage.visible = true;
...@@ -968,6 +986,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -968,6 +986,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initTeacherPage() { initTeacherPage() {
this.teacherPageArr = []; this.teacherPageArr = [];
this.scoreDataArr = []; this.scoreDataArr = [];
this.teacherPageListArr = []; this.teacherPageListArr = [];
...@@ -1169,7 +1188,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1169,7 +1188,12 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('this.scoreDataArr.length:', this.scoreDataArr.length); console.log('this.scoreDataArr.length:', this.scoreDataArr.length);
} }
refreshTeacherPage(tmpSpr = '+') { refreshTeacherPage() {
let tmpSpr = '+';
if (this.gameEndFlag) {
tmpSpr = '';
}
const pageNum = 5; const pageNum = 5;
const startIndex = (this.curTeacherPage - 1) * pageNum; const startIndex = (this.curTeacherPage - 1) * pageNum;
const dataArr = this.scoreDataArr.slice(startIndex, startIndex + pageNum); const dataArr = this.scoreDataArr.slice(startIndex, startIndex + pageNum);
...@@ -1230,10 +1254,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1230,10 +1254,11 @@ export class PlayComponent implements OnInit, OnDestroy {
// //
// this.initRole(arr); // this.initRole(arr);
this.initRole();
if (this.serverAllUser) { if (this.serverAllUser) {
this.syncAllUser(this.serverAllUser); this.syncAllUser(this.serverAllUser);
} else {
this.initRole();
} }
} }
...@@ -1431,10 +1456,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1431,10 +1456,15 @@ export class PlayComponent implements OnInit, OnDestroy {
initCurRole() { initCurRole() {
this.curRole = this.roleArr[this.roleIndex]; this.curRole = this.roleArr[this.roleIndex];
this.drawIcon.x = this.curRole.x;
} }
initCurView() { initCurView() {
if (this.curRole.data.uuid == this.uuid) { if (this.curRole.data.uuid == this.uuid) {
this.guessFlag = false; this.guessFlag = false;
if (this.lineArr) { if (this.lineArr) {
...@@ -1600,12 +1630,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1600,12 +1630,12 @@ export class PlayComponent implements OnInit, OnDestroy {
const title = new MySprite(); // const title = new MySprite();
title.init(this.images.get('title')); // title.init(this.images.get('title'));
title.setScaleXY(this.mapScale); // title.setScaleXY(this.mapScale);
title.x = this.canvasWidth / 2; // title.x = this.canvasWidth / 2;
title.y = this.canvasHeight / 12; // title.y = this.canvasHeight / 12;
this.guessPageArr.push(title); // this.guessPageArr.push(title);
const guessWordBg = new MySprite(); const guessWordBg = new MySprite();
guessWordBg.init(this.images.get('text_guess'), 0, 0); guessWordBg.init(this.images.get('text_guess'), 0, 0);
...@@ -1800,12 +1830,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1800,12 +1830,15 @@ export class PlayComponent implements OnInit, OnDestroy {
const title = new MySprite(); // const title = new MySprite();
title.init(this.images.get('title')); // title.init(this.images.get('title'));
title.setScaleXY(this.mapScale); // title.setScaleXY(this.mapScale);
title.x = this.canvasWidth / 2; // title.x = this.canvasWidth / 2;
title.y = this.canvasHeight / 12; // title.y = this.canvasHeight / 12;
this.renderArr.push(title); // this.renderArr.push(title);
...@@ -2005,8 +2038,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2005,8 +2038,8 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
if (roleData.length > 17) { if (roleData.length > 15) {
roleData.length = 17; roleData.length = 15;
} }
for (let i = 0; i < roleData.length; i ++) { for (let i = 0; i < roleData.length; i ++) {
...@@ -2022,7 +2055,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2022,7 +2055,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.roleData = roleData; this.roleData = roleData;
this.roleArr = []; this.roleArr = [];
const headW = 64; const headW = 64;
...@@ -2045,7 +2077,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2045,7 +2077,7 @@ export class PlayComponent implements OnInit, OnDestroy {
headBg.y = offY; headBg.y = offY;
shapeRect.addChild(headBg); shapeRect.addChild(headBg);
const headId = Math.ceil( Math.random() * 9 ); const headId = i % 12 + 1; // Math.ceil( Math.random() * 12 );
const rolePic = new RoundSprite(); const rolePic = new RoundSprite();
rolePic.init(this.images.get('head_' + headId)); rolePic.init(this.images.get('head_' + headId));
rolePic.y = -2; rolePic.y = -2;
...@@ -2054,7 +2086,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2054,7 +2086,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const sy = rpLen / rolePic.height; const sy = rpLen / rolePic.height;
const s = Math.min(sx, sy); const s = Math.min(sx, sy);
rolePic.setScaleXY(s); rolePic.setScaleXY(s);
rolePic.setRadius(rolePic.width / 2); // rolePic.setRadius(rolePic.width / 2);
headBg.addChild(rolePic); headBg.addChild(rolePic);
...@@ -2069,11 +2101,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2069,11 +2101,13 @@ export class PlayComponent implements OnInit, OnDestroy {
nameBg.fillColor = '#000000'; nameBg.fillColor = '#000000';
nameBg.x = - nameBg.width / 2; nameBg.x = - nameBg.width / 2;
nameBg.y = headBg.height / 2; nameBg.y = headBg.height / 2;
nameBg.visible = false;
nameBg.childDepandVisible = false;
headBg.addChild(nameBg); headBg.addChild(nameBg);
const nameLabel = new Label(); const nameLabel = new Label();
nameLabel.text = data.nick_name; nameLabel.text = data.nick_name;
nameLabel.fontColor = '#ffffff'; nameLabel.fontColor = '#00a0ed';
nameLabel.textAlign = 'center'; nameLabel.textAlign = 'center';
// nameLabel.fontName = 'BRLNSDB'; // nameLabel.fontName = 'BRLNSDB';
nameLabel.fontSize = 12; nameLabel.fontSize = 12;
...@@ -2091,7 +2125,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2091,7 +2125,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
this.checkNameLabelWidth(nameLabel, nameBg.width * 0.6); this.checkNameLabelWidth(nameLabel, nameBg.width * 0.8);
const rightIcon = new MySprite(); const rightIcon = new MySprite();
...@@ -2113,12 +2147,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2113,12 +2147,22 @@ export class PlayComponent implements OnInit, OnDestroy {
const totalW = roleNum * headW + (roleNum - 1) * disW; const totalW = roleNum * headW + (roleNum - 1) * disW;
shapeRect.setSize(totalW, shapeH); shapeRect.setSize(totalW, shapeH);
shapeRect.setScaleXY(this.mapScale); shapeRect.setScaleXY(this.mapScale * 1.2);
shapeRect.x = this.canvasWidth / 2 - shapeRect.width / 2 * shapeRect.scaleX; shapeRect.x = this.canvasWidth / 2 - shapeRect.width / 2 * shapeRect.scaleX;
shapeRect.y = this.canvasHeight / 8.5; shapeRect.y = this.canvasHeight / 20;
shapeRect.fillColor = '#ff0000'; shapeRect.fillColor = '#ff0000';
shapeRect.alpha = 0; shapeRect.alpha = 0;
this.roleBg = shapeRect; this.roleBg = shapeRect;
console.log('~~len: ', shapeRect.children.length);
const drawIcon = new MySprite();
drawIcon.init(this.images.get('drawing_icon'));
this.drawIcon = drawIcon;
this.roleBg.addChild(drawIcon);
this.drawIcon.anchorY = 0.8;
// this.renderArr.push(shapeRect); // this.renderArr.push(shapeRect);
} }
...@@ -2396,7 +2440,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2396,7 +2440,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.curWordIndex = 0; // this.curWordIndex = 0;
// this.wordArr = randomSortByArr(this.wordArr); // this.wordArr = randomSortByArr(this.wordArr);
const tmpArr = randomSortByArr(this.wordArr); const tmpArr = randomSortByArr(this.wordArr);
this.wordArr.concat(tmpArr); this.wordArr = this.wordArr.concat(tmpArr);
} }
if (this.roleIndex >= this.roleArr.length) { if (this.roleIndex >= this.roleArr.length) {
...@@ -2537,6 +2581,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2537,6 +2581,9 @@ export class PlayComponent implements OnInit, OnDestroy {
guessOkBtnClick() { guessOkBtnClick() {
const data = this.wordArr[this.curWordIndex]; const data = this.wordArr[this.curWordIndex];
if (this.guessLabel.text.length == 0) {
return;
}
if (data.word == this.guessLabel.text) { if (data.word == this.guessLabel.text) {
// console.log(" right "); // console.log(" right ");
this.guessWordBg.img = this.images.get('text_guess_right'); this.guessWordBg.img = this.images.get('text_guess_right');
...@@ -2555,6 +2602,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2555,6 +2602,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.guessOkBtn.visible = false; this.guessOkBtn.visible = false;
this.guessCancleBtn.visible = false; this.guessCancleBtn.visible = false;
this.canTouch = false;
} }
guessCancleBtnClick() { guessCancleBtnClick() {
...@@ -2674,7 +2723,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2674,7 +2723,10 @@ export class PlayComponent implements OnInit, OnDestroy {
}); });
this.refreshTeacherPage(''); const pageListNum = 5;
this.totalTeacherPage = Math.ceil(this.scoreDataArr.length / pageListNum);
this.refreshTeacherPage();
} }
......
...@@ -54,12 +54,17 @@ const res = [ ...@@ -54,12 +54,17 @@ const res = [
['head_7', "assets/play/head/7.png"], ['head_7', "assets/play/head/7.png"],
['head_8', "assets/play/head/8.png"], ['head_8', "assets/play/head/8.png"],
['head_9', "assets/play/head/9.png"], ['head_9', "assets/play/head/9.png"],
['head_10', "assets/play/head/10.png"],
['head_11', "assets/play/head/11.png"],
['head_12', "assets/play/head/12.png"],
['t_right', "assets/play/teacher/right.png"], ['t_right', "assets/play/teacher/right.png"],
['t_arrow', "assets/play/teacher/arrow.png"], ['t_arrow', "assets/play/teacher/arrow.png"],
['drawing_icon', "assets/play/drawing_icon.png"],
......
src/assets/play/head/1.png

10.8 KB | W: | H:

src/assets/play/head/1.png

4.91 KB | W: | H:

src/assets/play/head/1.png
src/assets/play/head/1.png
src/assets/play/head/1.png
src/assets/play/head/1.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/2.png

9.54 KB | W: | H:

src/assets/play/head/2.png

4.55 KB | W: | H:

src/assets/play/head/2.png
src/assets/play/head/2.png
src/assets/play/head/2.png
src/assets/play/head/2.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/3.png

9.52 KB | W: | H:

src/assets/play/head/3.png

4.44 KB | W: | H:

src/assets/play/head/3.png
src/assets/play/head/3.png
src/assets/play/head/3.png
src/assets/play/head/3.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/4.png

16 KB | W: | H:

src/assets/play/head/4.png

5.45 KB | W: | H:

src/assets/play/head/4.png
src/assets/play/head/4.png
src/assets/play/head/4.png
src/assets/play/head/4.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/5.png

10.7 KB | W: | H:

src/assets/play/head/5.png

5.27 KB | W: | H:

src/assets/play/head/5.png
src/assets/play/head/5.png
src/assets/play/head/5.png
src/assets/play/head/5.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/6.png

11.3 KB | W: | H:

src/assets/play/head/6.png

4.23 KB | W: | H:

src/assets/play/head/6.png
src/assets/play/head/6.png
src/assets/play/head/6.png
src/assets/play/head/6.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/7.png

9.26 KB | W: | H:

src/assets/play/head/7.png

4.33 KB | W: | H:

src/assets/play/head/7.png
src/assets/play/head/7.png
src/assets/play/head/7.png
src/assets/play/head/7.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/8.png

12.4 KB | W: | H:

src/assets/play/head/8.png

5.2 KB | W: | H:

src/assets/play/head/8.png
src/assets/play/head/8.png
src/assets/play/head/8.png
src/assets/play/head/8.png
  • 2-up
  • Swipe
  • Onion skin
src/assets/play/head/9.png

12.8 KB | W: | H:

src/assets/play/head/9.png

5.04 KB | W: | H:

src/assets/play/head/9.png
src/assets/play/head/9.png
src/assets/play/head/9.png
src/assets/play/head/9.png
  • 2-up
  • Swipe
  • Onion skin
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