Example #1
0
        private void LoadControlModules()
        {
            if (moduleRegistry == null)
            {
                moduleRegistry = new List <Type>();
                foreach (var ass in AppDomain.CurrentDomain.GetAssemblies())
                {
                    try
                    {
                        foreach (var module in ass.GetTypes().Where(p => p.IsSubclassOf(typeof(ControlModule))).ToList())
                        {
                            Debug.LogWarning("[Dune] Core assembly loaded: " + module.FullName);
                            moduleRegistry.Add(module);
                        }
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("[Dune] Core LoadControlModules() moduleRegistry loading: " + ass.FullName + " Exception: " + e);
                    }
                }
            }

            try
            {
                foreach (Type t in moduleRegistry)
                {
                    if (t != typeof(ControlModule) && (t != typeof(DisplayModule)) && (GetControlModule(t.Name) == null))
                    {
                        AddControlModule((ControlModule)(t.GetConstructor(new Type[] { typeof(DuneCore) }).Invoke(new object[] { this })));
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("[Dune] Core LoadControlModules() moduleRegistry: " + e);
            }

            displayControl   = GetControlModule <DuneDisplayControl>();
            debrisControl    = GetControlModule <DuneDebrisControl>();
            throttleControl  = GetControlModule <DuneThrottleControl>();
            dataControl      = GetControlModule <DuneDataControl>();
            navigatorControl = GetControlModule <DuneNavigatorControl>();
            settingsControl  = GetControlModule <DuneSettingsControl>();
        }
Example #2
0
 public override void OnStart()
 {
     debrisControl = core.GetControlModule <DuneDebrisControl>();
 }