Example #1
0
 protected void shutdown()
 {
     if (this.config == null || this.assemblies == null)
     {
         return;
     }
     if (this.status != EModuleStatus.Initialized)
     {
         return;
     }
     for (int i = 0; i < this.nexii.Count; i++)
     {
         try
         {
             this.nexii[i].shutdown();
         }
         catch (Exception ex)
         {
             Debug.LogError("Failed to shutdown nexus!");
             Debug.LogException(ex);
         }
     }
     this.nexii.Clear();
     this.status = EModuleStatus.Shutdown;
     if (this.onModuleShutdown != null)
     {
         this.onModuleShutdown(this);
     }
 }
Example #2
0
        protected void initialize()
        {
            if (this.config == null || this.assemblies == null)
            {
                return;
            }
            if (this.status != EModuleStatus.None && this.status != EModuleStatus.Shutdown)
            {
                return;
            }
            this.nexii.Clear();
            Type typeFromHandle = typeof(IModuleNexus);

            for (int i = 0; i < this.types.Length; i++)
            {
                Type type = this.types[i];
                if (!type.IsAbstract && typeFromHandle.IsAssignableFrom(type))
                {
                    IModuleNexus moduleNexus = Activator.CreateInstance(type) as IModuleNexus;
                    try
                    {
                        moduleNexus.initialize();
                    }
                    catch (Exception ex)
                    {
                        Debug.LogError("Failed to initialize nexus!");
                        Debug.LogException(ex);
                    }
                    this.nexii.Add(moduleNexus);
                }
            }
            this.status = EModuleStatus.Initialized;
            if (this.onModuleInitialized != null)
            {
                this.onModuleInitialized(this);
            }
        }