future 1 год назад
Родитель
Сommit
a14a51ffa7

+ 5 - 0
assets/script/run/sceneManager.ts

@@ -59,6 +59,10 @@ export class sceneManager extends Component {
         }
     }
 
+    public stopMusic(){
+        this.getSound().pause()
+    }
+
     getSound(){
         if(this.node.getComponent(AudioSource)!=null){
             return this.node.getComponent(AudioSource)
@@ -89,6 +93,7 @@ export class sceneManager extends Component {
         if(this.mPageList.length<=0){
             throw "不可以为空"
         }else{
+            this.stopMusic()
             this.mGameManager.loadScene(this.mPageList,data.type)
             for (let index = 0; index < data.page_list.length; index++) {
                 const element = data.page_list[index];

+ 7 - 2
assets/script/run/scene_layer.ts

@@ -71,7 +71,7 @@ export class scene_layer extends Component {
 
     addAudioItemAndPlay(res:string, volume:number,isLopp:boolean = false){
         // let content = this.getCurScenePage().node;
-        let content = this.node;
+        let content = this.content;
         let audio_node = this.mAudioList.get(res)
         if(audio_node==null){
             audio_node = new Node
@@ -111,7 +111,12 @@ export class scene_layer extends Component {
     onChangeUpdatePages(){
         for (let index = 0; index < this.content.children.length; index++) {
             const page = this.content.children[index];
-            page.active = (this.mCurPage == index)
+            if(page.getComponent(AudioSource)!=null){
+
+            }else{
+                page.active = (this.mCurPage == index)
+            }
+          
         }
     }
 

+ 1 - 0
assets/script/run/top_layer.ts

@@ -115,6 +115,7 @@ export class top_layer extends Component {
     }
 
     onClickReStart(){
+        this.fail.active = false
         gameManager.Singleton.reStartGame()
     }
     addQuestionSelect(data:widget_item_data,event_data:event_item_show_question_select){