Sfoglia il codice sorgente

修复调用jsb带返回值时值为undefined问题
互推修复

kaka 5 anni fa
parent
commit
0aff037fb4

+ 4 - 18
assets/resources/module/forceUpdate/prefab/DownLoadUI.prefab

@@ -27,11 +27,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 82
+        "__id__": 81
       }
     ],
     "_prefab": {
-      "__id__": 83
+      "__id__": 82
     },
     "_opacity": 255,
     "_color": {
@@ -228,13 +228,9 @@
       }
     ],
     "_active": true,
-    "_components": [
-      {
-        "__id__": 80
-      }
-    ],
+    "_components": [],
     "_prefab": {
-      "__id__": 81
+      "__id__": 80
     },
     "_opacity": 255,
     "_color": {
@@ -2995,16 +2991,6 @@
     "sync": false
   },
   {
-    "__type__": "c303cMObORMP73Of1/g1ZVg",
-    "_name": "",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 6
-    },
-    "_enabled": true,
-    "_id": ""
-  },
-  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1

+ 7 - 5
assets/script/game/module/moreGame/MoreGameNormalItem.ts

@@ -30,7 +30,6 @@ export default class MoreGameNormalItem extends cc.Component {
     @property(cc.Node)
     spRed: cc.Node = null;
 
-    private bData = null;
     private data = null
 
     /**
@@ -42,8 +41,11 @@ export default class MoreGameNormalItem extends cc.Component {
             return;
         }
 
-        this.bData = bData;
-        this.data = bData.item_data;
+        this.setInfo(bData.item_data)
+    }
+
+    setInfo(data) {
+        this.data = data;
         cc.loader.load(this.data.icon, (err, res) => {
             if (err) {
                 console.log('err:', err);
@@ -129,10 +131,10 @@ export default class MoreGameNormalItem extends cc.Component {
                 // LogUtil.logV("showDownloadProgress", "three")
                 this.progressLabel.string = ((info.progress / info.totalBytesReceives) * 100).toFixed(1) + "%"
             } else {
-                this.setItemData(this.bData)
+                this.setInfo(this.data)
             }
         } else {
-            this.setItemData(this.bData)
+            this.setInfo(this.data)
         }
     }
 }

+ 4 - 4
assets/script/mk/system/JsbSystem.ts

@@ -1,5 +1,3 @@
-import { StorageKey } from "../../game/data/StorageData";
-
 /**
  * Jsb管理类(与安卓Java类或者IOS交互)
  * @description
@@ -43,7 +41,8 @@ export default class JsbSystem {
      * @param parameters      参数:是java方法需要传入的参数(可以多个,与methodSignature中()内的数量和类型一一对应)
      */
     public static callStaticMethod(path: string, methodName: string, methodSignature: string, ...parameters: any): any {
-        jsb.reflection.callStaticMethod(path, methodName, methodSignature, ...parameters);
+        let value = jsb.reflection.callStaticMethod(path, methodName, methodSignature, ...parameters);
+        return value;
     }
 
     /**
@@ -243,10 +242,11 @@ export default class JsbSystem {
      * @param start       如存在是否启动
      * @returns ifCan         
      */
-    static ifCanStartGame(packageName: string, start: boolean): boolean {
+    public static ifCanStartGame(packageName: string, start: boolean): boolean {
         let isCan = false;
         if (cc.sys.os == cc.sys.OS_ANDROID) {
             isCan = this.callStaticMethod(this._JSB_ANDROID_PATH, "isStartGame", "(Ljava/lang/String;Z)Z", packageName, start);
+            return isCan;
         }
         else if (cc.sys.os == cc.sys.OS_IOS) {
             isCan = this.callStaticMethod("GameConfig", "installApk:", "");

BIN
build/jsb-link/frameworks/runtime-src/proj.android-studio/.idea/caches/build_file_checksums.ser


BIN
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/release/EasyEliminate-release.apk


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

@@ -250,10 +250,10 @@ public class AppActivity extends Cocos2dxActivity {
 
     public boolean checkStartApp(String pkg, boolean start){
         PackageManager packageManager = getPackageManager();
-        Intent intent=new Intent();
+        Intent intent = new Intent();
         intent.setPackage(null); // 加上这句代码
-        intent =packageManager.getLaunchIntentForPackage(pkg);
-        if(intent==null){
+        intent = packageManager.getLaunchIntentForPackage(pkg);
+        if(intent == null){
             return false;
         }else{
             if(start){

+ 3 - 3
build/jsb-link/frameworks/runtime-src/proj.android-studio/app/src/org/cocos2dx/javascript/thirdSdk/ThirdSdkMgr.java

@@ -126,12 +126,12 @@ public class ThirdSdkMgr {
     //安装apk相关 ----------------------------------------------------------------------------------
     /** 安装apk*/
     public static void installApk(String fileName){
-        appActivity.installApk(fileName);
+        ThirdSdkMgr.appActivity.installApk(fileName);
     }
 
     /** 启动apk*/
-    public static boolean isStartGame(String pkg,boolean start){
-        boolean isExist =  appActivity.checkStartApp(pkg,start);
+    public static boolean isStartGame(String pkg, boolean start){
+        boolean isExist = ThirdSdkMgr.appActivity.checkStartApp(pkg, start);
         return isExist;
     }
 }

+ 24 - 13
build/jsb-link/js backups (useful for debugging)/main.index.js

@@ -10502,7 +10502,8 @@ return jsb.fileUtils.getWritablePath();
 };
 t.callStaticMethod = function(t, e, n) {
 for (var i, a = [], r = 3; r < arguments.length; r++) a[r - 3] = arguments[r];
-(i = jsb.reflection).callStaticMethod.apply(i, o([ t, e, n ], a));
+var c = (i = jsb.reflection).callStaticMethod.apply(i, o([ t, e, n ], a));
+return c;
 };
 t.backTest = function() {};
 t.updateDeviceInfo = function(t) {
@@ -10571,7 +10572,12 @@ cc.sys.os == cc.sys.OS_ANDROID ? this.callStaticMethod(this._JSB_ANDROID_PATH, "
 };
 t.ifCanStartGame = function(t, e) {
 var n = !1;
-cc.sys.os == cc.sys.OS_ANDROID ? n = this.callStaticMethod(this._JSB_ANDROID_PATH, "isStartGame", "(Ljava/lang/String;Z)Z", t, e) : cc.sys.os == cc.sys.OS_IOS && (n = this.callStaticMethod("GameConfig", "installApk:", ""));
+if (cc.sys.os == cc.sys.OS_ANDROID) {
+n = this.callStaticMethod(this._JSB_ANDROID_PATH, "isStartGame", "(Ljava/lang/String;Z)Z", t, e);
+console.log("aaaaaaaaaaa >>> ", n);
+return n;
+}
+cc.sys.os == cc.sys.OS_IOS && (n = this.callStaticMethod("GameConfig", "installApk:", ""));
 return n;
 };
 t.setTAEventRegister = function() {
@@ -12741,17 +12747,21 @@ e.btnOpen = null;
 e.labName = null;
 e.labDes = null;
 e.spRed = null;
-e.bData = null;
 e.data = null;
 e.cool = !1;
 return e;
 }
 e.prototype.setItemData = function(t) {
 return r(this, void 0, void 0, function() {
-var e = this;
 return c(this, function() {
-this.bData = t;
-this.data = t.item_data;
+this.setInfo(t.item_data);
+return [ 2 ];
+});
+});
+};
+e.prototype.setInfo = function(t) {
+var e = this;
+this.data = t;
 cc.loader.load(this.data.icon, function(t, n) {
 if (t) console.log("err:", t); else if (cc.isValid(e.iconNode)) {
 var o = n;
@@ -12761,7 +12771,10 @@ e.iconNode.spriteFrame = new cc.SpriteFrame(o);
 this.labName.string = this.data.title;
 this.labDes.string = this.data.introduction;
 this.spRed.active = !1;
-if (1 == this.data.appType) if (s.default.ifCanStartGame(this.data.packageName, !1)) {
+if (1 == this.data.appType) {
+console.log("aaaaaa  this.data.packageName  ", this.data.packageName);
+console.log("aaaaaa  ", s.default.ifCanStartGame(this.data.packageName, !1));
+if (s.default.ifCanStartGame(this.data.packageName, !1)) {
 this.btnDown.active = !1;
 this.btnOpen.active = !0;
 } else if (s.default.isFileExist(this.data.nebulaAppId + ".apk")) {
@@ -12773,13 +12786,11 @@ this.btnOpen.active = !1;
 null != gData.moreGame.getTaskInfo(this.data.nebulaAppId) ? this.schedule(function() {
 e.showDownloadProgress();
 }, .5) : this.progressLabel.string = "下载";
+}
 } else if (2 == this.data.appType) {
 this.btnDown.active = !1;
 this.btnOpen.active = !0;
 }
-return [ 2 ];
-});
-});
 };
 e.prototype.creatorDownLoadTask = function() {
 var t = this;
@@ -12796,7 +12807,7 @@ t.showDownloadProgress();
 };
 e.prototype.showDownloadProgress = function() {
 var t = gData.moreGame.getTaskInfo(this.data.nebulaAppId);
-null != t && t.progress >= 0 ? this.progressLabel.string = (t.progress / t.totalBytesReceives * 100).toFixed(1) + "%" : this.setItemData(this.bData);
+null != t && t.progress >= 0 ? this.progressLabel.string = (t.progress / t.totalBytesReceives * 100).toFixed(1) + "%" : this.setInfo(this.data);
 };
 a([ p(cc.Sprite) ], e.prototype, "iconNode", void 0);
 a([ p(cc.Label) ], e.prototype, "progressLabel", void 0);
@@ -13495,7 +13506,7 @@ i(e, t);
 function e() {
 var e = null !== t && t.apply(this, arguments) || this;
 e.init_data = !0;
-e.cash_min_limit = .3;
+e.cash_min_limit = 30;
 return e;
 }
 e.prototype.init = function() {
@@ -13702,7 +13713,7 @@ this.lbl_get_desc.string = "直接提现";
 this.node_tip_anim.active = !1;
 this.anim_btn_cash.play();
 } else {
-gData.gameData.gameData.piggyBank >= gData.pigbank.cash_min_limit ? this.lbl_get_desc.string = "明日可提现" : this.lbl_get_desc.string = "满" + gData.pigbank.cash_min_limit + "元可提";
+gData.gameData.gameData.piggyBank >= gData.pigbank.cash_min_limit ? this.lbl_get_desc.string = "明日可提现" : this.lbl_get_desc.string = "满" + (gData.pigbank.cash_min_limit / 100).toFixed(2) + "元可提";
 this.node_tip_anim.active = !0;
 this.anim_btn_cash.stop();
 this.anim_btn_cash.node.scale = 1;

+ 2 - 2
packages-hot-update/cfg.json

@@ -7,7 +7,7 @@
         "http://",
         "https://xcx-box.oss-cn-hangzhou.aliyuncs.com/hotgame/EasyEliminateTest/baseRemote/"
     ],
-    "buildTime": 1624886217450,
-    "genTime": 1624886217450,
+    "buildTime": 1624931170603,
+    "genTime": 1624931170603,
     "genVersion": null
 }