public virtual void Initialize()
        {
            var pluginType = plugin.GetType();

            assembly = new AssemblyResourceProvider(pluginType.Assembly, pluginType.Namespace, assemblyRoot);
            _providers.Add(assembly);

            if (Directory.Exists(plugin.paths.resourcesFolder))
            {
                editorAssets = new EditorAssetResourceProvider(plugin.paths.resourcesFolder);
                _providers.Add(editorAssets);
            }

            if (File.Exists(plugin.paths.resourcesBundle))
            {
                assetBundle = new AssetBundleResourceProvider(AssetBundle.LoadFromFile(plugin.paths.resourcesBundle));
                _providers.Add(assetBundle);
            }

            if (_providers.Count == 0)
            {
                Debug.LogWarning($"No plugin resources provider available for {plugin.id}.");
            }
            else
            {
                defaultProvider = _providers[0];
            }
        }
Пример #2
0
        public virtual void Initialize()
        {
            acknowledgements = InstantiateLinkedTypes <PluginAcknowledgement>().OrderBy(a => a.title).ToList().AsReadOnly();
            migrations       = InstantiateLinkedTypes <PluginMigration>().OrderBy(m => m).ToList().AsReadOnly();
            changelogs       = InstantiateLinkedTypes <PluginChangelog>().OrderBy(m => m).ToList().AsReadOnly();

            var pluginType = plugin.GetType();

            assembly = new AssemblyResourceProvider(pluginType.Assembly, pluginType.Namespace, assemblyRoot);
            _providers.Add(assembly);

            if (Directory.Exists(plugin.paths.resourcesFolder))
            {
                editorAssets = new EditorAssetResourceProvider(plugin.paths.resourcesFolder);
                _providers.Add(editorAssets);
            }

            if (File.Exists(plugin.paths.resourcesBundle))
            {
                assetBundle = new AssetBundleResourceProvider(AssetBundle.LoadFromFile(plugin.paths.resourcesBundle));
                _providers.Add(assetBundle);
            }

            if (_providers.Count == 0)
            {
                Debug.LogWarning($"No plugin resources provider available for {plugin.id}.");
            }
            else
            {
                defaultProvider = _providers[0];
            }
        }
Пример #3
0
        public virtual void Initialize()
        {
            //TODO: Move it to the lazy initialization

            if (plugin.id == BoltCore.ID)
            {
                _providers.Add(new EmbeddedResourceProvider());

                var pluginType = plugin.GetType();
                assembly = new AssemblyResourceProvider(pluginType.Assembly, pluginType.Namespace, assemblyRoot);

                _providers.Add(assembly);

                if (Directory.Exists(PluginPaths.resourcesFolder))
                {
                    editorAssets = new EditorAssetResourceProvider(PluginPaths.resourcesFolder);
                    _providers.Add(editorAssets);
                }

                if (File.Exists(PluginPaths.resourcesBundle))
                {
                    /*
                     * TODO: To be removed when the asset bundle team fix the issue JIRA: BOLT-1650
                     */
                    assetBundleResourceProvider = new AssetBundleResourceProvider();

                    _providers.Add(assetBundleResourceProvider);
                }

                if (_providers.Count == 0)
                {
                    Debug.LogWarning($"No plugin resources provider available for {plugin.id}.");
                }
                else
                {
                    defaultProvider = _providers[0];
                }
            }
        }