Preset Cards
Download card resources
Method 1: Download the card file from the console. Click Download bin file to download a .zip file.
Method 2: Package the dist/main.zip file from your local card project.
Name the resource
-
Copy the downloaded file to the resource directory.
-
Rename the downloaded file to the format
Card ID@Card Version, for example,main@1_0_0_0.zip.
NoteIn the future, the console will provide fully named zip packages. You will only need to add them to assets without renaming.
Preset resources
Android
-
Configure the
CubeEngineConfigcard engine class./** * The path to the local resource package that stores the templates. * * @param resourcePath - Sets the resource file path. */ public void setResourcePath(String resourcePath) { this.resourcePath = resourcePath; } -
Set the path to the local Ant Cube Card assets.
// Purge card data. CubeService.instance().destroyEngine(); CubeEngineConfig config = new CubeEngineConfig(); // Set the path. config.setResourcePath("The path where your resources are located"); CubeService.instance().initEngine(config, MainApplication.getApplication()); -
Place the .zip package in the specified path within the assets directory.
iOS
-
Add the downloaded file to the Bundle.
Create a new Bundle file. Compress the downloaded .bin file into a .zip package and name it in the format
Card ID@Card Version, for example,main1@1_0_0_0.zip. The card requires data from a JSON file. You can use a built-in file or dynamically request the data by calling an API.
-
Import the Bundle into the project and pass the Bundle path when initializing the engine.
- (void)initEngine { // The Bundle path for the local resource template. NSString *bundlePath = [NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"MPCubeBundle.bundle"]; CubeEngineConfig *config = [[CubeEngineConfig alloc] init]; [config setBundlePath:bundlePath]; [[CubeService sharedInstance] initWithConfig:config]; }
HarmonyOS
-
Configure the
CubeEngineConfigcard engine class.public setResourcePath(resourcePath: string): CubeEngineConfig public setResourcePaths(resourcePaths:Array<string>):CubeEngineConfig -
Set the path to the local Ant Cube Card rawfile.
let resourcePaths: Array<string> = ["cube"] let config = CubeEngineConfig.obtain() .setResourcePath("mp") .setResourcePaths(resourcePaths) CubeEngine.getInstance().init(config) -
Place the .zip package in the specified path within the rawfile directory.