@ives_xxz/framework 1.1.3 → 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) {
@@ -206,22 +210,25 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
206
210
  convertDownloadedBytes: convertDownloadedBytes,
207
211
  convertTotalBytes: convertTotalBytes,
208
212
  });
209
- FWLog.debug('热更新中结果 failed -> ', failed);
210
213
  if (failed) {
214
+ FWLog.debug('热更新中结果 failed -> ', failed);
211
215
  FWLog.debug('下载失败');
212
216
  this.assetMgr.setEventCallback(null!);
213
217
  this.isUpdate = false;
214
218
  this.retry();
215
219
  }
216
- FWLog.debug('热更新中结果 needRestart -> ', needRestart);
217
220
  if (needRestart) {
221
+ FWLog.debug('热更新中结果 needRestart -> ', needRestart);
218
222
  FWLog.debug('下载完成');
219
223
  this.assetMgr.setEventCallback(null!);
224
+ this.assetMgr = null;
225
+ this.isRetry = false;
226
+ this.isUpdate = false;
220
227
  var searchPaths = jsb.fileUtils.getSearchPaths();
221
228
  var newPaths = this.assetMgr.getLocalManifest().getSearchPaths();
222
229
  Array.prototype.unshift.apply(searchPaths, newPaths);
223
230
  jsb.fileUtils.setSearchPaths(searchPaths);
224
- this.listener.completedHandle?.();
231
+ this.listener.completedHandle?.(this.newVersion);
225
232
  }
226
233
  }
227
234
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ives_xxz/framework",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "cocoscreator 2.x mvc framework",
5
5
  "main": "index.js",
6
6
  "keywords": [