This is a tool to replace the remote atlas/image in the cocos engine.
npm install --save @game-engine/cocos-remote-atlas-utilimport RemoteAtlasUtil from '@game-engine/cocos-remote-atlas-util';
// set remote atlas image
RemoteAtlasUtil.getInstance().setRemoteUrl(atlasDirName, atlasJsonRemoteUrl, atlasImageRemoteUrl);
// set single remote image
RemoteAtlasUtil.getInstance().setSingleImageUrl(imageRelativePath, remoteUrl);
// check if all admin images have url set.
const { atlas, single } = RemoteAtlasUtil.getInstance().checkAllImageSetUrl();
console.error(`admin images url have not been set: atlas=${atlas.join(',')}; single=${single.join(',')}`)const { createSpriteConfig } = require('@game-engine/cocos-remote-atlas-util/dist/tool');
const path = require('path');
createSpriteConfig({
// the root path of project.
rootPath: path.resolve(__dirname, '../'),
// the textures relative path. [Optional]
texturePath: 'assets/resources/texture',
// the sprite config relative path. [Optional]
spriteConfigPath: 'config/sprite.config.json',
// the folders name do not want replace remote atlas. [Optional]
excludes: ['static']
});- Make sure that set url before you load it!
- All image need to put it into "resources/texture" folder. Or you can change the texturePath parameter.
- If you need to use an atlas, please create a file named "auto-atlas" and don't rename it.