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

完善

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