[mod] 熱更新調整

This commit is contained in:
2022-09-04 13:13:06 +08:00
parent 3846fa7844
commit 5fb9bad702
7 changed files with 77 additions and 11 deletions

View File

@@ -30,6 +30,7 @@ export default class HUDM extends cc.Component {
private _updating: boolean = false;
private _canRetry: boolean = false;
private _isChangeUrl: boolean = false;
private _isNewBundle: boolean = false;
private _path: string = "Bundle";
private _customManifest: string = "";
private _storagePath: string = "";
@@ -46,6 +47,7 @@ export default class HUDM extends cc.Component {
}
HUDM._instance = this;
this._updatePanel = params[0];
this._isNewBundle = params[1];
// let packageUrl: string = `https://jianmiau.tk/Resources/App/JMKA/update/remote-assets/${BusinessTypeSetting.COMPILE_VERSION}`;
let packageUrl: string = BusinessTypeSetting.UsePatch;
@@ -201,7 +203,7 @@ export default class HUDM extends cc.Component {
while (this._needUpdateData === null) {
yield null;
}
if (this._isChangeUrl && ((!this._needUpdateData.IsNeedUpdate && this._needUpdateData.TotalBytes !== "failed") || this._needUpdateData.TotalBytes === "0 B")) {
if ((this._isChangeUrl || this._isNewBundle) && ((!this._needUpdateData.IsNeedUpdate && this._needUpdateData.TotalBytes !== "failed") || this._needUpdateData.TotalBytes === "0 B")) {
if (jsb.fileUtils.isFileExist(this._storagePath)) {
let isremoveDirectory: boolean = jsb.fileUtils.removeDirectory(this._storagePath);
let isremoveDirectory_temp: boolean = jsb.fileUtils.removeDirectory(this._storagePath + "_temp");