Commit 835c0f7c authored by 李维's avatar 李维

修复某些情况下nativeUrl为空导致的异常

parent 3a9d89ca
......@@ -92,10 +92,10 @@ export abstract class middleLayerBase extends cc.Component {
// }
// 如果是心跳请求,并且有token - 判断是否已经登出
if(uri.includes("heart")) {
if(resData.code == 1005) {
if (uri.includes("heart")) {
if (resData.code == 1005) {
// 如果是有Token的情况下 视为已经登录,登出
if(token) {
if (token) {
console.log("您的账号在其他设备上登录,请重新登陆")
this.showTips(`您的账号在其他设备上登录,请重新登陆`);
// 强制隐藏遮罩层
......@@ -280,7 +280,7 @@ export abstract class middleLayerBase extends cc.Component {
*/
gcTimeoutId = null;
runGC() {
if(this.gcTimeoutId) {
if (this.gcTimeoutId) {
this.log(`上次垃圾回收还未执行,重置回收计划时间`)
clearTimeout(this.gcTimeoutId);
this.gcTimeoutId = null;
......@@ -419,13 +419,13 @@ export abstract class middleLayerBase extends cc.Component {
async loadPrefabByBundleName(bundleName: string, prefabPath: string, callback: Function) {
const bundle = cc.assetManager.getBundle(bundleName);
this.showPreloadWaiting();
if(!bundle) {
if (!bundle) {
cc.log(`[F: loadPrefabByBundleName] Bundle: ${bundleName} 不存在尝试远程拉取信息`)
cc.assetManager.loadBundle(bundleName, (err, bundle: cc.AssetManager.Bundle) => {
bundle.load(prefabPath, cc.Prefab, (finish, total, item) => {
this.setLoadingProgressBar(Math.floor(finish / total * 100));
}, async (err, prefab: cc.Prefab) => {
if(err) {
if (err) {
cc.log(`加载Prefab出错. 信息[BundleName: ${bundleName}, PrefabPath: ${prefabPath}]`)
}
callback(err, prefab)
......@@ -437,7 +437,7 @@ export abstract class middleLayerBase extends cc.Component {
bundle.load(prefabPath, cc.Prefab, (finish, total, item) => {
this.setLoadingProgressBar(Math.floor(finish / total * 100));
}, async (err, prefab: cc.Prefab) => {
if(err) {
if (err) {
cc.log(`加载Prefab出错. 信息[BundleName: ${bundleName}, PrefabPath: ${prefabPath}]`)
}
callback(err, prefab)
......@@ -511,10 +511,12 @@ export abstract class middleLayerBase extends cc.Component {
// 释放远程加载的资源
cc.assetManager.assets.forEach(item => {
if (item && item.nativeUrl) {
if (item.nativeUrl.indexOf(`h5template`) == -1 && item.nativeUrl.indexOf(`dist`) == -1 && item.nativeUrl.indexOf(`http`) > -1) {
// console.log("Release: " + item.nativeUrl)
cc.assetManager.releaseAsset(item);
}
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment