Commit c5b38590 authored by linzhiguo's avatar linzhiguo

+ 优化启动流程

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