Ver Fonte

整包更新初版

kaka há 5 anos atrás
pai
commit
c0d6ce4d57

+ 7 - 492
assets/resources/module/forceUpdate/prefab/DownLoadUI.prefab → assets/resources/module/forceUpdate/forceUpdate.prefab

@@ -13,7 +13,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "DownLoadUI",
+    "_name": "forceUpdate",
     "_objFlags": 0,
     "_parent": null,
     "_children": [
@@ -27,11 +27,11 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 81
+        "__id__": 69
       }
     ],
     "_prefab": {
-      "__id__": 82
+      "__id__": 70
     },
     "_opacity": 255,
     "_color": {
@@ -222,15 +222,12 @@
       },
       {
         "__id__": 61
-      },
-      {
-        "__id__": 68
       }
     ],
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 80
+      "__id__": 68
     },
     "_opacity": 255,
     "_color": {
@@ -1940,7 +1937,7 @@
       "ctor": "Float64Array",
       "array": [
         0,
-        -338.631,
+        -360,
         0,
         0,
         0,
@@ -2215,7 +2212,7 @@
       "__id__": 1
     },
     "component": "",
-    "_componentId": "a2e6eJMVO5PS4wd0GqLXUwg",
+    "_componentId": "4cd23/2Uq9EU4w1e97Etnp0",
     "handler": "clickDownLoad",
     "customEventData": ""
   },
@@ -2496,7 +2493,7 @@
       "__id__": 1
     },
     "component": "",
-    "_componentId": "a2e6eJMVO5PS4wd0GqLXUwg",
+    "_componentId": "4cd23/2Uq9EU4w1e97Etnp0",
     "handler": "clickSkip",
     "customEventData": ""
   },
@@ -2512,485 +2509,6 @@
     "sync": false
   },
   {
-    "__type__": "cc.Node",
-    "_name": "skipToggle",
-    "_objFlags": 512,
-    "_parent": {
-      "__id__": 6
-    },
-    "_children": [
-      {
-        "__id__": 69
-      },
-      {
-        "__id__": 72
-      },
-      {
-        "__id__": 75
-      }
-    ],
-    "_active": false,
-    "_components": [
-      {
-        "__id__": 78
-      }
-    ],
-    "_prefab": {
-      "__id__": 79
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 28,
-      "height": 28
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        -84.158,
-        -440.633,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        1
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.Node",
-    "_name": "Background",
-    "_objFlags": 512,
-    "_parent": {
-      "__id__": 68
-    },
-    "_children": [],
-    "_active": true,
-    "_components": [
-      {
-        "__id__": 70
-      }
-    ],
-    "_prefab": {
-      "__id__": 71
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 37,
-      "height": 37
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        0
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.Sprite",
-    "_name": "Background<Sprite>",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 69
-    },
-    "_enabled": true,
-    "_materials": [
-      {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
-      }
-    ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_spriteFrame": null,
-    "_type": 0,
-    "_sizeMode": 1,
-    "_fillType": 0,
-    "_fillCenter": {
-      "__type__": "cc.Vec2",
-      "x": 0,
-      "y": 0
-    },
-    "_fillStart": 0,
-    "_fillRange": 0,
-    "_isTrimmedMode": true,
-    "_atlas": null,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "fd05a3e3-a1f8-41d3-a8aa-5d32136824d1"
-    },
-    "fileId": "59G95Ki6FJ67D8lhT7s+sj",
-    "sync": false
-  },
-  {
-    "__type__": "cc.Node",
-    "_name": "checkmark",
-    "_objFlags": 512,
-    "_parent": {
-      "__id__": 68
-    },
-    "_children": [],
-    "_active": false,
-    "_components": [
-      {
-        "__id__": 73
-      }
-    ],
-    "_prefab": {
-      "__id__": 74
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 38,
-      "height": 37
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0.5,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        0,
-        0,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        1
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.Sprite",
-    "_name": "checkmark<Sprite>",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 72
-    },
-    "_enabled": true,
-    "_materials": [
-      {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
-      }
-    ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_spriteFrame": null,
-    "_type": 0,
-    "_sizeMode": 2,
-    "_fillType": 0,
-    "_fillCenter": {
-      "__type__": "cc.Vec2",
-      "x": 0,
-      "y": 0
-    },
-    "_fillStart": 0,
-    "_fillRange": 0,
-    "_isTrimmedMode": false,
-    "_atlas": null,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "fd05a3e3-a1f8-41d3-a8aa-5d32136824d1"
-    },
-    "fileId": "a905W1ipZDoLxPtVqcdjTc",
-    "sync": false
-  },
-  {
-    "__type__": "cc.Node",
-    "_name": "New Label",
-    "_objFlags": 0,
-    "_parent": {
-      "__id__": 68
-    },
-    "_children": [],
-    "_active": true,
-    "_components": [
-      {
-        "__id__": 76
-      }
-    ],
-    "_prefab": {
-      "__id__": 77
-    },
-    "_opacity": 255,
-    "_color": {
-      "__type__": "cc.Color",
-      "r": 112,
-      "g": 77,
-      "b": 52,
-      "a": 255
-    },
-    "_contentSize": {
-      "__type__": "cc.Size",
-      "width": 160,
-      "height": 50.4
-    },
-    "_anchorPoint": {
-      "__type__": "cc.Vec2",
-      "x": 0,
-      "y": 0.5
-    },
-    "_trs": {
-      "__type__": "TypedArray",
-      "ctor": "Float64Array",
-      "array": [
-        30.842,
-        0,
-        0,
-        0,
-        0,
-        0,
-        1,
-        1,
-        1,
-        1
-      ]
-    },
-    "_eulerAngles": {
-      "__type__": "cc.Vec3",
-      "x": 0,
-      "y": 0,
-      "z": 0
-    },
-    "_skewX": 0,
-    "_skewY": 0,
-    "_is3DNode": false,
-    "_groupIndex": 0,
-    "groupIndex": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.Label",
-    "_name": "New Label<Label>",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 75
-    },
-    "_enabled": true,
-    "_materials": [
-      {
-        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
-      }
-    ],
-    "_srcBlendFactor": 770,
-    "_dstBlendFactor": 771,
-    "_string": "不再提醒",
-    "_N$string": "不再提醒",
-    "_fontSize": 40,
-    "_lineHeight": 40,
-    "_enableWrapText": true,
-    "_N$file": null,
-    "_isSystemFontUsed": true,
-    "_spacingX": 0,
-    "_batchAsBitmap": false,
-    "_styleFlags": 0,
-    "_underlineHeight": 0,
-    "_N$horizontalAlign": 1,
-    "_N$verticalAlign": 1,
-    "_N$fontFamily": "Arial",
-    "_N$overflow": 0,
-    "_N$cacheMode": 0,
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "fd05a3e3-a1f8-41d3-a8aa-5d32136824d1"
-    },
-    "fileId": "92gIMRwJ9NMKhHpYZOcodm",
-    "sync": false
-  },
-  {
-    "__type__": "cc.Toggle",
-    "_name": "",
-    "_objFlags": 0,
-    "node": {
-      "__id__": 68
-    },
-    "_enabled": true,
-    "_normalMaterial": null,
-    "_grayMaterial": null,
-    "duration": 0.1,
-    "zoomScale": 1.2,
-    "clickEvents": [],
-    "_N$interactable": true,
-    "_N$enableAutoGrayEffect": false,
-    "_N$transition": 3,
-    "transition": 3,
-    "_N$normalColor": {
-      "__type__": "cc.Color",
-      "r": 214,
-      "g": 214,
-      "b": 214,
-      "a": 255
-    },
-    "_N$pressedColor": {
-      "__type__": "cc.Color",
-      "r": 211,
-      "g": 211,
-      "b": 211,
-      "a": 255
-    },
-    "pressedColor": {
-      "__type__": "cc.Color",
-      "r": 211,
-      "g": 211,
-      "b": 211,
-      "a": 255
-    },
-    "_N$hoverColor": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "hoverColor": {
-      "__type__": "cc.Color",
-      "r": 255,
-      "g": 255,
-      "b": 255,
-      "a": 255
-    },
-    "_N$disabledColor": {
-      "__type__": "cc.Color",
-      "r": 124,
-      "g": 124,
-      "b": 124,
-      "a": 255
-    },
-    "_N$normalSprite": null,
-    "_N$pressedSprite": null,
-    "pressedSprite": null,
-    "_N$hoverSprite": null,
-    "hoverSprite": null,
-    "_N$disabledSprite": null,
-    "_N$target": {
-      "__id__": 69
-    },
-    "_N$isChecked": false,
-    "toggleGroup": null,
-    "checkMark": {
-      "__id__": 73
-    },
-    "checkEvents": [],
-    "_id": ""
-  },
-  {
-    "__type__": "cc.PrefabInfo",
-    "root": {
-      "__id__": 1
-    },
-    "asset": {
-      "__uuid__": "fd05a3e3-a1f8-41d3-a8aa-5d32136824d1"
-    },
-    "fileId": "305zrJuCJClb2jUKHkHSbc",
-    "sync": false
-  },
-  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1
@@ -3009,9 +2527,6 @@
       "__id__": 1
     },
     "_enabled": true,
-    "skipToggle": {
-      "__id__": 78
-    },
     "labUpdate": {
       "__id__": 29
     },

+ 0 - 0
assets/resources/module/forceUpdate/prefab/DownLoadUI.prefab.meta → assets/resources/module/forceUpdate/forceUpdate.prefab.meta


+ 17 - 1
assets/resources/module/login/login.prefab

@@ -34,10 +34,13 @@
       },
       {
         "__id__": 44
+      },
+      {
+        "__id__": 45
       }
     ],
     "_prefab": {
-      "__id__": 45
+      "__id__": 46
     },
     "_opacity": 255,
     "_color": {
@@ -1606,6 +1609,19 @@
     "_id": ""
   },
   {
+    "__type__": "a9502IxXURFCJkFwG7UFpJ+",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "manifest": {
+      "__uuid__": "a81eb395-718d-4f3b-958c-cb871f7dd5fa"
+    },
+    "_id": ""
+  },
+  {
     "__type__": "cc.PrefabInfo",
     "root": {
       "__id__": 1

+ 14 - 2
assets/script/game/data/AppData.ts

@@ -67,14 +67,17 @@ export class AppData {
         this.androidVersion = arr[10];
 
         this.getDeviceInfoCompelete = true;
-        console.log("===[this.tfChannel",this.tfChannel);
-        console.log("===[this.appVersion",this.appVersion);
+        console.log("===[this.tfChannel", this.tfChannel);
+        console.log("===[this.appVersion", this.appVersion);
     }
 
     public init() {
 
     }
 
+    /** 更新状态 */
+    public updateState: UpdateState = UpdateState.None;
+
     //强更信息--------------------------------------------------------
     /** 需要强制更新 */
     public needForceUpdate;
@@ -86,4 +89,13 @@ export class AppData {
     public updateDes;
     /** 修复信息 */
     public fixDes;
+}
+
+/** 更新状态 */
+export enum UpdateState {
+    None = -1,
+    CheckForce = 0,
+    ForceUpdateFinish = 1,
+    CheckHot = 2,
+    UpdateFinish = 3,
 }

+ 1 - 1
assets/resources/module/forceUpdate/prefab.meta → assets/script/game/module/forceUpdate.meta

@@ -1,6 +1,6 @@
 {
   "ver": "1.1.2",
-  "uuid": "af3aa1a4-a487-4d63-b88f-753c1cae5c16",
+  "uuid": "a6b4a002-6937-4678-a5ed-cf4f1e3b9af2",
   "isBundle": false,
   "bundleName": "",
   "priority": 1,

+ 9 - 40
assets/resources/module/forceUpdate/DownLoadUI.ts → assets/script/game/module/forceUpdate/ForceUpdate.ts

@@ -1,16 +1,13 @@
-
-import Util from "../../../script/before/util/Util";
-import JsbSystem from "../../../script/mk/system/JsbSystem";
-
+import Util from "../../../before/util/Util";
+import JsbSystem from "../../../mk/system/JsbSystem";
+import { UpdateState } from "../../data/AppData";
+import { AUDIO_TYPE } from "../../data/GameData";
 
 /** 最新版本下载 */
 const { ccclass, property } = cc._decorator;
 
 @ccclass
-export default class DownLoadUI extends cc.Component {
-    @property(cc.Toggle)
-    skipToggle: cc.Toggle = null
-
+export default class ForceUpdate extends cc.Component {
     @property(cc.Label)
     labUpdate: cc.Label = null
 
@@ -29,28 +26,14 @@ export default class DownLoadUI extends cc.Component {
     @property(cc.Label)
     labPro: cc.Label = null
 
-    /** 是否显示“不再提醒” */
-    showToggle = false
-
     start() {
         this.setText()
     }
 
-    init(showToggle) {
-        this.skipToggle.node.active = showToggle
-        this.showToggle = showToggle
-        if (!showToggle) {
-            this.btnSure.y = -366
-        }
-    }
-
-
-
     clickDownLoad() {
         mk.audio.playEffect("ef_button_click")
         this.btnSure.active = false
         this.btnCancel.active = false
-        this.skipToggle.node.active = false
 
         this.fileProgress.node.parent.active = true
 
@@ -71,12 +54,7 @@ export default class DownLoadUI extends cc.Component {
                 },
                 (locaPath) => {
                     let str = '下载失败,请检查网络后重试'
-                    // if (cc.director.getScene().name == 'Loader') {
-                    //     cc.find('Canvas').getComponent(Loader).PlayTip(str)
-                    // }
-                    // else {
-                    //     EffectNode.instance.PlayTip(str)
-                    // }
+                    mk.tip.pop(str);
 
                     this.fileProgress.node.parent.active = false
                     this.fileProgress.fillRange = 0
@@ -84,14 +62,11 @@ export default class DownLoadUI extends cc.Component {
 
                     this.btnSure.active = true
                     this.btnCancel.active = true
-                    this.skipToggle.node.active = this.showToggle
-
                 },
                 (bytesReceived, totalBytesReceived, totalBytesExpected) => {
                     let pro = totalBytesReceived / totalBytesExpected
                     this.setPro(pro)
                 })
-
         }
 
     }
@@ -103,15 +78,9 @@ export default class DownLoadUI extends cc.Component {
     }
 
     clickSkip() {
-        // mk.audio.playEffect(AUDIO_TYPE.button)
-        // if (this.skipToggle.isChecked) {
-        //     let installVersion = gData.appData.installVersion
-        //     GameM.globalStorage.setStorage('installVersion' + installVersion, 'skip', 1)
-        // }
-
-        // UiM.Instance.offPanel(PANEL_NAME.DownLoadUI)
-
-        // GameM.commonData.skipUpdate = true
+        mk.audio.playEffect(AUDIO_TYPE.button)
+        mk.ui.closePanel('module/forceUpdate/forceUpdate');
+        gData.appData.updateState = UpdateState.ForceUpdateFinish;
     }
 
     /** 设置文本 */

+ 0 - 0
assets/resources/module/forceUpdate/DownLoadUI.ts.meta → assets/script/game/module/forceUpdate/ForceUpdate.ts.meta


+ 12 - 16
assets/script/game/module/hotUpdate/HotUpdatePanel.ts

@@ -1,5 +1,5 @@
 import HotUpdate, { HotOptions } from "../../../mk/sdk/hot/HotUpdate";
-import Login from "../login/Login";
+import { UpdateState } from "../../data/AppData";
 
 const { ccclass, property } = cc._decorator;
 
@@ -9,19 +9,17 @@ export default class HotUpdatePanel extends cc.Component {
     @property({ displayName: 'project.manifest', type: cc.Asset, })
     manifest: cc.Asset = null;
 
-    @property({ displayName: '版本号', type: cc.Label, })
-    versionLabel: cc.Label = null;
+    // @property({ displayName: '版本号', type: cc.Label, })
+    // versionLabel: cc.Label = null;
 
-    @property({ displayName: '热更新进度条', type: cc.ProgressBar })
-    updateProgress: cc.ProgressBar = null;
+    // @property({ displayName: '热更新进度条', type: cc.ProgressBar })
+    // updateProgress: cc.ProgressBar = null;
 
-    @property({ displayName: '消息提示', type: cc.Label })
-    tipsLabel: cc.Label = null;
+    // @property({ displayName: '消息提示', type: cc.Label })
+    // tipsLabel: cc.Label = null;
 
-    @property({ displayName: '添加节点', type: cc.Node })
-    addNode: cc.Node = null;
-
-    public login:Login = null;
+    // @property({ displayName: '添加节点', type: cc.Node })
+    // addNode: cc.Node = null;
 
     onLoad() {
 
@@ -83,8 +81,8 @@ export default class HotUpdatePanel extends cc.Component {
     checkHotUpdate() {
         if (cc.sys.isNative) {
             if (this.manifest) {
-                this.tipsLabel.string = '正在获取版本...';
-                 HotUpdate.checkUpdate();
+                // this.tipsLabel.string = '正在获取版本...';
+                HotUpdate.checkUpdate();
             }
         } else {
             console.log('web 平台不需要热更新');
@@ -94,8 +92,6 @@ export default class HotUpdatePanel extends cc.Component {
 
     enterGame() {
         console.log('进入游戏成功');
-        // this.updateProgress.node.active = false;
-        // cc.director.loadScene('GameScene');
-        this.login.upda
+        gData.appData.updateState = UpdateState.UpdateFinish;
     }
 }

+ 41 - 35
assets/script/game/module/login/Login.ts

@@ -1,5 +1,7 @@
+import Util from "../../../before/util/Util";
 import JsbSystem from "../../../mk/system/JsbSystem";
 import LoadingBar from "../../component/LoadingBar";
+import { UpdateState } from "../../data/AppData";
 import HotUpdatePanel from "../hotUpdate/HotUpdatePanel";
 
 const { ccclass, property } = cc._decorator;
@@ -18,8 +20,6 @@ export default class Login extends cc.Component {
     /** 加载进度 */
     private process: number = 0;
 
-    /** 更新状态 */
-    public updateState: UpdateState = 0;
     /** 热更脚本(onLoad应先于Login) */
     public hotUpdatePanel: HotUpdatePanel = null;
 
@@ -32,9 +32,13 @@ export default class Login extends cc.Component {
     }
 
     update() {
-
         //如果更新没有结束,就不进入正常加载流程
-        if (this.updateState != UpdateState.UpdateFinish) {
+        if (gData.appData.updateState == UpdateState.ForceUpdateFinish) {
+            gData.appData.updateState = UpdateState.CheckHot;
+            this.checkHotUpdate();
+        }
+
+        if (gData.appData.updateState != UpdateState.UpdateFinish) {
             return;
         }
 
@@ -82,37 +86,52 @@ export default class Login extends cc.Component {
         JsbSystem.getDeviceInfo();
         //获取强根版本需要sessionkey
         gData.loginData.init();
+        this.checkRemoveLocalHot();
         await this.checkForceUpate();
-        await this.checkHotUpdate();
         mk.audio.init();
     }
 
     //整包更新和新流程--------------------------------------------------------
+    /** 新包覆盖安装后清除热更版本,重启 */
+    checkRemoveLocalHot() {
+        let currentVersion = mk.storage.getStorage('currentVersion');
+        if (currentVersion) {
+            mk.storage.setStorage('currentVersion', gData.appData.appVersion);
+            let compareVer = Util.versionCompareHandle(currentVersion, gData.appData.appVersion)
+            if (compareVer < 0) {
+                // 热更新的储存路径,如果旧版本中有多个,可能需要记录在列表中,全部清理
+                var storagePath = localStorage.getItem('HotUpdateSearchPaths');
+                if (storagePath) {
+                    let storageArr = JSON.parse(storagePath)
+                    let len = storageArr.length - 2
+                    for (var i = 0; i < len; i++) {
+                        let path = storageArr.shift()
+                        jsb.fileUtils.removeDirectory(path);
+                    }
+
+                    cc.sys.localStorage.removeItem('HotUpdateSearchPaths');
+                    jsb.fileUtils.setSearchPaths(storageArr);
+
+                    cc.audioEngine.stopAll();
+                    cc.game.restart();
+                }
+            }
+        }
+    }
+
     /** 检测强制更新 */
     public async checkForceUpate() {
         await this.getForceVersionInfo();
-        console.log("===[Login] checkHotUpdate ", gData.appData.needForceUpdate);
         if (gData.appData.needForceUpdate === 1) {
-            this.updateState = UpdateState.UpdateFinish;
+            mk.ui.openPanel('module/forceUpdate/forceUpdate');
         }
         else {
-
+            await this.checkHotUpdate();
         }
     }
 
     //发送请求整包更新
     public async getForceVersionInfo() {
-
-        console.log("===[Login] getForceVersionInfo发送请求整包更新")
-        mk.console.log("===[Login] getForceVersionInfo", gData.loginData.uin, gData.loginData.sessionKey);
-        // let data: any = {
-        //     "appId": gData.appData.appId,
-        //     'channel': gData.appData.tfChannel,
-        //     'version': gData.appData.appVersion,
-        // }
-        mk.console.log("===[Login] getForceVersionInfo appId", gData.appData.appId);
-        mk.console.log("===[Login] getForceVersionInfo channel", gData.appData.tfChannel);
-        mk.console.log("===[Login] getForceVersionInfo version", gData.appData.appVersion);
         let data: any = {
             "appId": "wxcf31f0e54f7fefda",
             "channel": "1",
@@ -120,33 +139,26 @@ export default class Login extends cc.Component {
         }
 
         let response = await mk.http.sendRequest("getForceVersionInfo", 'POST', JSON.stringify(data), false, false)
-        // mk.console.logSingle("===[Login] getForceVersionInfo response", response);
         gData.appData.needForceUpdate = response.data.isForceUpdate;
         gData.appData.installVersion = response.data.version;
         gData.appData.installUrl = response.data.downloadAddress;
         gData.appData.updateDes = response.data.versionRemark;
         gData.appData.fixDes = response.data.bugRestoreRemark;
-        mk.console.log("===[Login] gData.appData.needForceUpdate", gData.appData.needForceUpdate, response.data.isForceUpdate);
+
+        mk.console.log("===[Login] gData.appData.needForceUpdate", response);
     }
 
     //热更新-----------------------------------------------------------------
     /** 检测热更新 */
     public async checkHotUpdate() {
-
-        //如果是强更则不进行热更判断
-        if (gData.appData.needForceUpdate === 1) {
-            return;
-        }
-
         //热更脚本交互
         this.hotUpdatePanel = this.node.getComponent(HotUpdatePanel);
         if (!this.hotUpdatePanel) {
             console.error("===[login] 登录界面,没有挂载热更脚本");
-            this.updateState = UpdateState.UpdateFinish;
+            gData.appData.updateState = UpdateState.UpdateFinish;
         }
         else {
             console.log("===[login] 登录界面,挂载热更脚本");
-            this.hotUpdatePanel.login = this;
             this.hotUpdatePanel.checkHotUpdate();
         }
     }
@@ -166,9 +178,3 @@ export default class Login extends cc.Component {
     }
 }
 
-/** 更新状态 */
-export enum UpdateState {
-    Check = 0,
-    Updating = 1,
-    UpdateFinish = 2,
-}

+ 74 - 75
assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATJSSDK.js

@@ -3,8 +3,8 @@ var ATAndroidJS = require("./Android/ATAndroidJS");
 var ATiOSJS = require("./iOS/ATiOSJS");
 var isDebugLog = false;
 
-var initPlatformBridge = function() {  
-    if (cc.sys.os === cc.sys.OS_IOS) {           
+var initPlatformBridge = function () {
+    if (cc.sys.os === cc.sys.OS_IOS) {
         return ATiOSJS;
     } else if (cc.sys.os === cc.sys.OS_ANDROID) {
         return ATAndroidJS;
@@ -16,58 +16,58 @@ var platformBridge = initPlatformBridge();
 
 var ATSDK = ATSDK || {
 
-    kATUserLocationUnknown : 0,
-    kATUserLocationInEU : 1,
-    kATUserLocationOutOfEU : 2,
+    kATUserLocationUnknown: 0,
+    kATUserLocationInEU: 1,
+    kATUserLocationOutOfEU: 2,
+
+
+    PERSONALIZED: 0,
+    NONPERSONALIZED: 1,
+    UNKNOWN: 2,
 
 
-    PERSONALIZED : 0,
-    NONPERSONALIZED :1,
-    UNKNOWN : 2,
-    
-    
     //for android and ios
-    OS_VERSION_NAME : "os_vn",
-    OS_VERSION_CODE : "os_vc",
-    APP_PACKAGE_NAME : "package_name",
-    APP_VERSION_NAME : "app_vn",
-    APP_VERSION_CODE : "app_vc",
-
-    BRAND : "brand",
-    MODEL : "model",
-    DEVICE_SCREEN_SIZE : "screen",
-    MNC : "mnc",
-    MCC : "mcc",
-
-    LANGUAGE : "language",
-    TIMEZONE : "timezone",
-    USER_AGENT : "ua",
-    ORIENTATION : "orient",
-    NETWORK_TYPE : "network_type",
+    OS_VERSION_NAME: "os_vn",
+    OS_VERSION_CODE: "os_vc",
+    APP_PACKAGE_NAME: "package_name",
+    APP_VERSION_NAME: "app_vn",
+    APP_VERSION_CODE: "app_vc",
+
+    BRAND: "brand",
+    MODEL: "model",
+    DEVICE_SCREEN_SIZE: "screen",
+    MNC: "mnc",
+    MCC: "mcc",
+
+    LANGUAGE: "language",
+    TIMEZONE: "timezone",
+    USER_AGENT: "ua",
+    ORIENTATION: "orient",
+    NETWORK_TYPE: "network_type",
 
     //for android
-    INSTALLER : "it_src",
-    ANDROID_ID : "android_id",
-    GAID : "gaid",
-    MAC : "mac",
-    IMEI : "imei",
-    OAID : "oaid",
-    
+    INSTALLER: "it_src",
+    ANDROID_ID: "android_id",
+    GAID: "gaid",
+    MAC: "mac",
+    IMEI: "imei",
+    OAID: "oaid",
+
     //for ios
-    IDFA : "idfa",
-    IDFV : "idfv",
+    IDFA: "idfa",
+    IDFV: "idfv",
 
-    ATSDKListener : {
-        userLocationCallback : null,
+    ATSDKListener: {
+        userLocationCallback: null,
 
-        getUserLocationCallback : function(userLocation) {
-            if(undefined != this.userLocationCallback && this.userLocationCallback != null ){
+        getUserLocationCallback: function (userLocation) {
+            if (undefined != this.userLocationCallback && this.userLocationCallback != null) {
                 this.userLocationCallback(userLocation);
             }
         }
     },
-    
-    initSDK : function(appId, appKey) {
+
+    initSDK: function (appId, appKey) {
 
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.initSDK(appId, appKey);
@@ -76,9 +76,9 @@ var ATSDK = ATSDK || {
         }
     },
 
-    initCustomMap : function(customMap) {
+    initCustomMap: function (customMap) {
         if (undefined != platformBridge && platformBridge != null) {
-            if(undefined != customMap && customMap != null) {
+            if (undefined != customMap && customMap != null) {
                 platformBridge.initCustomMap(JSON.stringify(customMap));
             }
         } else {
@@ -86,17 +86,17 @@ var ATSDK = ATSDK || {
         }
     },
 
-    setPlacementCustomMap : function(placmentId, customMap) {
+    setPlacementCustomMap: function (placmentId, customMap) {
         if (undefined != platformBridge && platformBridge != null) {
-            if(undefined != customMap && customMap != null) {
-                 platformBridge.setPlacementCustomMap(placmentId, JSON.stringify(customMap));
+            if (undefined != customMap && customMap != null) {
+                platformBridge.setPlacementCustomMap(placmentId, JSON.stringify(customMap));
             }
         } else {
             cc.log("You must run on Android or iOS.");
         }
     },
 
-    setGDPRLevel : function(level) {
+    setGDPRLevel: function (level) {
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.setGDPRLevel(level);
         } else {
@@ -104,7 +104,7 @@ var ATSDK = ATSDK || {
         }
     },
 
-    getGDPRLevel : function() {
+    getGDPRLevel: function () {
         if (undefined != platformBridge && platformBridge != null) {
             return platformBridge.getGDPRLevel();
         } else {
@@ -113,7 +113,7 @@ var ATSDK = ATSDK || {
         return this.UNKNOWN;
     },
 
-    getUserLocation : function(userLocationCallback) {
+    getUserLocation: function (userLocationCallback) {
         this.ATSDKListener.userLocationCallback = userLocationCallback;
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.getUserLocation(GetUserLocationJsCallback);
@@ -122,7 +122,7 @@ var ATSDK = ATSDK || {
         }
     },
 
-    showGDPRAuth : function () {
+    showGDPRAuth: function () {
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.showGDPRAuth();
         } else {
@@ -130,7 +130,7 @@ var ATSDK = ATSDK || {
         }
     },
 
-    setLogDebug : function (debug) {
+    setLogDebug: function (debug) {
         isDebugLog = debug;
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.setLogDebug(debug);
@@ -139,42 +139,41 @@ var ATSDK = ATSDK || {
         }
     },
 
-    printLog : function(msg) {
-        if (undefined != msg && null != msg && isDebugLog && platformBridge != null ) {
+    printLog: function (msg) {
+        if (undefined != msg && null != msg && isDebugLog && platformBridge != null) {
             if (undefined != platformBridge && platformBridge != null) {
                 platformBridge.printJsLog(msg); 
             } else {
                 cc.log("You must run on Android or iOS.");
             }
-                
         }
     },
 
-    deniedUploadDeviceInfo : function (deniedInfo) {
+    deniedUploadDeviceInfo: function (deniedInfo) {
         if (undefined != platformBridge && platformBridge != null) {
-			
-			if (deniedInfo != null) {
-				var length = deniedInfo.length;
-				var deniedInfoString = "";
-				for (var i = 0; i < length; i++) {
-					var info = deniedInfo[i];
-					if (i == 0) {
-						deniedInfoString = info;
-					} else {
-						deniedInfoString = deniedInfoString + "," + info;
-					}
-				}
-				
-				cc.log("test__" + deniedInfoString)
-				
-				platformBridge.deniedUploadDeviceInfo(deniedInfoString);
-			}
-			
+
+            if (deniedInfo != null) {
+                var length = deniedInfo.length;
+                var deniedInfoString = "";
+                for (var i = 0; i < length; i++) {
+                    var info = deniedInfo[i];
+                    if (i == 0) {
+                        deniedInfoString = info;
+                    } else {
+                        deniedInfoString = deniedInfoString + "," + info;
+                    }
+                }
+
+                cc.log("test__" + deniedInfoString)
+
+                platformBridge.deniedUploadDeviceInfo(deniedInfoString);
+            }
+
         } else {
             cc.log("You must run on Android or iOS.");
         }
     },
-  
+
 };
 
 const GetUserLocationJsCallback = "ATJSSDK.ATSDKListener.getUserLocationCallback";

+ 39 - 39
assets/script/mk/sdk/ad/toppon/AnyThinkAds/ATRewardedVideoJSSDK.js

@@ -1,8 +1,8 @@
 var ATAndroidRewardedVideoJS = require("./Android/ATAndroidRewardedVideoJS");
 var ATiOSRewardedVideoJS = require("./iOS/ATiOSRewardedVideoJS");
 
-var initPlatformBridge = function() {  
-    if (cc.sys.os === cc.sys.OS_IOS) {           
+var initPlatformBridge = function () {
+    if (cc.sys.os === cc.sys.OS_IOS) {
         return ATiOSRewardedVideoJS;
     } else if (cc.sys.os === cc.sys.OS_ANDROID) {
         return ATAndroidRewardedVideoJS;
@@ -16,60 +16,60 @@ var ATRewardedVideoSDK = ATRewardedVideoSDK || {
     userIdKey: "userID",
     userDataKey: "media_ext",
 
-    ATRewardedVideoListener : {
-        developerCallback : null,
+    ATRewardedVideoListener: {
+        developerCallback: null,
 
-        onRewardedVideoAdLoaded : function (placementId) {
+        onRewardedVideoAdLoaded: function (placementId) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdLoaded(" + placementId + ")");
-            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdLoaded != null && undefined != this.developerCallback.onRewardedVideoAdLoaded) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdLoaded != null && undefined != this.developerCallback.onRewardedVideoAdLoaded) {
                 this.developerCallback.onRewardedVideoAdLoaded(placementId);
             }
         },
-        onRewardedVideoAdFailed : function(placementId, errorInfo) {
+        onRewardedVideoAdFailed: function (placementId, errorInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdFailed(" + placementId + ", " + errorInfo + ")");
-          if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdFailed != null && undefined != this.developerCallback.onRewardedVideoAdFailed) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdFailed != null && undefined != this.developerCallback.onRewardedVideoAdFailed) {
                 this.developerCallback.onRewardedVideoAdFailed(placementId, errorInfo);
             }
         },
-        onRewardedVideoAdPlayStart : function(placementId, callbackInfo) {
+        onRewardedVideoAdPlayStart: function (placementId, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayStart(" + placementId + ", " + callbackInfo + ")");
-           if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayStart != null && undefined != this.developerCallback.onRewardedVideoAdPlayStart) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayStart != null && undefined != this.developerCallback.onRewardedVideoAdPlayStart) {
                 this.developerCallback.onRewardedVideoAdPlayStart(placementId, callbackInfo);
             }
         },
-        onRewardedVideoAdPlayEnd : function(placementId, callbackInfo) {
+        onRewardedVideoAdPlayEnd: function (placementId, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayEnd(" + placementId + ", " + callbackInfo + ")");
-            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayEnd != null && undefined != this.developerCallback.onRewardedVideoAdPlayEnd) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayEnd != null && undefined != this.developerCallback.onRewardedVideoAdPlayEnd) {
                 this.developerCallback.onRewardedVideoAdPlayEnd(placementId, callbackInfo);
             }
         },
-        onRewardedVideoAdPlayFailed : function(placementId, errorInfo, callbackInfo) {
+        onRewardedVideoAdPlayFailed: function (placementId, errorInfo, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayFailed(" + placementId + ", " + callbackInfo + ")");
-            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayFailed != null && undefined != this.developerCallback.onRewardedVideoAdPlayFailed) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayFailed != null && undefined != this.developerCallback.onRewardedVideoAdPlayFailed) {
                 this.developerCallback.onRewardedVideoAdPlayFailed(placementId, errorInfo, callbackInfo);
             }
         },
-        onRewardedVideoAdClosed : function(placementId, callbackInfo) {
+        onRewardedVideoAdClosed: function (placementId, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdClosed(" + placementId + ", " + callbackInfo + ")");
-            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdClosed != null && undefined != this.developerCallback.onRewardedVideoAdClosed) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdClosed != null && undefined != this.developerCallback.onRewardedVideoAdClosed) {
                 this.developerCallback.onRewardedVideoAdClosed(placementId, callbackInfo);
             }
         },
-        onRewardedVideoAdPlayClicked : function(placementId, callbackInfo) {
+        onRewardedVideoAdPlayClicked: function (placementId, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayClicked(" + placementId + ", " + callbackInfo + ")");
-            if(this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayClicked != null && undefined != this.developerCallback.onRewardedVideoAdPlayClicked) {
+            if (this.developerCallback != null && this.developerCallback.onRewardedVideoAdPlayClicked != null && undefined != this.developerCallback.onRewardedVideoAdPlayClicked) {
                 this.developerCallback.onRewardedVideoAdPlayClicked(placementId, callbackInfo);
             }
         },
-        onReward : function(placementId, callbackInfo) {
+        onReward: function (placementId, callbackInfo) {
             ATJSSDK.printLog("ATRewardedVideoJSSDK.ATRewardedVideoListener.onReward(" + placementId + ", " + callbackInfo + ")");
-            if(this.developerCallback != null && this.developerCallback.onReward != null && undefined != this.developerCallback.onReward) {
+            if (this.developerCallback != null && this.developerCallback.onReward != null && undefined != this.developerCallback.onReward) {
                 this.developerCallback.onReward(placementId, callbackInfo);
             }
         }
     },
-    
-    loadRewardedVideo : function(placementId, settings={}) {
+
+    loadRewardedVideo: function (placementId, settings = {}) {
 
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.loadRewardedVideo(placementId, JSON.stringify(settings));
@@ -78,16 +78,16 @@ var ATRewardedVideoSDK = ATRewardedVideoSDK || {
         }
     },
 
-    setAdListener : function(listener) {
+    setAdListener: function (listener) {
         var eventJSON = {};
-        eventJSON[LoadedCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdLoaded",
-        eventJSON[LoadFailCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdFailed",
-        eventJSON[PlayStartCallbackKey]=  "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayStart",
-        eventJSON[PlayEndCallbackKey]=  "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayEnd",
-        eventJSON[PlayFailCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayFailed",
-        eventJSON[CloseCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdClosed",
-        eventJSON[ClickCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayClicked",
-        eventJSON[RewardCallbackKey]= "ATRewardedVideoJSSDK.ATRewardedVideoListener.onReward"
+        eventJSON[LoadedCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdLoaded",
+            eventJSON[LoadFailCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdFailed",
+            eventJSON[PlayStartCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayStart",
+            eventJSON[PlayEndCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayEnd",
+            eventJSON[PlayFailCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayFailed",
+            eventJSON[CloseCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdClosed",
+            eventJSON[ClickCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onRewardedVideoAdPlayClicked",
+            eventJSON[RewardCallbackKey] = "ATRewardedVideoJSSDK.ATRewardedVideoListener.onReward"
 
         if (undefined != platformBridge && platformBridge != null) {
             platformBridge.setAdListener(JSON.stringify(eventJSON));
@@ -98,7 +98,7 @@ var ATRewardedVideoSDK = ATRewardedVideoSDK || {
         this.ATRewardedVideoListener.developerCallback = listener;
     },
 
-    hasAdReady : function(placementId) {
+    hasAdReady: function (placementId) {
         if (undefined != platformBridge && platformBridge != null) {
             return platformBridge.hasAdReady(placementId);
         } else {
@@ -107,7 +107,7 @@ var ATRewardedVideoSDK = ATRewardedVideoSDK || {
         return false;
     },
 
-    checkAdStatus : function(placementId) {
+    checkAdStatus: function (placementId) {
         if (undefined != platformBridge && platformBridge != null) {
             return platformBridge.checkAdStatus(placementId);
         } else {
@@ -116,22 +116,22 @@ var ATRewardedVideoSDK = ATRewardedVideoSDK || {
         return "";
     },
 
-    showAd : function(placementId) {
+    showAd: function (placementId) {
         if (undefined != platformBridge && platformBridge != null) {
-           platformBridge.showAd(placementId);
+            platformBridge.showAd(placementId);
         } else {
             cc.log("You must run on Android or iOS.");
         }
     },
 
-    showAdInScenario : function(placementId, scenario="") {
+    showAdInScenario: function (placementId, scenario = "") {
         if (undefined != platformBridge && platformBridge != null) {
-           platformBridge.showAdInScenario(placementId, scenario);
+            platformBridge.showAdInScenario(placementId, scenario);
         } else {
             cc.log("You must run on Android or iOS.");
         }
-    } 
-  
+    }
+
 };
 
 const LoadedCallbackKey = "RewardedVideoLoaded";

+ 1 - 0
assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATSDKMgr.ts

@@ -33,6 +33,7 @@ export default class ATSDKMgr extends zgSingleton implements IADSDKMgr {
 
         this.getAdvertiseChannel();
 
+        window['ATJSSDK'].setLogDebug(true);
         cc["ATSDKMgrJS"].proxy = this;
         cc["ATSDKMgrJS"].initATJSSDK(ATSDKMgr.topon_android_appId, ATSDKMgr.topon_android_appSecret);