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

完善

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