MCPcopy Create free account
hub / github.com/esengine/esengine / _initializePlugins

Method _initializePlugins

packages/runtime-core/src/GameRuntime.ts:521–544  ·  view source on GitHub ↗

* @zh 加载并初始化插件 * @en Load and initialize plugins

()

Source from the content-addressed store, hash-verified

519 * @en Load and initialize plugins
520 */
521 private async _initializePlugins(): Promise<void> {
522 const hasPlugins = runtimePluginManager.getPlugins().length > 0;
523
524 if (!hasPlugins) {
525 const configs = convertToPluginLoadConfigs(this._projectConfig, BUILTIN_PLUGIN_PACKAGES);
526 const loader = new PluginLoader({ plugins: configs });
527
528 await loader.loadAll();
529
530 const loaded = loader.getLoaded();
531 const failed = loader.getFailed();
532
533 if (loaded.length > 0) {
534 console.log(`[GameRuntime] Loaded: ${loaded.map(p => p.packageId).join(', ')}`);
535 }
536 if (failed.length > 0) {
537 for (const p of failed) {
538 console.warn(`[GameRuntime] Failed: ${p.packageId} - ${p.error}`);
539 }
540 }
541 }
542
543 await runtimePluginManager.initializeRuntime(Core.services);
544 }
545
546 /**
547 * @zh 设置游戏逻辑系统启用状态

Callers 1

initializeMethod · 0.95

Calls 10

loadAllMethod · 0.95
getLoadedMethod · 0.95
getFailedMethod · 0.95
getPluginsMethod · 0.80
logMethod · 0.45
joinMethod · 0.45
mapMethod · 0.45
warnMethod · 0.45
initializeRuntimeMethod · 0.45

Tested by

no test coverage detected