xx 1 年之前
父節點
當前提交
c9c2db93dd
共有 1 個文件被更改,包括 11 次插入9 次删除
  1. 11 9
      assets/script/run/ui/sound_text_content.ts

+ 11 - 9
assets/script/run/ui/sound_text_content.ts

@@ -25,6 +25,7 @@ export class sound_text_content extends Component {
         return this.mData.is_open_click_close;
     }
     public show(widget_id,data:att_text_sound_data,ac:AudioClip){
+
         this.node.on(Node.EventType.TOUCH_START,()=>{
             if(this.isCanClose()){
                 this.node.off(Node.EventType.TOUCH_START)
@@ -36,14 +37,7 @@ export class sound_text_content extends Component {
         this.m_audio_clip = ac;
         this.lab_text.getComponent(Label).string = this.mData.text;
         this.item_node.position = new Vec3(this.item_node.position.x,this.mData.pos_y)
-        if(gameManager.Singleton.getLevelData()){
-            if(gameManager.getUserData().isOpenPeiYin){
-                this.onPlaySound()
-            }
-        }else{
-            this.onPlaySound()
-        }
-   
+        this.onPlaySound()
     }
 
     getAudioSource(){
@@ -64,7 +58,15 @@ export class sound_text_content extends Component {
         if (this.m_audio_clip instanceof AudioClip) {
             this.getAudioSource().clip = this.m_audio_clip;
             this.getAudioSource().play();
-            this.getAudioSource().volume = 1;
+            let volume = 1;
+            if(gameManager.Singleton.getLevelData()){
+                if(gameManager.getUserData().isOpenPeiYin){
+                    volume = 1;
+                }else{
+                    volume = 0;
+                }
+            }
+            this.getAudioSource().volume = volume;
         }
 
     }