File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 11#pragma once
22
3+ #include " PluginManager.h"
4+
35#include < ll/api/plugin/Manifest.h>
46#include < ll/api/plugin/Plugin.h>
57
@@ -8,6 +10,8 @@ namespace lse {
810class Plugin : public ll ::plugin::Plugin {
911public:
1012 Plugin (const ll::plugin::Manifest& manifest);
11- };
1213
14+ private:
15+ friend PluginManager;
16+ };
1317} // namespace lse
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ auto PluginManager::load(ll::plugin::Manifest manifest) -> bool {
5151 }
5252
5353 auto & scriptEngine = *EngineManager::newEngine (manifest.name );
54+ auto plugin = std::make_shared<Plugin>(manifest);
5455
5556 try {
5657 script::EngineScope engineScope (scriptEngine);
@@ -81,7 +82,10 @@ auto PluginManager::load(ll::plugin::Manifest manifest) -> bool {
8182 return false ;
8283 }
8384 scriptEngine.eval (pluginEntryContent.value ());
84-
85+ plugin->onLoad ([](ll::plugin::Plugin& plugin) { return true ; });
86+ plugin->onUnload ([](ll::plugin::Plugin& plugin) { return true ; });
87+ plugin->onEnable ([](ll::plugin::Plugin& plugin) { return true ; });
88+ plugin->onDisable ([](ll::plugin::Plugin& plugin) { return true ; });
8589 } catch (const std::exception& e) {
8690 LLSERemoveTimeTaskData (&scriptEngine);
8791 LLSERemoveAllEventListeners (&scriptEngine);
@@ -93,10 +97,9 @@ auto PluginManager::load(ll::plugin::Manifest manifest) -> bool {
9397
9498 EngineManager::unregisterEngine (&scriptEngine);
9599
96- // throw ;
100+ return false ;
97101 }
98102
99- auto plugin = std::make_shared<Plugin>(manifest);
100103 if (!addPlugin (manifest.name , plugin)) {
101104 logger.error (" failed to register plugin {}" , manifest.name );
102105 return false ;
You can’t perform that action at this time.
0 commit comments