@ives_xxz/framework 1.0.7 → 1.0.8
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
|
@@ -748,12 +748,17 @@ declare namespace FW {
|
|
|
748
748
|
* @param assetProperty
|
|
749
749
|
*/
|
|
750
750
|
hasAsset(assetProperty: AssetProperty): boolean;
|
|
751
|
+
/**
|
|
752
|
+
* 初始化远程包配置
|
|
753
|
+
* @param config
|
|
754
|
+
*/
|
|
755
|
+
initializeRemoteBundleConfig(config: RemoteBundleConfig): void;
|
|
751
756
|
};
|
|
752
757
|
|
|
753
758
|
type RemoteBundleConfig = {
|
|
754
759
|
bundleName: string;
|
|
755
760
|
url: string;
|
|
756
|
-
|
|
761
|
+
version: string;
|
|
757
762
|
};
|
|
758
763
|
|
|
759
764
|
type BundleManager = {
|
|
@@ -38,10 +38,9 @@ export class FWBundleManager extends FWManager implements FW.BundleManager {
|
|
|
38
38
|
const remote = this.remoteBundleConfigMap.get(bundleName);
|
|
39
39
|
const url = remote ? remote.url : '';
|
|
40
40
|
const path = `${url}${bundleName}`;
|
|
41
|
-
|
|
42
41
|
cc.assetManager.loadBundle(
|
|
43
42
|
path,
|
|
44
|
-
{ version: this.remoteBundleConfigMap.get(bundleName) || '' },
|
|
43
|
+
{ version: this.remoteBundleConfigMap.get(bundleName)?.version || '' },
|
|
45
44
|
(err: Error, bundle: cc.AssetManager.Bundle) => {
|
|
46
45
|
if (err || !bundle) {
|
|
47
46
|
FWLog.error(`"加载bundle失败:"${bundleName}!`);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import FWLog from '../log/FWLog';
|
|
2
2
|
import { FWManager } from './FWManager';
|
|
3
3
|
|
|
4
|
+
const TEMOTE_ASSET = 'remote-asset';
|
|
5
|
+
|
|
4
6
|
export default class FWHotUpdateManager extends FWManager implements FW.HotUpdateManager {
|
|
5
7
|
private listener: FW.HotUpdateListener;
|
|
6
8
|
private assetMgr: any;
|
|
@@ -19,6 +21,7 @@ export default class FWHotUpdateManager extends FWManager implements FW.HotUpdat
|
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
this.localManifest = localManifest;
|
|
24
|
+
this.storePath = `${jsb.fileUtils ? jsb.fileUtils.getWritablePath() : '/'}${TEMOTE_ASSET}`;
|
|
22
25
|
this.assetMgr = new jsb.AssetsManager('', this.storePath, this.versionCompareHandle);
|
|
23
26
|
this.assetMgr.setVerifyCallback(function (path: string, asset: any) {
|
|
24
27
|
const compressed = asset.compressed;
|
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
60
60
|
this.messageEvents = cc.js.createMap();
|
|
61
61
|
this.protocolContainer = new Map<Symbol, string>();
|
|
62
62
|
this.protocolRegistry = new Map<string, Set<Symbol>>();
|
|
63
|
+
this.reconnectTimes = 0;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
createSocket(
|
|
@@ -80,7 +81,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
80
81
|
this.isReconnect = true;
|
|
81
82
|
this.sendHeartTimestamp = 0;
|
|
82
83
|
this.receiveTimeStamp = new Date().getTime();
|
|
83
|
-
|
|
84
|
+
FWLog.debug('创建socket -> ', address);
|
|
84
85
|
this.socket = new WebSocket(address);
|
|
85
86
|
this.socket.onopen = this.onSocketOpen.bind(this);
|
|
86
87
|
this.socket.onclose = this.onSocketClose.bind(this);
|
|
@@ -248,6 +249,7 @@ export default class FWSocket implements FW.Socket {
|
|
|
248
249
|
|
|
249
250
|
/** socket关闭 */
|
|
250
251
|
private onSocketClose() {
|
|
252
|
+
FWLog.debug('on close!');
|
|
251
253
|
this.handle?.onClose?.();
|
|
252
254
|
FW.Entry.timeMgr.scheduleOnce(
|
|
253
255
|
() => {
|