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 { NgModule } from '@angular/core';
import { NgModule, ErrorHandler } from '@angular/core';
import {MyErrorHandler} from './MyError';
import { AppComponent } from './app.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
......@@ -50,7 +52,10 @@ registerLocaleData(zh);
BrowserAnimationsModule,
FontAwesomeModule
],
providers: [{ provide: NZ_I18N, useValue: zh_CN }],
providers: [
{provide: ErrorHandler, useClass: MyErrorHandler},
{ provide: NZ_I18N, useValue: zh_CN }
],
bootstrap: [AppComponent]
})
export class AppModule {
......
......@@ -3,6 +3,11 @@
height: 100%;
background: #ffffff;
background-size: cover;
-webkit-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}
#canvas {
......
......@@ -151,6 +151,8 @@ export class PlayComponent implements OnInit, OnDestroy {
gameResultArr = [];
drawIcon;
@HostListener('window:resize', ['$event'])
onResize(event) {
this.winResizeEventStream.next();
......@@ -262,6 +264,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.canvas.nativeElement.height = this.canvasHeight;
// window['curCtx'] = this.ctx;
// window['curCanvas'] = this.canvas;
// const canvas = new OffscreenCanvas(this.canvasWidth, this.canvasHeight);
......@@ -304,6 +307,8 @@ export class PlayComponent implements OnInit, OnDestroy {
// if (this.teachFlag) {
this.syncAllUser(data.all_user);
this.initCurRole();
// }
next();
......@@ -321,7 +326,6 @@ export class PlayComponent implements OnInit, OnDestroy {
// const date = new Date().getTime();
const {roleData, roleIndex, wordArr} = data;
this.initRole(roleData);
this.coverPageArr.length = 0;
this.startFlag = true;
......@@ -338,6 +342,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curWordIndex = this.roleIndex;
this.initRole(roleData);
this.initCurRole();
this.initCurView();
......@@ -457,10 +462,12 @@ export class PlayComponent implements OnInit, OnDestroy {
syncAllUser(allUserData) {
console.log(' syncAllUser 1 ');
if (!this.serverRoleArr) {
this.serverRoleArr = [];
}
console.log(' syncAllUser 2 ');
for (let i = 0; i < allUserData.length; i++) {
......@@ -481,9 +488,11 @@ export class PlayComponent implements OnInit, OnDestroy {
}
if (this.roleArr && this.roleArr.length > 0) {
this.initRole(this.serverRoleArr);
}
console.log(' syncAllUser 3 ', this.serverRoleArr);
// if (this.roleArr && this.roleArr.length > 0) {
this.initRole(this.serverRoleArr);
// }
}
......@@ -886,6 +895,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initBg();
// this.initRole();
this.initServerRole();
this.initGuessView();
......@@ -954,10 +964,18 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curWordIndex = this.roleIndex;
this.initCurRole();
this.initCurView();
if (this.roleIndex >= this.roleArr.length) {
console.log('game end');
this.gameEnd();
} else {
this.initCurRole();
this.initCurView();
this.onServerRoundStart();
}
this.onServerRoundStart();
if (this.teachFlag) {
this.teacherPage.visible = true;
......@@ -968,6 +986,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initTeacherPage() {
this.teacherPageArr = [];
this.scoreDataArr = [];
this.teacherPageListArr = [];
......@@ -1169,7 +1188,12 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('this.scoreDataArr.length:', this.scoreDataArr.length);
}
refreshTeacherPage(tmpSpr = '+') {
refreshTeacherPage() {
let tmpSpr = '+';
if (this.gameEndFlag) {
tmpSpr = '';
}
const pageNum = 5;
const startIndex = (this.curTeacherPage - 1) * pageNum;
const dataArr = this.scoreDataArr.slice(startIndex, startIndex + pageNum);
......@@ -1230,10 +1254,11 @@ export class PlayComponent implements OnInit, OnDestroy {
//
// this.initRole(arr);
this.initRole();
if (this.serverAllUser) {
this.syncAllUser(this.serverAllUser);
} else {
this.initRole();
}
}
......@@ -1431,10 +1456,15 @@ export class PlayComponent implements OnInit, OnDestroy {
initCurRole() {
this.curRole = this.roleArr[this.roleIndex];
this.drawIcon.x = this.curRole.x;
}
initCurView() {
if (this.curRole.data.uuid == this.uuid) {
this.guessFlag = false;
if (this.lineArr) {
......@@ -1600,12 +1630,12 @@ export class PlayComponent implements OnInit, OnDestroy {
const title = new MySprite();
title.init(this.images.get('title'));
title.setScaleXY(this.mapScale);
title.x = this.canvasWidth / 2;
title.y = this.canvasHeight / 12;
this.guessPageArr.push(title);
// const title = new MySprite();
// title.init(this.images.get('title'));
// title.setScaleXY(this.mapScale);
// title.x = this.canvasWidth / 2;
// title.y = this.canvasHeight / 12;
// this.guessPageArr.push(title);
const guessWordBg = new MySprite();
guessWordBg.init(this.images.get('text_guess'), 0, 0);
......@@ -1800,12 +1830,15 @@ export class PlayComponent implements OnInit, OnDestroy {
const title = new MySprite();
title.init(this.images.get('title'));
title.setScaleXY(this.mapScale);
title.x = this.canvasWidth / 2;
title.y = this.canvasHeight / 12;
this.renderArr.push(title);
// const title = new MySprite();
// title.init(this.images.get('title'));
// title.setScaleXY(this.mapScale);
// title.x = this.canvasWidth / 2;
// title.y = this.canvasHeight / 12;
// this.renderArr.push(title);
......@@ -2005,8 +2038,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
if (roleData.length > 17) {
roleData.length = 17;
if (roleData.length > 15) {
roleData.length = 15;
}
for (let i = 0; i < roleData.length; i ++) {
......@@ -2022,7 +2055,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.roleData = roleData;
this.roleArr = [];
const headW = 64;
......@@ -2045,7 +2077,7 @@ export class PlayComponent implements OnInit, OnDestroy {
headBg.y = offY;
shapeRect.addChild(headBg);
const headId = Math.ceil( Math.random() * 9 );
const headId = i % 12 + 1; // Math.ceil( Math.random() * 12 );
const rolePic = new RoundSprite();
rolePic.init(this.images.get('head_' + headId));
rolePic.y = -2;
......@@ -2054,7 +2086,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const sy = rpLen / rolePic.height;
const s = Math.min(sx, sy);
rolePic.setScaleXY(s);
rolePic.setRadius(rolePic.width / 2);
// rolePic.setRadius(rolePic.width / 2);
headBg.addChild(rolePic);
......@@ -2069,11 +2101,13 @@ export class PlayComponent implements OnInit, OnDestroy {
nameBg.fillColor = '#000000';
nameBg.x = - nameBg.width / 2;
nameBg.y = headBg.height / 2;
nameBg.visible = false;
nameBg.childDepandVisible = false;
headBg.addChild(nameBg);
const nameLabel = new Label();
nameLabel.text = data.nick_name;
nameLabel.fontColor = '#ffffff';
nameLabel.fontColor = '#00a0ed';
nameLabel.textAlign = 'center';
// nameLabel.fontName = 'BRLNSDB';
nameLabel.fontSize = 12;
......@@ -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();
......@@ -2113,12 +2147,22 @@ export class PlayComponent implements OnInit, OnDestroy {
const totalW = roleNum * headW + (roleNum - 1) * disW;
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.y = this.canvasHeight / 8.5;
shapeRect.y = this.canvasHeight / 20;
shapeRect.fillColor = '#ff0000';
shapeRect.alpha = 0;
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);
}
......@@ -2396,7 +2440,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.curWordIndex = 0;
// this.wordArr = randomSortByArr(this.wordArr);
const tmpArr = randomSortByArr(this.wordArr);
this.wordArr.concat(tmpArr);
this.wordArr = this.wordArr.concat(tmpArr);
}
if (this.roleIndex >= this.roleArr.length) {
......@@ -2537,6 +2581,9 @@ export class PlayComponent implements OnInit, OnDestroy {
guessOkBtnClick() {
const data = this.wordArr[this.curWordIndex];
if (this.guessLabel.text.length == 0) {
return;
}
if (data.word == this.guessLabel.text) {
// console.log(" right ");
this.guessWordBg.img = this.images.get('text_guess_right');
......@@ -2555,6 +2602,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.guessOkBtn.visible = false;
this.guessCancleBtn.visible = false;
this.canTouch = false;
}
guessCancleBtnClick() {
......@@ -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 = [
['head_7', "assets/play/head/7.png"],
['head_8', "assets/play/head/8.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_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