Commit c903ac49 authored by yu's avatar yu

1

parent bc05c104
This diff is collapsed.
......@@ -155,7 +155,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find("layout_bot", this.layout_game).on(cc.Node.EventType.TOUCH_END, () => {
this.updateShipPos(-340);
}, this);
cc.find("top/btn", this.node).on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(this.ship).to(0.1, { y: 360 }).call(() => {
cc.find("mid", this.node).active = true;
cc.find("top", this.node).active = false;
cc.find("bot", this.node).active = false;
}).start();
});
cc.find("mid/btn", this.node).on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(this.ship).to(0.1, { y: 0 }).call(() => {
cc.find("bot", this.node).active = true;
cc.find("mid", this.node).active = false;
cc.find("top", this.node).active = false;
}).start();
});
cc.find("bot/btn", this.node).on(cc.Node.EventType.TOUCH_END, () => {
cc.tween(this.ship).to(0.1, { y: -340 }).call(() => {
cc.find("bot", this.node).active = false;
cc.find("top", this.node).active = false;
cc.find("mid", this.node).active = false;
this.isGuide = true;
}).start();
});
pg.event.on("game_time_over", () => {
......@@ -176,8 +197,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
private updateShipPos(y = 0) {
if (this.isDeath) return;
if (Game.getIns().state == GAME_STATE.OVER) return;
Game.getIns().state = GAME_STATE.RUNNING;
cc.find("hand_ske", this.layout_game).active = false;
// Game.getIns().state = GAME_STATE.RUNNING;
// cc.find("hand_ske", this.layout_game).active = false;
cc.tween(this.ship).to(0.1, { y: y }).start();
}
private onAudioOn() {
......@@ -199,12 +220,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private stopBgAudio() {
cc.audioEngine.pauseMusic();
}
// onTouchStart() {
// pg.audio.playLocalAudio(cc.find(`Canvas/res/audio/btn`));
// pg.audio.playBgAudioByUrl(Game.getIns().bgAudio);
// this.showBgLightAction();
// pg.event.emit("game_start");
// }
private sendData(score) {
return new Promise(res => {
let upData: any = {
......@@ -252,10 +268,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.isDeath = false;
this.layout_card.removeAllChildren();
this.ship.setPosition(-this.endX2, 0);
cc.tween(this.ship).to(0.5, { x: -670 }).start();
cc.tween(this.ship).to(0.5, { x: -670 }).call(() => {
Game.getIns().state = GAME_STATE.RUNNING;
}).start();
this.showQuestions();
this.playLaba();
}
......@@ -316,13 +334,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.parent = this.layout_card;
item.data = data;
data.fish.node = item;
// data.fish.node = item;
//x y 起始点 和终点 进行 随机
cc.Tween.stopAllByTarget(item);
//左往右
item.y = pos[id];// -1300 / 2 + Math.random() * 1300;
item.x = 1400;//
cc.tween(item).to(6, { x: -1400 }).call(() => {
cc.tween(item).to(this.isSpeedUp ? 4 : 6, { x: -1400 }).call(() => {
data.fish.isOut = FISH_OUT.OUT;
this.viewFishs = this.viewFishs.filter(v => v.id != data.id);
}).start();
......@@ -353,8 +371,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
return dis;
}
private updateTime = 2;
private isGuide = false
update(dt) {
if (Game.getIns().state != GAME_STATE.RUNNING) return;
if (!this.isGuide) return;
this.isHitBalloon();
this.updateTime += dt;
if (this.updateTime < 2.3) return;
......@@ -443,8 +463,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
fire_ske.active = true;
this.playLocalAudio("huoyan").then(() => {
fire_ske.active = false;
this.isSpeedUp = false;
});
this.showBgLightAction(true);
this.showQuickAction();
fire_ske.getComponent(dragonBones.ArmatureDisplay).playAnimation("newAnimation", 5);
this.schedule(() => {
item.active = false;
......@@ -454,7 +476,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
});
}
private isSpeedUp = false;
private showQuickAction() {
this.isSpeedUp = true;
this.fishs.forEach((item) => {
cc.Tween.stopAllByTarget(item);
let data = item.data;
cc.tween(item).to(item.x < 0 ? 1.5 : 3, { x: -1400 }).call(() => {
data.fish.isOut = FISH_OUT.OUT;
this.viewFishs = this.viewFishs.filter(v => v.id != data.id);
}).start();
})
}
private onTouchItem(e) {
if (Game.getIns().state == GAME_STATE.OVER) return;
......
......@@ -61,7 +61,7 @@ export class Item {
this.optionList.sort(function () {
return (0.5 - Math.random());
});
this.optionList.push(new Option({ type: "jl", right: true, image: "", text: "" }, 456));
this.optionList.push(new Option({ type: "jl", right: false, image: "", text: "" }, 456));
this.rNum = 0;
for (let i = 0; i < this.optionList.length; i++) {
if (this.optionList[i].right) this.rNum++;
......
......@@ -32,52 +32,53 @@ export const defaultData = {
"text": "one",
"time": "",
"right": false
}, {
"type": "txt",
"image": "",
"audio": "",
"text": "seven",
"time": "",
"right": false
}, {
"type": "txt",
"image": "",
"audio": "",
"text": "kill",
"time": "",
"right": true
}, {
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
"text": "ameameameameame",
"time": "",
"right": true,
"audioName": "right.mp3"
}, {
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/237e6cf60d500061c5c7ec69c5110414.png",
"audio": "http://staging-teach.cdn.ireadabc.com/7f1fba5bc7fa3ac27737730bcd2d86e0_l.mp3",
"text": "",
"time": "",
"right": true,
"audioName": "again.mp3"
}, {
"type": "txt",
"image": "",
"audio": "",
"text": "five",
"time": "",
"right": false
}, {
"type": "txt",
"image": "",
"audio": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
"text": "right",
"time": "",
"right": true,
"audioName": "right.mp3"
}
},
// {
// "type": "txt",
// "image": "",
// "audio": "",
// "text": "seven",
// "time": "",
// "right": false
// }, {
// "type": "txt",
// "image": "",
// "audio": "",
// "text": "kill",
// "time": "",
// "right": true
// }, {
// "type": "txt",
// "image": "",
// "audio": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
// "text": "ameameameameame",
// "time": "",
// "right": true,
// "audioName": "right.mp3"
// }, {
// "type": "img",
// "image": "http://staging-teach.cdn.ireadabc.com/237e6cf60d500061c5c7ec69c5110414.png",
// "audio": "http://staging-teach.cdn.ireadabc.com/7f1fba5bc7fa3ac27737730bcd2d86e0_l.mp3",
// "text": "",
// "time": "",
// "right": true,
// "audioName": "again.mp3"
// }, {
// "type": "txt",
// "image": "",
// "audio": "",
// "text": "five",
// "time": "",
// "right": false
// }, {
// "type": "txt",
// "image": "",
// "audio": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
// "text": "right",
// "time": "",
// "right": true,
// "audioName": "right.mp3"
// }
],
"type": "txt",
"audioUrl": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
......@@ -159,7 +160,7 @@ export const defaultData = {
}
],
"type": "txt",
"audioUrl": "",
"audioUrl": "http://staging-teach.cdn.ireadabc.com/3656883821fc547da4af0253476ab9be_l.mp3",
"audioName": "",
"text": ""
}
......
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