image cache system

Hello Buddys?

I have a question and it could be ask you guy for help.

When I use cocos creator to create my game,

I usually make a singleton class named “AssetManager”

to preload my game resources.

the code I usually use is here.

    let self = this;
    var folderName = 'Texture';
    cc.loader.loadResDir(folderName, cc.SpriteFrame, function (err, assets, urls) {
        for(var i in assets){
            if(self.assetDic==null){
                self.assetDic = {};
            }
            self.assetDic[urls[i]] = assets[i];
        }
        self.assetLoadFinished(target, callback);
    });

So with this code I can directly use my game asset at any scenes.

I think it is very comfortable but it takes some time to load asset if I build with web-mobile.

I know it takes some time to download my asset from the server, but everytime I revisit my game web-site to play my game I should download again and again.

So I have been looking for some solution to play the game with downloading asset just once, I cant find solution yet.

Shortly, (1) I need to use image cache system and (2) I’d like to preload my asset with my assest manger

Is any Buddy have solution to help me?

I can list helper’s name in my game Credit banner as a helper when I publish my game if you need :laughing:

Cocos Creator handles asset management, afaik. Perhaps we can ask @jare to decide if it works the way you wish. Maybe this might help: https://docs.cocos2d-x.org/creator/manual/en/extension/asset-management.html?h=asset