Commit ebe05d12 authored by Tt's avatar Tt

处理完成

parent d7d49058
This diff is collapsed.
......@@ -68,8 +68,28 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initData();
this.initView();
this.initEvent();
this.startTime();
this.updateTop();
this.startShowXiaodi().then(() => {
this.endShowXiaodi();
this.startTime();
this.updateTop();
})
}
startShowXiaodi() {
return new Promise((resolve, reject) => {
if (!this.data.npcAudio) return resolve('');
pg.view.find(this, 'layout_xiaodi/btn_go').active = false;
pg.view.find(this, 'layout_xiaodi').active = true;
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playEnter(this.data.npcAudio).then(() => {
resolve('');
})
});
}
endShowXiaodi() {
if (!this.data.npcAudio) return;
pg.view.find(this, 'layout_xiaodi').active = true;
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playEnterEnd()
}
protected onDestroy(): void {
pg.event.clear();
......@@ -118,7 +138,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.audioEngine.stopAllEffects();
this.layout_start = pg.view.find(this, "layout_start");
this.layout_start.active = true;
if (Game.getIns().title) {
cc.find("layout_info/label_title", this.node).getComponent(cc.Label).string = Game.getIns().title;
......@@ -451,6 +470,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
private async startTime() {
this.layout_start.active = true;
for (let i = 3; i >= 0; i--) {
let target = cc.find("layout_start/text_" + i, this.node);
if (i == 0) this.playLocalAudio("go")
......
......@@ -15,31 +15,47 @@ export default class dg_xiaodi extends cc.Component {
}
private audioIdEnter: any;
playEnter(audioUrl) {
this.node.active = true;
let startX = this.defaultX + this.moveX;
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.3, { x: this.defaultX })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
return new Promise((resolve, reject) => {
this.node.active = true;
let startX = this.defaultX + this.moveX;
this.aniRole.x = startX;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: 0 })
.call(() => {
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
pg.view.playDBAnimation(this.aniRole, 'talk');
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdEnter = null;
pg.view.playDBAnimation(this.aniRole, 'normal');
}, audioId => {
this.audioIdEnter = audioId;
pg.audio.playAudioByUrl(audioUrl, () => {
this.audioIdEnter = null;
cc.tween(this.aniRole)
.call(() => {
pg.view.playDBAnimation(this.aniRole, 'run');
if (this.moveX < 0) {
this.aniRole.scaleX = -this.aniRole.scaleX;
}
})
.to(0.5, { x: 1500 })
.call(() => {
this.scheduleOnce(() => {
resolve('');
}, 0.5)
})
.start();
}, audioId => {
this.audioIdEnter = audioId;
})
})
})
.start();
.start();
});
}
playEnterEnd() {
this.node.active = false;
......
export const defaultData = {
"npcAudioText": "退出",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3",
"npcAudioName": "paomo_hy11_plp.mp3",
"npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3",
"npcAudioEndName": "paomo_hy11_plp.mp3",
"title": "听音选择", "questions": [{
......
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