Wednesday, June 15, 2022
HomeGame DevelopmentBundles are nonetheless loading after progress bar is completes - Cocos Creator

Bundles are nonetheless loading after progress bar is completes – Cocos Creator


Hello ,
I can see the load bundles logs after the progress bar is accomplished and web page is loaded the sport scene

Looking for assistance on above talked about level.


It’s attainable that the logs are printed with a lag, are you able to present the small print?

Hello Linrm,
Thanks in your response!

So what occurs , bundles are loaded earlier than progress , we reached to foyer , we transfer to sport scene and we scene bundles are loading once more

Is bundles are loaded based on scene?

If sure can’t we forcefully obtain all bundles collectively after which full the progress!

Attaching logs in your reference…

Additionally It could be useful for those who can let me know tips on how to contact your V.I.P tech help

Hello good friend, thanks for supporting cocos. If you wish to get V.I.P tech help, please contact this e-mail yaqiong.liu@cocos.com and tell us some details about you, thanks.

Which model of creator are you utilizing? Might you present your code of load bundle and progress bar?

I’m utilizing 2.4.7 model of creator

And we’re simply creating construct by selecting internet construct on construct kind
And Please verify the beneath code connected for the code you requested

window.boot = perform () {
var settings = window._CCSettings;
window._CCSettings = undefined;
var onProgress = null;

var RESOURCES = cc.AssetManager.BuiltinBundleName.RESOURCES;
var INTERNAL = cc.AssetManager.BuiltinBundleName.INTERNAL;
var MAIN = cc.AssetManager.BuiltinBundleName.MAIN;
perform setLoadingDisplay () {
    // Loading splash scene
    var splash = doc.getElementById('splash');
    var progressBar = splash.querySelector('.progress-bar span');
    onProgress = perform (end, complete) {
        var p.c = 100 * end / complete;
        if (progressBar) {
            progressBar.fashion.width = p.c.toFixed(2) + '%';
        }
    };
    splash.fashion.show = 'block';
    progressBar.fashion.width="0%";

    cc.director.as soon as(cc.Director.EVENT_AFTER_SCENE_LAUNCH, perform () {
        splash.fashion.show = 'none';
    });
}

var onStart = perform () {

    cc.view.enableRetina(true);
    cc.view.resizeWithBrowserSize(true);

    if (cc.sys.isBrowser) {
        setLoadingDisplay();
    }

    if (cc.sys.isMobile) {
        if (settings.orientation === 'panorama') {
            cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
        }
        else if (settings.orientation === 'portrait') {
            cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
        }
        cc.view.enableAutoFullScreen([
            cc.sys.BROWSER_TYPE_BAIDU,
            cc.sys.BROWSER_TYPE_BAIDU_APP,
            cc.sys.BROWSER_TYPE_WECHAT,
            cc.sys.BROWSER_TYPE_MOBILE_QQ,
            cc.sys.BROWSER_TYPE_MIUI,
            cc.sys.BROWSER_TYPE_HUAWEI,
            cc.sys.BROWSER_TYPE_UC,
        ].indexOf(cc.sys.browserType) < 0);
    }

    // Restrict downloading max concurrent job to 2,
    // extra duties concurrently could trigger efficiency draw again on some android system / browsers.
    // You may alter the quantity primarily based by yourself take a look at end result, you need to set it earlier than any loading course of to take impact.
    if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) {
        cc.assetManager.downloader.maxConcurrency = 2;
        cc.assetManager.downloader.maxRequestsPerFrame = 2;
    }

    var launchScene = settings.launchScene;
    var bundle = cc.assetManager.bundles.discover(perform (b) {
        return b.getSceneInfo(launchScene);
    });
    
    bundle.loadScene(launchScene, null, onProgress,
        perform (err, scene) {
            if (!err) {
                cc.director.runSceneImmediate(scene);
                if (cc.sys.isBrowser) {
                    // present canvas
                    var canvas = doc.getElementById('GameCanvas');
                    canvas.fashion.visibility = '';
                    var div = doc.getElementById('GameDiv');
                    if (div) {
                        div.fashion.backgroundImage="";
                    }
                    console.log('Success to load scene: ' + launchScene);
                }
            }
        }
    );

};

var choice = {
    id: 'GameCanvas',
    debugMode: settings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
    showFPS: settings.debug,
    frameRate: 60,
    groupList: settings.groupList,
    collisionMatrix: settings.collisionMatrix,
};

cc.assetManager.init({ 
    bundleVers: settings.bundleVers,
    remoteBundles: settings.remoteBundles,
    server: settings.server
});

var bundleRoot = [INTERNAL];
settings.hasResourcesBundle && bundleRoot.push(RESOURCES);

var depend = 0;
perform cb (err) {
    if (err) return console.error(err.message, err.stack);
    depend++;
    if (depend === bundleRoot.size + 1) {
        cc.assetManager.loadBundle(MAIN, perform (err) {
            if (!err) cc.sport.run(choice, onStart);
        });
    }
}

cc.assetManager.loadScript(settings.jsList.map(perform (x) { return 'src/' + x;}), cb);

for (var i = 0; i < bundleRoot.size; i++) {
    cc.assetManager.loadBundle(bundleRoot[i], cb);
}

};

if (window.jsb) {
var isRuntime = (typeof loadRuntime === ‘perform’);
if (isRuntime) {
require(‘src/settings.07d9b.js’);
require(‘src/cocos2d-runtime.js’);
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require(‘src/physics.js’);
}
require(‘jsb-adapter/engine/index.js’);
}
else {
require(‘src/settings.07d9b.js’);
require(‘src/cocos2d-jsb.js’);
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require(‘src/physics.js’);
}
require(‘jsb-adapter/jsb-engine.js’);
}

cc.macro.CLEANUP_IMAGE_CACHE = true;
window.boot();

}

Do you’ve gotten this selection checked? This feature will trigger the useful resource to load solely after the scene has switched.

No this selection will not be checked.

Are you able to present me a demo? I can’t reproduce your query.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments