@ives_xxz/framework 1.1.3 → 1.1.5
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 +2 -2
- package/manager/FWHotUpdateManager.ts +12 -4
- package/package.json +1 -1
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
|
|
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.
|
|
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,26 @@ 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!);
|
|
220
224
|
var searchPaths = jsb.fileUtils.getSearchPaths();
|
|
221
225
|
var newPaths = this.assetMgr.getLocalManifest().getSearchPaths();
|
|
222
226
|
Array.prototype.unshift.apply(searchPaths, newPaths);
|
|
223
227
|
jsb.fileUtils.setSearchPaths(searchPaths);
|
|
224
|
-
this.
|
|
228
|
+
this.isRetry = false;
|
|
229
|
+
this.isUpdate = false;
|
|
230
|
+
this.assetMgr = null;
|
|
231
|
+
this.listener.completedHandle?.(this.newVersion);
|
|
232
|
+
|
|
225
233
|
}
|
|
226
234
|
}
|
|
227
235
|
|