Commit 6909e0d2 authored by 范雪寒's avatar 范雪寒

fix:bugs

parent 505ec76e
......@@ -3164,8 +3164,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 200
"width": 40,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -3220,7 +3220,7 @@
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
},
"_type": 0,
"_sizeMode": 0,
"_sizeMode": 2,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -3782,7 +3782,7 @@
"_groupIndex": 0,
"groupIndex": 0,
"showInEditor": false,
"_id": "b32fignA1E/ZHx1Ogc9aIC"
"_id": "4bOpy++iVNpZm87WDUy2YY"
},
{
"__type__": "cc.Label",
......@@ -3817,7 +3817,7 @@
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "51w5xnPDZPu5aHqpFiXcJd"
"_id": "75K4dvb4tMIrR6eMzEciLa"
},
{
"__type__": "cc.RichText",
......
......@@ -195,6 +195,10 @@ cc.Class({
starLayout.zIndex = 2;
const paddingY = starLayout.getComponent(cc.Layout).spacingY;
if (this.data.questionList.length == 1) {
starLayout.active = false;
}
for (let i = 0; i < this.data.questionList.length; i++) {
const starBase = cc.instantiate(cc.find('StarBase'));
starBase.name = `starBase_${i}`;
......@@ -243,6 +247,7 @@ cc.Class({
await asyncDelay(0.6);
await asyncTweenTo(starBig, 0.8, { scale: 0 }, { easing: 'quadOut' });
await this.playAudioSync('question');
},
isEndGame() {
......@@ -267,7 +272,6 @@ cc.Class({
this.createStars();
await this.showGuns();
await this.playAudioSync('question');
await this.playQuestionAudio();
this.startShowBalls();
},
......@@ -363,30 +367,32 @@ cc.Class({
if (ball.canNotTouch) {
return;
}
ball.canNotTouch = true;
if (answer.rightAnswer) {
ball.canNotTouch = true;
}
const location = event.getLocation();
await this.shootTarget(ball, location, true);
if (answer.rightAnswer) {
this.targetDistroy(ball);
this._status.currentRightNumber++;
const currentQuestion = this.data.questionList[this._status.currentQuestionIdx];
this.updateRightNumber();
if (this._status.currentRightNumber >= currentQuestion.rigthNumber) {
this.stopShowBalls();
await asyncDelay(0.5);
await this.showStar();
this._status.currentRightNumber = 0;
this._status.currentQuestionIdx++;
if (this.isEndGame()) {
this.onGameEnd();
} else {
await asyncDelay(1.5);
await this.playQuestionAudio();
this.startShowBalls();
}
}
} else {
if (!answer.rightAnswer) {
this.targetLaugh(ball);
return;
}
this.targetDistroy(ball);
this._status.currentRightNumber++;
const currentQuestion = this.data.questionList[this._status.currentQuestionIdx];
this.updateRightNumber();
if (this._status.currentRightNumber >= currentQuestion.rigthNumber) {
this.stopShowBalls();
await asyncDelay(0.5);
await this.showStar();
this._status.currentRightNumber = 0;
this._status.currentQuestionIdx++;
if (this.isEndGame()) {
this.onGameEnd();
} else {
await asyncDelay(1.5);
await this.playQuestionAudio();
this.startShowBalls();
}
}
});
......@@ -407,11 +413,17 @@ cc.Class({
return ball;
},
onBallClicked(answer) {
},
createImgBall(answer) {
const ball = cc.instantiate(cc.find('BallImg'));
const img = cc.find('Mask/AnsterImg', ball);
const mask = cc.find('Mask', ball);
getSpriteFrimeByUrl(answer.answerImg, (spriteFrame) => {
img.getComponent(cc.Sprite).spriteFrame = spriteFrame;
img.scale = Math.min(1, mask.width / img.width, mask.height / img.height);
});
return ball;
},
......
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