refactor(plugins): 更新插件模板使用ModuleManifest
This commit is contained in:
@@ -4,31 +4,33 @@
|
|||||||
* 插件定义 - 注册编辑器模块(Inspector、工具等)
|
* 插件定义 - 注册编辑器模块(Inspector、工具等)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IPluginLoader, PluginDescriptor, IEditorModuleLoader } from '@esengine/ecs-components';
|
import type { IPlugin, ModuleManifest, IEditorModuleLoader } from '@esengine/editor-core';
|
||||||
import { {{name}}RuntimeModule } from '../{{name}}RuntimeModule';
|
import { {{name}}RuntimeModule } from '../{{name}}RuntimeModule';
|
||||||
|
|
||||||
class {{name}}EditorModule implements IEditorModuleLoader {
|
class {{name}}EditorModule implements IEditorModuleLoader {
|
||||||
registerInspectors(registry: any): void {
|
async install(): Promise<void> {
|
||||||
// 注册组件 Inspector
|
// 注册组件 Inspector
|
||||||
// registry.register('MyComponent', MyComponentInspector);
|
// registry.register('MyComponent', MyComponentInspector);
|
||||||
}
|
}
|
||||||
|
async uninstall(): Promise<void> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const descriptor: PluginDescriptor = {
|
const manifest: ModuleManifest = {
|
||||||
id: '@esengine/{{name}}',
|
id: '@esengine/{{name}}',
|
||||||
name: '{{displayName}}',
|
name: '@esengine/{{name}}',
|
||||||
|
displayName: '{{displayName}}',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
description: '{{displayName}} plugin',
|
||||||
category: '{{category}}',
|
category: '{{category}}',
|
||||||
enabledByDefault: true,
|
isCore: false,
|
||||||
isEnginePlugin: false,
|
defaultEnabled: true,
|
||||||
modules: [
|
isEngineModule: false,
|
||||||
{ name: '{{name}}Runtime', type: 'runtime', entry: './src/runtime.ts' },
|
dependencies: ['engine-core'],
|
||||||
{ name: '{{name}}Editor', type: 'editor', entry: './src/editor/index.ts' }
|
exports: {}
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const {{name}}Plugin: IPluginLoader = {
|
export const {{name}}Plugin: IPlugin = {
|
||||||
descriptor,
|
manifest,
|
||||||
runtimeModule: new {{name}}RuntimeModule(),
|
runtimeModule: new {{name}}RuntimeModule(),
|
||||||
editorModule: new {{name}}EditorModule()
|
editorModule: new {{name}}EditorModule()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,27 +3,31 @@
|
|||||||
* 完整的 2D 物理插件(运行时 + 编辑器)
|
* 完整的 2D 物理插件(运行时 + 编辑器)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { IPlugin, PluginDescriptor } from '@esengine/editor-core';
|
import type { IPlugin, ModuleManifest } from '@esengine/editor-core';
|
||||||
import { PhysicsRuntimeModule } from '@esengine/physics-rapier2d/runtime';
|
import { PhysicsRuntimeModule } from '@esengine/physics-rapier2d/runtime';
|
||||||
import { physics2DEditorModule } from './Physics2DEditorModule';
|
import { physics2DEditorModule } from './Physics2DEditorModule';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Physics 2D 插件描述符
|
* Physics 2D 插件清单
|
||||||
* Physics 2D Plugin Descriptor
|
* Physics 2D Plugin Manifest
|
||||||
*/
|
*/
|
||||||
const descriptor: PluginDescriptor = {
|
const manifest: ModuleManifest = {
|
||||||
id: '@esengine/physics-rapier2d',
|
id: '@esengine/physics-rapier2d',
|
||||||
name: 'Physics 2D',
|
name: '@esengine/physics-rapier2d',
|
||||||
|
displayName: 'Physics 2D',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
description: 'Deterministic 2D physics with Rapier2D',
|
description: 'Deterministic 2D physics with Rapier2D',
|
||||||
category: 'physics',
|
category: 'Physics',
|
||||||
enabledByDefault: true,
|
isCore: false,
|
||||||
isEnginePlugin: true,
|
defaultEnabled: true,
|
||||||
|
isEngineModule: true,
|
||||||
canContainContent: false,
|
canContainContent: false,
|
||||||
modules: [
|
requiresWasm: true,
|
||||||
{ name: 'Runtime', type: 'runtime', loadingPhase: 'default' },
|
dependencies: ['engine-core'],
|
||||||
{ name: 'Editor', type: 'editor', loadingPhase: 'postDefault' }
|
exports: {
|
||||||
]
|
components: ['Rigidbody2DComponent', 'BoxCollider2DComponent', 'CircleCollider2DComponent'],
|
||||||
|
systems: ['PhysicsSystem']
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +35,7 @@ const descriptor: PluginDescriptor = {
|
|||||||
* Complete Physics 2D Plugin (runtime + editor)
|
* Complete Physics 2D Plugin (runtime + editor)
|
||||||
*/
|
*/
|
||||||
export const Physics2DPlugin: IPlugin = {
|
export const Physics2DPlugin: IPlugin = {
|
||||||
descriptor,
|
manifest,
|
||||||
runtimeModule: new PhysicsRuntimeModule(),
|
runtimeModule: new PhysicsRuntimeModule(),
|
||||||
editorModule: physics2DEditorModule
|
editorModule: physics2DEditorModule
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user