feat(modules): 添加module.json配置

This commit is contained in:
yhh
2025-12-03 16:20:48 +08:00
parent e1d494b415
commit 37ab494e4a
26 changed files with 2356 additions and 147 deletions

View File

@@ -1,36 +1,29 @@
/**
* Behavior Tree Plugin Descriptor
* 行为树插件描述符
* Behavior Tree Plugin Manifest
* 行为树插件清单
*/
import type { PluginDescriptor } from '@esengine/editor-runtime';
import type { ModuleManifest } from '@esengine/editor-runtime';
/**
* 插件描述符
* 插件清单
*/
export const descriptor: PluginDescriptor = {
export const manifest: ModuleManifest = {
id: '@esengine/behavior-tree',
name: 'Behavior Tree System',
name: '@esengine/behavior-tree',
displayName: 'Behavior Tree System',
version: '1.0.0',
description: 'AI 行为树系统,支持可视化编辑和运行时执行',
category: 'ai',
enabledByDefault: true,
category: 'AI',
icon: 'GitBranch',
isCore: false,
defaultEnabled: true,
isEngineModule: false,
canContainContent: false,
isEnginePlugin: false,
modules: [
{
name: 'BehaviorTreeRuntime',
type: 'runtime',
loadingPhase: 'default'
},
{
name: 'BehaviorTreeEditor',
type: 'editor',
loadingPhase: 'default'
}
],
dependencies: [
{ id: '@esengine/engine-core', version: '>=1.0.0', optional: true }
],
icon: 'GitBranch'
dependencies: ['engine-core'],
exports: {
components: ['BehaviorTreeRuntimeComponent'],
systems: ['BehaviorTreeExecutionSystem'],
loaders: ['BehaviorTreeLoader']
}
};

View File

@@ -42,8 +42,8 @@ import { useBehaviorTreeDataStore } from './stores';
import { createRootNode } from './domain/constants/RootNode';
import { PluginContext } from './PluginContext';
// Import descriptor from local file
import { descriptor } from './BehaviorTreePlugin';
// Import manifest from local file
import { manifest } from './BehaviorTreePlugin';
// 导入编辑器 CSS 样式(会被 vite 自动处理并注入到 DOM
// Import editor CSS styles (automatically handled and injected by vite)
@@ -340,7 +340,7 @@ export class BehaviorTreeEditorModule implements IEditorModuleLoader {
// Create the complete plugin with editor module
export const BehaviorTreePlugin: IPluginLoader = {
descriptor,
manifest,
runtimeModule: new BehaviorTreeRuntimeModule(),
editorModule: new BehaviorTreeEditorModule(),
};