This is a tool to replace the remote atlas/image in the cocos engine.
npm install --save @game-engine/cocos-remote-atlas-util
import RemoteAtlasUtil from '@game-engine/cocos-remote-atlas-util';
const remoteAtlasUtil = new RemoteAtlasUtil();
// set remote atlas image
remoteAtlasUtil.setRemoteUrl(atlasDirName, atlasJsonRemoteUrl, atlasImageRemoteUrl);
// set single remote image
remoteAtlasUtil.setSingleImageUrl(imageRelativePath, remoteUrl);
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.