feat: add flags config (#17848)

* feat: add flags config

* feat: update doc
This commit is contained in:
袁炜海
2024-11-13 17:27:48 +08:00
committed by GitHub
parent 21e6d0c47e
commit c2d429d124
5 changed files with 91 additions and 3 deletions
+27 -3
View File
@@ -103,7 +103,15 @@
"label": "i18n:ENGINE.features.physics_ammo.label", "label": "i18n:ENGINE.features.physics_ammo.label",
"description": "i18n:ENGINE.features.physics_ammo.description", "description": "i18n:ENGINE.features.physics_ammo.description",
"default": true, "default": true,
"isNativeModule": true "isNativeModule": true,
"flags": {
"LOAD_BULLET_MANUALLY": {
"label": "i18n:ENGINE.features.flags.bullet.loadManual.label",
"description": "i18n:ENGINE.features.flags.bullet.loadManual.description",
"default": false,
"ui-type": "checkbox"
}
}
}, },
"physics-cannon": { "physics-cannon": {
"label": "i18n:ENGINE.features.physics_cannon.label", "label": "i18n:ENGINE.features.physics_cannon.label",
@@ -113,7 +121,15 @@
"label": "i18n:ENGINE.features.physics_physx.label", "label": "i18n:ENGINE.features.physics_physx.label",
"cmakeConfig": "USE_PHYSICS_PHYSX", "cmakeConfig": "USE_PHYSICS_PHYSX",
"description": "i18n:ENGINE.features.physics_physx.description", "description": "i18n:ENGINE.features.physics_physx.description",
"isNativeModule": true "isNativeModule": true,
"flags": {
"LOAD_PHYSX_MANUALLY": {
"label": "i18n:ENGINE.features.flags.physx.loadManual.label",
"description": "i18n:ENGINE.features.flags.physx.loadManual.description",
"default": false,
"ui-type": "checkbox"
}
}
}, },
"physics-builtin": { "physics-builtin": {
"label": "i18n:ENGINE.features.physics_builtin.label", "label": "i18n:ENGINE.features.physics_builtin.label",
@@ -293,7 +309,15 @@
"category": "2d", "category": "2d",
"dependencies": [ "dependencies": [
"2d" "2d"
] ],
"flags": {
"LOAD_SPINE_MANUALLY": {
"label": "i18n:ENGINE.features.flags.spine.loadManual.label",
"description": "i18n:ENGINE.features.flags.spine.loadManual.description",
"ui-type": "checkbox",
"default": false
}
}
}, },
"dragon-bones": { "dragon-bones": {
"default": true, "default": true,
+6
View File
@@ -40,6 +40,9 @@
}, },
"required": { "required": {
"type": "boolean" "type": "boolean"
},
"flags": {
"type": "object"
} }
}, },
"type": "object" "type": "object"
@@ -241,6 +244,9 @@
}, },
"required": { "required": {
"type": "boolean" "type": "boolean"
},
"flags": {
"type": "object"
} }
}, },
"type": "object" "type": "object"
+6
View File
@@ -94,6 +94,12 @@ export interface BaseItem {
* @en Whether it is a required module. When adding a new module, the old version will be forced to select this module after the upgrade, otherwise it will not be selected. * @en Whether it is a required module. When adding a new module, the old version will be forced to select this module after the upgrade, otherwise it will not be selected.
*/ */
required?: boolean; required?: boolean;
/**
* @zh 当选择了某个模块时,可以做些附加的配置
* @en When a module is selected, additional configurations can be made
*/
flags: {[k: string]: Pick<BaseItem, 'default' | 'label' | 'description' > & {'ui-type': 'checkbox' | 'select'}}
} }
export interface IFeatureItem extends BaseItem { export interface IFeatureItem extends BaseItem {
+26
View File
@@ -1101,6 +1101,32 @@ module.exports = link(mixin({
label: "WebSocket Server", label: "WebSocket Server",
description: "Enable WebSocket Server for native. Note: WebSocket must also be enabled.", description: "Enable WebSocket Server for native. Note: WebSocket must also be enabled.",
}, },
flags: {
spine: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Spine Wasm/AsmJS moudle manually by 'loadWasmModuleSpine' API ?`,
},
},
box2d: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Box2D Wasm/AsmJS moudle manually by 'loadWasmModuleBox2D' API ?`,
},
},
bullet: {
loadManual: {
label: 'Load Manually',
description: `Whether to load Bullet Wasm/AsmJS moudle manually by 'loadWasmModuleBullet' API ?`,
},
},
physx: {
loadManual: {
label: 'Load Manually',
description: `Whether to load PhysX Wasm/AsmJS moudle manually by 'loadWasmModulePhysX' API ?`,
},
},
},
}, },
renderable_2d: { renderable_2d: {
srcBlendFactor: 'Specifies the source blend mode, <br>it will clone a new material object.', srcBlendFactor: 'Specifies the source blend mode, <br>it will clone a new material object.',
+26
View File
@@ -1079,6 +1079,32 @@ module.exports = link(mixin({
label: "WebSocket Server", label: "WebSocket Server",
description: "对原生启用 WebSocket Server。注意: 必须同时启用 WebSocket。", description: "对原生启用 WebSocket Server。注意: 必须同时启用 WebSocket。",
}, },
flags: {
spine: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleSpine' API 手动加载 Spine Wasm/AsmJS 模块 ?`,
},
},
box2d: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleBox2D' API 手动加载 Box2D Wasm/AsmJS 模块 ?`,
},
},
bullet: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModuleBullet' API 手动加载 Bullet Wasm/AsmJS 模块 ?`,
},
},
physx: {
loadManual: {
label: '手动加载',
description: `是否通过 'loadWasmModulePhysX' API 手动加载 PhysX Wasm/AsmJS 模块 ?`,
},
},
},
}, },
renderable_2d: { renderable_2d: {
srcBlendFactor: '指定源的混合模式,这会克隆一个新的材质对象,注意这带来的性能和内存损耗', srcBlendFactor: '指定源的混合模式,这会克隆一个新的材质对象,注意这带来的性能和内存损耗',