refactor(behavior-tree)!: 迁移到 Runtime 执行器架构 (#196)

* refactor(behavior-tree)!: 迁移到 Runtime 执行器架构

* fix(behavior-tree): 修复LogAction中的ReDoS安全漏洞

* feat(behavior-tree): 完善行为树核心功能并修复类型错误
This commit is contained in:
YHH
2025-10-31 17:27:38 +08:00
committed by GitHub
parent c58e3411fd
commit 61813e67b6
113 changed files with 7795 additions and 10564 deletions

View File

@@ -1,5 +1,6 @@
import { EditorPluginManager } from '@esengine/editor-core';
import { EditorPluginManager, LocaleService, MessageHub } from '@esengine/editor-core';
import type { IEditorPlugin } from '@esengine/editor-core';
import { Core } from '@esengine/ecs-framework';
import { TauriAPI } from '../api/tauri';
interface PluginPackageJson {
@@ -119,6 +120,28 @@ export class PluginLoader {
await pluginManager.installEditor(pluginInstance);
this.loadedPluginNames.add(packageJson.name);
// 同步插件的语言设置
try {
const localeService = Core.services.resolve(LocaleService);
const currentLocale = localeService.getCurrentLocale();
if (pluginInstance.setLocale) {
pluginInstance.setLocale(currentLocale);
console.log(`[PluginLoader] Set locale for plugin ${packageJson.name}: ${currentLocale}`);
}
} catch (error) {
console.warn(`[PluginLoader] Failed to set locale for plugin ${packageJson.name}:`, error);
}
// 通知节点面板重新加载模板
try {
const messageHub = Core.services.resolve(MessageHub);
const localeService = Core.services.resolve(LocaleService);
messageHub.publish('locale:changed', { locale: localeService.getCurrentLocale() });
console.log(`[PluginLoader] Published locale:changed event for plugin ${packageJson.name}`);
} catch (error) {
console.warn(`[PluginLoader] Failed to publish locale:changed event:`, error);
}
console.log(`[PluginLoader] Successfully loaded plugin: ${packageJson.name}`);
} catch (error) {
console.error(`[PluginLoader] Failed to load plugin from ${pluginPath}:`, error);