Commit c5b38590 authored by linzhiguo's avatar linzhiguo

+ 优化启动流程

parent a4a4bbb2
......@@ -12625,7 +12625,7 @@
"__id__": 230
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 233
......
......@@ -162,28 +162,9 @@ cc.Class({
loadEnd() {
this.initData();
this.initAudio();
this.initView();
// this.initListener();
},
initData() {
},
initAudio() {
// const audioNode = cc.find('res/audio');
// const getAudioByResName = (resName) => {
// return audioNode.getChildByName(resName).getComponent(cc.AudioSource);
// }
// this.audioBtn = getAudioByResName('btn');
},
initView() {
window.WL = this;
this.shuffle(this.data.mouses);
......@@ -193,16 +174,15 @@ cc.Class({
this._hammer = cc.find('Canvas/hammer');
this.title.string = this.data.title;
if (this.data.audio_url && this.data.audio_url!=""){
playAudioByUrl(this.data.audio_url);
}
this.updateFlagArea(()=>{
this.playAudioByName('time321');
this.playTimer(()=>{
this.nextMouse();
})
let audio_url = this.data.audio_url;
if (audio_url && audio_url!=""){
playAudioByUrl(audio_url, ()=>{
this.playGame();
});
}
else{
this.playGame();
}
this.node.on(cc.Node.EventType.TOUCH_START, (event)=>{
if (!this._touched)
......@@ -240,6 +220,15 @@ cc.Class({
}, this);
},
playGame(){
this.updateFlagArea(()=>{
this.playAudioByName('time321');
this.playTimer(()=>{
this.nextMouse();
})
});
},
updateFlagArea(cb){
let flag_area = cc.find('Canvas/flag_area');
flag_area.removeAllChildren();
......
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