Commit 20cd3065 authored by Chen Jiping's avatar Chen Jiping

完善

parent 810ae243
......@@ -136,11 +136,7 @@ export class ColorCard extends Item {
}
click(callback = null) {
this.touched = true;
this.lightPic.alpha = 1;
if (callback) {
callback();
}
this.touch(callback);
}
touch(callback = null) {
......
......@@ -301,6 +301,7 @@ export class Card extends Item {
}
checkRight(colorCode, color, callback = null, errCallback = null) {
console.log(colorCode, color);
if (!colorCode) {
this.showErr(errCallback);
return false;
......@@ -317,10 +318,15 @@ export class Card extends Item {
}
private showErr(callback = null) {
this.cardLight.alpha = 0;
this.clearColor();
this.cardLight.alpha = 1;
playAudio(this.audioObj['wrong']);
shake2(this.bg, 1, callback);
shake2(this.bg, 1, ()=>{
this.clearColor();
if(callback){
callback();
}
});
}
private showRight(color, callback = null) {
......
......@@ -776,9 +776,9 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.checkClickTarget(colorCard.bg)) {
if (this.curCard) {
if (this.curCard && !this.curCard.answered) {
this.canTouch = false;
this.curCard.fillColor(colorCard.color);
this.curCard.checkRight(colorCard.code, colorCard.color, () => {
......@@ -842,7 +842,7 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
else {
if (this.curCard) {
if (this.curCard && !this.curCard.answered) {
this.curCard.clearColor();
}
}
......
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