فهرست منبع

修改音效点击效果

smallqiang 5 سال پیش
والد
کامیت
fd72f5249a

+ 2 - 2
assets/scene/login.fire

@@ -41,8 +41,8 @@
     },
     "_scale": {
       "__type__": "cc.Vec3",
-      "x": 0.36845249250374806,
-      "y": 0.36845249250374806,
+      "x": 0.3658170914542729,
+      "y": 0.3658170914542729,
       "z": 1
     },
     "_quat": {

+ 8 - 1
assets/scripts/game/HomeMoreCtrl.js

@@ -1,4 +1,5 @@
 const AlertManager = require('../utils/AlertManager');
+const GameModule = require("../utils/GameModule");
 
 cc.Class({
     extends: cc.Component,
@@ -13,6 +14,7 @@ cc.Class({
     onLoad () {
         let self = this;
         this.handleShowMore = _.throttle(() => {
+            GameModule.audioMng.playClickButton();
             if (self.showNode.active) {
                 self.showNode.active = false;
                 self.blackMaskNode.active = false;
@@ -24,7 +26,7 @@ cc.Class({
 
         this.handleShowSetting = _.debounce((event) => {
             AlertManager.showGameSetting();
-            self.showOrHideMore();
+            self.hideMore();
         }, 1000, true)
 
         GameEvent.on('show_home_more', this, () => {
@@ -45,6 +47,11 @@ cc.Class({
 
     },
 
+    hideMore() {
+        this.showNode.active = false;
+        this.blackMaskNode.active = false;
+    },
+
     showOrHideMore() {
         this.handleShowMore();
     },

+ 1 - 0
assets/scripts/game/HomeSideCtrl.js

@@ -122,6 +122,7 @@ cc.Class({
     },
 
     hideOrShowMore() {
+        GameModule.audioMng.playClickButton();
         if (this.moreWelfareNode.active) {
             this.moreWelfareNode.active = false;
             this.arrowNode.scaleX = 1;

+ 1 - 0
assets/scripts/utils/AlertManager.js

@@ -343,6 +343,7 @@ class AlertManager {
 
     // 显示音效设置
     static showGameSetting() {
+        GameModule.audioMng.playClickButton();
         DWTool.loadResPrefab("./prefabs/setting/game_setting")
             .then((result) => {
             let alert = cc.instantiate(result);

+ 14 - 3
assets/scripts/utils/AudioMng.js

@@ -79,14 +79,22 @@ cc.Class({
 
         let bgmState = cc.sys.localStorage.getItem("game_bgm_state");
         if (bgmState!= undefined) {
-            this.bgmOpen = bgmState;
+            if (typeof bgmState == "string" && bgmState == "") {
+                this.bgmOpen = true;
+            } else {
+                this.bgmOpen = bgmState;
+            }
         } else {
             this.bgmOpen = true;
         }
 
         let soundEffectState = cc.sys.localStorage.getItem("game_sound_effect_state");
         if (soundEffectState!= undefined) {
-            this.soundEffectOpen = soundEffectState;
+            if (typeof soundEffectState == "string" && soundEffectState == "") {
+                this.soundEffectOpen = true;
+            } else {
+                this.soundEffectOpen = soundEffectState;
+            }
         } else {
             this.soundEffectOpen = true;
         }
@@ -105,7 +113,9 @@ cc.Class({
      * 播放背景音乐
      */
     playBgm () {
-        cc.audioEngine.stop(this.currentAudio['bgm']);
+        if (this.currentAudio.hasOwnProperty('bgm')) {
+            return;
+        }
         if (!this.bgmOpen) { return }
         this.currentAudio['bgm'] = cc.audioEngine.play(this.bgm, true, this.volume);
     },
@@ -122,6 +132,7 @@ cc.Class({
      */
     stopBgm () {
         cc.audioEngine.stop(this.currentAudio['bgm']);
+        delete this.currentAudio['bgm'];
     },
 
     /**