Game Configuration
The game.json
file in the Mini Game root directory is used to configure to Mini Games. The file content is a JSON object with the following properties:
Configuration Items
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
deviceOrientation | string | portrait | - | Screen orientation |
showStatusBar | Boolean | false | - | Specifies whether to display the status bar |
subPackages | Object[] | - | - | subPackage structure configuration. |
Valid values of deviceOrientation
Value | Description |
---|---|
portrait | Portrait mode. The screen does not rotate as the phone rotates. |
landscape | Landscape mode. The screen rotates as the phone rotates in the landscape mode. |
subPackages
In some cases, the developer needs to divide a Mini Game into different child packages, and package these child packages into different subpackages while building, so that users can load them as needed.
When building a subpackage project, one or more subpackages will be output. Each subpackaged Mini Game must contain a main package that includes the game startup logic and some common resources and JS scripts required by all subpackages. The sub-packages are divided according to the developer's configuration.
When the Mini Game starts, the main package is downloaded and game.js
in the main package are started by default. You can load the subpackages by calling the bn.loadSubpackage
API.
Supported from SDK ^3.2.0, IDE ^2.9.0 and Native ^2.40.0
Property | Type | Default Value | Required | Description |
---|---|---|---|---|
root | string | ✓ | root of subPackage | |
name | string | alias name |