// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "GamePlugin.h" /// /// Game and Editor plugins management service. /// API_CLASS(Static) class FLAXENGINE_API PluginManager { DECLARE_SCRIPTING_TYPE_NO_SPAWN(PluginManager); public: /// /// Gets the game plugins. /// API_PROPERTY() static const Array& GetGamePlugins(); /// /// Gets the editor plugins. /// API_PROPERTY() static const Array& GetEditorPlugins(); public: /// /// Occurs before loading plugin. /// API_EVENT() static Delegate PluginLoading; /// /// Occurs when plugin gets loaded and initialized. /// API_EVENT() static Delegate PluginLoaded; /// /// Occurs before unloading plugin. /// API_EVENT() static Delegate PluginUnloading; /// /// Occurs when plugin gets unloaded. It should not be used anymore. /// API_EVENT() static Delegate PluginUnloaded; /// /// Occurs when plugins collection gets edited (added or removed plugin). /// API_EVENT() static Action PluginsChanged; public: /// /// Return the first plugin using the provided name. /// // The plugin name. /// The plugin, or null if not loaded. API_FUNCTION() static Plugin* GetPlugin(const StringView& name); /// /// Returns the first plugin of the provided type. /// /// Type of the plugin to search for. Includes any plugin base class derived from the type. /// The plugin or null. API_FUNCTION() static Plugin* GetPlugin(API_PARAM(Attributes="TypeReference(typeof(Plugin))") const MClass* type); /// /// Returns the first plugin of the provided type. /// /// Type of the plugin to search for. Includes any plugin base class derived from the type. /// The plugin or null. static Plugin* GetPlugin(const ScriptingTypeHandle& type); /// /// Returns the first plugin of the provided type. /// /// The plugin or null. template FORCE_INLINE static T* GetPlugin() { return (T*)GetPlugin(T::TypeInitializer); } private: #if USE_EDITOR // Internal bindings API_FUNCTION(NoProxy) static void InitializeGamePlugins(); API_FUNCTION(NoProxy) static void DeinitializeGamePlugins(); #endif };