Commit 11508b51 authored by Tt's avatar Tt

fix

parent 0c1b5a42
This diff is collapsed.
......@@ -168,6 +168,7 @@ cc.Class({
this.refreshCoolCatPosition();
//TODO:copy
this.updateBg();
this.hideFlower();
this.firstCar();
......@@ -176,6 +177,16 @@ cc.Class({
this.jumpToQuestion(this.status.currentQuestionIdx);
});
},
updateBg() {
let bgSky = cc.find("Canvas/bg/bgSky");
if (bgSky.isScaled) return;
let scaleX = cc.winSize.width / bgSky.width;
let scaleY = cc.winSize.height / bgSky.height;
let scale = scaleX > scaleY ? scaleX : scaleY;
bgSky.isScaled = true;
bgSky.width *= scale
bgSky.height *= scale
},
refreshCoolCatPosition() {
......@@ -206,11 +217,12 @@ cc.Class({
optionNode.y = canvasHeight / 2 - box.y - 300;
optionNode.scale = 0;
optionNode.parent = box;
optionNode.targetScale = Math.min((maxOptionWidth * 0.80) / optionNode.width, maxOptionHeight / optionNode.height)
//TODO:copy---start
this.optionNodes.push(optionNode);
cc.tween(optionNode)
.to(0.2, { scale: Math.min((maxOptionWidth * 0.80) / optionNode.width * 1.05, maxOptionHeight / optionNode.height) * 1.05 })
.to(0.2, { scale: Math.min((maxOptionWidth * 0.80) / optionNode.width, maxOptionHeight / optionNode.height) })
.to(0.2, { scale: optionNode.targetScale * 1.05 })
.to(0.2, { scale: optionNode.targetScale })
.start();
//TODO:copy---end
});
......@@ -270,7 +282,7 @@ cc.Class({
}
cc.tween(optionNode)
.to(0.2, { x: 0, y: 100 }, cc.easing.quadOut)
.to(0.2, { x: 0, y: 100, scale: 0.6 }, cc.easing.quadOut)
.start();
this.boxJump();
......@@ -353,11 +365,10 @@ cc.Class({
//TODO:copy---start
firstCar() {
let pos1 = cc.v2(-30, -440);
let pos2 = cc.v2(2200, -440);
let pos3 = cc.v2(-2200, -440);
let pos2 = cc.v2(2500, -440);
let pos3 = cc.v2(-2500, -440);
const car1 = cc.find('Canvas/bg/car_1');
const car2 = cc.find('Canvas/bg/car_2');
const car3 = cc.find('Canvas/bg/car_3');
car1.x = pos2.x;
car1.y = pos2.y;
car2.x = pos2.x;
......@@ -365,17 +376,18 @@ cc.Class({
cc.tween(car1).to(1, { x: pos1.x }).start();
},
showFlower() {
for (let i = 1; i <= 3; i++) {
for (let i = 1; i <= 2; i++) {
const flower = cc.find(`Canvas/bg/car_${i}/车尾气_ske`);
const db = flower.getComponent(dragonBones.ArmatureDisplay)
db.playAnimation("normal", 1)
flower.active = true;
}
let pos1 = cc.v2(-30, -440);
let pos2 = cc.v2(2200, -440);
let pos3 = cc.v2(-2200, -440);
let pos2 = cc.v2(2500, -440);
let pos3 = cc.v2(-2500, -440);
const car1 = cc.find('Canvas/bg/car_1');
const car2 = cc.find('Canvas/bg/car_2');
const car3 = cc.find('Canvas/bg/car_3');
car1.x = pos1.x;
car1.y = pos2.y;
cc.tween(car1).by(0.2, { x: -60 }).by(0.2, { x: -100 }).by(0.2, { x: -120 }).by(0.2, { x: -140 }).by(0.2, { x: -180 }).to(1, { x: pos3.x }, cc.easing.quadIn).start();
......@@ -400,17 +412,16 @@ cc.Class({
}, 500);
},
hideFlower() {
for (let i = 1; i <= 3; i++) {
for (let i = 1; i <= 2; i++) {
const flower = cc.find(`Canvas/bg/car_${i}/车尾气_ske`);
flower.active = false;
}
let pos1 = cc.v2(-30, -440);
let pos2 = cc.v2(2200, -440);
let pos3 = cc.v2(-2200, -440);
let pos2 = cc.v2(2500, -440);
let pos3 = cc.v2(-2500, -440);
const car1 = cc.find('Canvas/bg/car_1');
const car2 = cc.find('Canvas/bg/car_2');
const car3 = cc.find('Canvas/bg/car_3');
car1.x = pos1.x;
car1.y = pos2.y;
car2.x = pos2.x;
......@@ -438,7 +449,7 @@ cc.Class({
.forEach(child => {
child.optionData.selected = false;
cc.tween(child)
.to(0.2, { x: child.startPos.x, y: child.startPos.y })
.to(0.2, { x: child.startPos.x, y: child.startPos.y, scale: child.targetScale })
.start();
});
......
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