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