Procházet zdrojové kódy

[FC]:优化DeviceUtil、优化幸运和过关红包显示优先逻辑、暂停界面音乐开关功能

fengcong před 5 roky
rodič
revize
0463510ee1

+ 2 - 2
assets/resources/game/prefab/uiPanel/PauseUI.prefab

@@ -900,7 +900,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 300,
+      "width": 320,
       "height": 70
     },
     "_anchorPoint": {
@@ -1302,7 +1302,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 300,
+      "width": 320,
       "height": 70
     },
     "_anchorPoint": {

+ 3 - 3
assets/script/before/GamePlay.ts

@@ -453,7 +453,7 @@ export default class GamePlay extends cc.Component {
         this.curPropType = PROPTYPE.Reset;
 
         let resetPropNum = gData.gameData.getProp(GameProp.resetPropNum);
-        if (resetPropNum) {
+        if (!resetPropNum || resetPropNum <= 0) {
             mk.ui.openPanel("game/prefab/uiPanel/GetPropUI");
             return;
         }
@@ -492,7 +492,7 @@ export default class GamePlay extends cc.Component {
         this.curPropType = PROPTYPE.Hammer;
 
         let hammerPropNum = gData.gameData.getProp(GameProp.hammerPropNum);
-        if (hammerPropNum<= 0) {
+        if (!hammerPropNum || hammerPropNum <= 0) {
             mk.ui.openPanel("game/prefab/uiPanel/GetPropUI");
             return;
         }
@@ -510,7 +510,7 @@ export default class GamePlay extends cc.Component {
 
         this.curPropType = PROPTYPE.Change;
         let changePropNum = gData.gameData.getProp(GameProp.changePropNum);
-        if (changePropNum <= 0) {
+        if (!changePropNum || changePropNum <= 0) {
             mk.ui.openPanel("game/prefab/uiPanel/GetPropUI");
             return;
         }

+ 9 - 12
assets/script/before/view/PauseUI.ts

@@ -72,16 +72,13 @@ export default class PauseUI extends cc.Component {
 
     //初始化
     initMsuicSwitchState() {
-        // this.node_music_on.active = AudioMgr.Inst.getSwitchMusic();
-        // this.node_music_off.active = !this.node_music_on.active
-
-
+        this.node_music_on.active = mk.audio.getSwitchMusic();
+        this.node_music_off.active = !this.node_music_on.active
     }
 
     initEffectSwitchState() {
-        mk.console.log("初始化开关!!!!!!!!!!!!!!!")
-        // this.node_effect_on.active = AudioMgr.Inst.getSwitchEffect();
-        // this.node_effect_off.active = !this.node_effect_on.active;
+        this.node_effect_on.active = mk.audio.getSwitchEffect();
+        this.node_effect_off.active = !this.node_effect_on.active;
     }
 
     initEvent() {
@@ -122,13 +119,13 @@ export default class PauseUI extends cc.Component {
     }
 
     onClickMusicSwitch() {
-        // AudioMgr.Inst.turnSwitchMusic();
-        // this.initMsuicSwitchState();
+        mk.audio.switchMusicFunc();
+        this.initMsuicSwitchState();
     }
 
     onClickEffectSwitch() {
-        // AudioMgr.Inst.turnSwitchEffect();
-        // this.initEffectSwitchState();
+        mk.audio.switchEffectFunc();
+        this.initEffectSwitchState();
     }
 
     onClickRestartBtn() {
@@ -139,7 +136,7 @@ export default class PauseUI extends cc.Component {
 
     onClickExitBtn() {
         GameMgr.Inst.sendEvent(UI_NAME.PauseUI, "点击退出按钮");
-  
+
         mk.ui.closePanel("PauseUI")
         GamePlay.Inst.restart(false);//退出不扣体力
         GamePlay.Inst.node.active = false;

+ 2 - 2
assets/script/before/view/uiItem/CellItem.ts

@@ -100,7 +100,7 @@ export default class CellItem extends cc.Component {
                 //现在(配置就对照游戏真实的布局)
                 type = GameConst.config_level[level][this.y][this.x];
             }
-          
+
             if (type) {
                 this.type = type;
             }
@@ -356,7 +356,7 @@ export default class CellItem extends cc.Component {
                 node_scoreEnergy.getComponent(ScoreEnergy).init(x, y, score);
                 GamePlay.Inst.node_effectUI.addChild(node_scoreEnergy);
 
-                if (this.spr_redPackIcon.node.active) {
+                if (this.spr_redPackIcon.node.active && GamePlay.Inst.finalGetScore < GamePlay.Inst.targetScore) {
                     mk.ui.openPanel("module/reward/rewardLuck");
                 }
             }

+ 1 - 1
assets/script/before/view/uiItem/SelectCellItemBtn.ts

@@ -25,7 +25,7 @@ export default class SelectCellItemBtn extends cc.Component {
         this.spr_icon.node.width = 70;
         this.spr_icon.node.height = 70;
 
-        mk.loader.load(`game/texture/${GameConst.iconIndex}/${this.type}`, cc.SpriteFrame).then((spriteFrame) => {
+        mk.loader.load(`game/texture/cellItemIcon/${GameConst.iconIndex}/${this.type}`, cc.SpriteFrame).then((spriteFrame) => {
             this.spr_icon.spriteFrame = spriteFrame;
         })
     }

+ 0 - 2
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/.externalNativeBuild/ndkBuild/release/armeabi-v7a/android_gradle_build_cocos2djs_armeabi-v7a.stdout.txt

@@ -1,4 +1,2 @@
 Android NDK: WARNING: Unsupported source file extensions in D:\Develop\CocosDashboard_1.0.9\resources\.editors\Creator\2.4.5\resources\cocos2d-x/cocos/Android.mk for module cocos2dx_static    
 Android NDK:   ../external/sources/edtaa3func/edtaa3func.h renderer/memop/RecyclePool.hpp    
-[armeabi-v7a] Compile++ arm  : cocos2djs <= AppDelegate.cpp
-[armeabi-v7a] SharedLibrary  : libcocos2djs.so

+ 40 - 3
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/util/DeviceUtil.java

@@ -17,6 +17,9 @@ import org.cocos2dx.javascript.thirdSdk.oaid.OaidHelper;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
+import java.net.NetworkInterface;
+import java.util.Collections;
+import java.util.List;
 
 public class DeviceUtil {
 
@@ -99,14 +102,18 @@ public class DeviceUtil {
         } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
             Log.e("=====", "7.0以上");
             strMac = getMac();
+            Log.e("=====",Build.VERSION.SDK_INT +"");
+            Log.e("=====",strMac);
+            String  strMac1= getNewMac();
+            Log.e("=====",strMac1);
             return strMac;
         }
         return "02:00:00:00:00:00";
     }
 
     /**
-     * 这是使用adb shell命令来获取mac地址的方式
-     *
+     * 这是使用adb shell命令来获取mac地址的方式(可获取7.0以上 亲测)
+     * @description
      * @return
      */
     public static String getMac() {
@@ -141,7 +148,6 @@ public class DeviceUtil {
 
     /**
      * 根据wifi信息获取本地mac
-     *
      * @param context
      * @return
      */
@@ -160,6 +166,37 @@ public class DeviceUtil {
     }
 
     /**
+     * 通过网络接口取 (7.0以上可用 亲测)(暂时不用)
+     * @return
+     */
+    private static String getNewMac() {
+        try {
+            List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
+            for (NetworkInterface nif : all) {
+                if (!nif.getName().equalsIgnoreCase("wlan0")) continue;
+
+                byte[] macBytes = nif.getHardwareAddress();
+                if (macBytes == null) {
+                    return null;
+                }
+
+                StringBuilder res1 = new StringBuilder();
+                for (byte b : macBytes) {
+                    res1.append(String.format("%02X:", b));
+                }
+
+                if (res1.length() > 0) {
+                    res1.deleteCharAt(res1.length() - 1);
+                }
+                return res1.toString();
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
      * 获取当前手机系统版本号
      *
      * @return 系统版本号