Commit 781def4d authored by Chen Jiping's avatar Chen Jiping

完善

parent 525d1c28
......@@ -598,27 +598,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.showPetalStatus = false;
//绳子X坐标(从下往上)
const initCardX = () => {
//第一根
this.cardXArr.push(this.canvasWidth / 2 - 90 * this.mapScale);
//第二根
this.cardXArr.push(this.canvasWidth / 2 + 114 * this.mapScale);
//第三根
this.cardXArr.push(this.canvasWidth / 2 - 60 * this.mapScale);
//第四根
this.cardXArr.push(this.canvasWidth / 2 + 64 * this.mapScale);
//第五根
this.cardXArr.push(this.canvasWidth / 2);
};
initCardX();
this.canOverCard = true;
}
......@@ -666,8 +646,9 @@ export class PlayComponent implements OnInit, OnDestroy {
bg_pic.init(this.images.get("bg"));
bg_pic.x = this.canvasWidth / 2;
bg_pic.y = this.canvasHeight / 2;
bg_pic.setScaleXY(Math.max(this.canvasWidth / bg_pic.width, this.canvasHeight / bg_pic.height));
//bg_pic.setScaleXY(Math.max(this.canvasWidth / bg_pic.width, this.canvasHeight / bg_pic.height));
bg_pic.scaleX = this.canvasWidth / bg_pic.width;
bg_pic.scaleY = this.canvasHeight / bg_pic.height;
this.bg = bg_pic;
this.renderArr.push(bg_pic);
......@@ -680,6 +661,28 @@ export class PlayComponent implements OnInit, OnDestroy {
*/
initFloorPic() {
//绳子X坐标(从下往上)
const initCardX = () => {
//第一根
this.cardXArr.push(this.canvasWidth / 2 - 90 * this.bg.scaleX);
//第二根
this.cardXArr.push(this.canvasWidth / 2 + 114 * this.bg.scaleX);
//第三根
this.cardXArr.push(this.canvasWidth / 2 - 60 * this.bg.scaleX);
//第四根
this.cardXArr.push(this.canvasWidth / 2 + 64 * this.bg.scaleX);
//第五根
this.cardXArr.push(this.canvasWidth / 2);
};
initCardX();
//取练习题
let exercisesArr = this.data.exercises;
......@@ -722,7 +725,8 @@ export class PlayComponent implements OnInit, OnDestroy {
const rope = new MySprite();
rope.init(this.images.get(ropeImgKey));
rope.setScaleXY(this.bg.scaleY);
rope.scaleX = this.bg.scaleX;
rope.scaleY = this.bg.scaleY;
rope.x = this.canvasWidth / 2;
rope.y = startY - rope.getBoundingBox().height / 2;
......@@ -736,7 +740,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.renderArr.push(rope);
startY = startY - 118 * this.mapScale;
startY = startY - 118 * this.bg.scaleY;
}
......@@ -1077,6 +1081,8 @@ export class PlayComponent implements OnInit, OnDestroy {
//显示背面,则翻转
if (card.curShow == '0') {
this.playAudio('click');
if(!this.canOverCard){
return;
}
......@@ -1118,6 +1124,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
else {
this.playAudio('click');
//停止所有的音效
for(let i = 0; i < this.exercisesArr.length; ++ i){
......@@ -1159,6 +1167,8 @@ export class PlayComponent implements OnInit, OnDestroy {
return;
}
//停止闪烁
this.stopLightMonkey();
......@@ -1173,6 +1183,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (monkey.curFloor < this.exercisesArr.length - 1) {
if (monkey.curFloor < this.floorInfo.nextFloor) {
this.playAudio('monkey');
let floor = this.floorInfo.floors[monkey.curFloor + 1];
//移动到下一层
......@@ -1204,6 +1216,8 @@ export class PlayComponent implements OnInit, OnDestroy {
}
}
this.playAudio('monkey');
let toX = this.peach.initX - monkey.baseboard.getBoundingBox().width / 2;
let toY = this.peach.initY - monkey.baseboard.getBoundingBox().height / 2 + 30 * this.mapScale;
......@@ -1309,8 +1323,6 @@ export class PlayComponent implements OnInit, OnDestroy {
*/
overCard(item, callback?: any) {
this.playAudio('spring');
let w = this.mapScale;
tweenChange(item.children[2], { scaleX: 0 }, 0.3, () => {
......@@ -1562,11 +1574,11 @@ export class PlayComponent implements OnInit, OnDestroy {
if (i == this.exercisesArr.length - 1) {
tweenChange(exercises.baseboard, {scaleY : this.mapScale}, 0.3, () => {
this.playAudio('spring');
this.playAudio('monkey');
tweenChange(exercises.baseboard, {scaleY : 1}, 0.3, () => {
this.jump(this.leftMonkey, 300 * this.mapScale, this.leftMonkey.initY, 0.5, () => {
this.jump(this.leftMonkey, 300 * this.bg.scaleX, this.leftMonkey.initY, 0.5, () => {
//显示最底层的卡片
this.lightCard(this.exercisesArr[0]);
......@@ -1576,12 +1588,12 @@ export class PlayComponent implements OnInit, OnDestroy {
this.canClickMonkey = true;
});
this.jump(this.rightMonkey, this.canvasWidth - 300 * this.mapScale - this.rightMonkey.baseboard.getBoundingBox().width, this.rightMonkey.initY, 0.5);
this.jump(this.rightMonkey, this.canvasWidth - 300 * this.bg.scaleX - this.rightMonkey.baseboard.getBoundingBox().width, this.rightMonkey.initY, 0.5);
});
}
else {
tweenChange(exercises.baseboard, {scaleY : this.mapScale}, 0.3)
tweenChange(exercises.baseboard, {scaleY : 1}, 0.3)
}
}
......
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