示例#1
0
        private void LoadAssembly(string path)
        {
            try
            {
                Assembly assembly = Assembly.LoadFile(path);

                SpaceAddonAssembly[] attrbutes = assembly.GetCustomAttributes(typeof(SpaceAddonAssembly), false) as SpaceAddonAssembly[];

                if (attrbutes == null || attrbutes.Length == 0)
                {
                    Logger.Log(string.Format("This is not an adddon assembly! {0}", path));
                }
                else
                {
                    SpaceAddonAssembly    ea  = attrbutes[0];
                    List <Type>           mb  = GetAllSubclassesOf <Type, SpaceAddonMonoBehaviour, MonoBehaviour>(assembly);
                    AssemblyExternalTypes aet = new AssemblyExternalTypes(typeof(MonoBehaviour), mb);
                    AssemblyExternal      ae  = new AssemblyExternal(path, ea.Name, ea.Version, assembly, aet);

                    ExternalAssemblies.Add(ae);

                    TotalLoaded++;

                    FireHotPlugin(ae);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(string.Format("LoadAssembly Exception: {0}", ex.Message));
            }
        }
示例#2
0
        private void FireHotPlugin(AssemblyExternal Addon)
        {
            int counter = Addon.Types.SelectMany(kvp => kvp.Value).Count(v => FirePlugin(v, 0));

            Logger.Log(string.Format("{0} plugins fired at scene №: {1}", counter, SceneManager.GetActiveScene().buildIndex));
        }
示例#3
0
        private void FireHotPlugin(AssemblyExternal assembly)
        {
            var counter = assembly.Types.SelectMany(kvp => kvp.Value).Count(v => FirePlugin(v, 0));

            Logger.Log(string.Format("AssemblyLoader.FirePlugins: {0} plugins fired at scene: {1}", counter, (EntryPoint)SceneManager.GetActiveScene().buildIndex));
        }