@ives_xxz/framework 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/FW.d.ts CHANGED
@@ -850,7 +850,7 @@ declare namespace FW {
850
850
  versionCompareHandle: (currentVersion: string, newVersion: string) => void;
851
851
  checkHotUpdateHandle: (code: string) => void;
852
852
  hotUpdatingHandle: (code: string, param: HotUpdatingParam) => void;
853
- completedHandle: () => void;
853
+ completedHandle: (version: string) => void;
854
854
  retryHandle: () => void;
855
855
  };
856
856
 
@@ -1469,7 +1469,7 @@ declare namespace FW {
1469
1469
  /**
1470
1470
  * 状态构造类
1471
1471
  */
1472
- stateConstructor: { new (): T };
1472
+ stateConstructor: { new(): T };
1473
1473
  };
1474
1474
 
1475
1475
  type AudioManager = {
@@ -10,6 +10,8 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
10
10
  private isUpdate: boolean;
11
11
  private localManifest: cc.Asset;
12
12
  private isRetry: boolean;
13
+ private currentVersion: string;
14
+ private newVersion: string
13
15
 
14
16
  setListener(listener: FW.HotUpdateListener): void {
15
17
  this.listener = listener;
@@ -41,7 +43,9 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
41
43
 
42
44
  private versionCompareHandle(currentVersion: string, newVersion: string): number {
43
45
  FWLog.debug('版本比较', currentVersion, newVersion);
44
- this.listener.versionCompareHandle(currentVersion, newVersion);
46
+ this.currentVersion = currentVersion;
47
+ this.newVersion = newVersion;
48
+ this.listener.versionCompareHandle(this.currentVersion, this.newVersion);
45
49
  var vA = currentVersion.split('.');
46
50
  var vB = newVersion.split('.');
47
51
  for (var i = 0; i < vA.length; ++i) {
@@ -196,6 +200,7 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
196
200
  }
197
201
 
198
202
  FWLog.debug('热更新中->', str);
203
+ FWLog.debug('热更新msg ->', msg);
199
204
  this.listener.hotUpdatingHandle?.(code, {
200
205
  percent: percent,
201
206
  downloadedFiles: downloadedFiles,
@@ -205,22 +210,25 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
205
210
  convertDownloadedBytes: convertDownloadedBytes,
206
211
  convertTotalBytes: convertTotalBytes,
207
212
  });
208
- FWLog.debug('热更新中结果 failed -> ', failed);
209
213
  if (failed) {
214
+ FWLog.debug('热更新中结果 failed -> ', failed);
210
215
  FWLog.debug('下载失败');
211
216
  this.assetMgr.setEventCallback(null!);
212
217
  this.isUpdate = false;
213
218
  this.retry();
214
219
  }
215
- FWLog.debug('热更新中结果 needRestart -> ', needRestart);
216
220
  if (needRestart) {
221
+ FWLog.debug('热更新中结果 needRestart -> ', needRestart);
217
222
  FWLog.debug('下载完成');
218
223
  this.assetMgr.setEventCallback(null!);
224
+ this.assetMgr = null;
225
+ this.isRetry = false;
226
+ this.isUpdate = false;
219
227
  var searchPaths = jsb.fileUtils.getSearchPaths();
220
228
  var newPaths = this.assetMgr.getLocalManifest().getSearchPaths();
221
229
  Array.prototype.unshift.apply(searchPaths, newPaths);
222
230
  jsb.fileUtils.setSearchPaths(searchPaths);
223
- this.listener.completedHandle?.();
231
+ this.listener.completedHandle?.(this.newVersion);
224
232
  }
225
233
  }
226
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
6
  "keywords": [