public void OnDestroy() { if (toolbarControl != null) { toolbarControl.OnDestroy(); Destroy(toolbarControl); } Settings.Instance.Save(); Instance = null; }
private IEnumerator Start() { while (ResearchAndDevelopment.Instance == null) { yield return(0); } while (FlightGlobals.ActiveVessel == null) { yield return(0); } while (!FlightGlobals.ready) { yield return(0); } Instance = this; while (ScienceAlertProfileManager.Instance == null || !ScienceAlertProfileManager.Instance.Ready) { yield return(0); } try { ScienceExperiment experiment = ResearchAndDevelopment.GetExperiment("asteroidSample"); if (experiment != null) { experiment.experimentTitle = "Sample (Asteroid)"; } } catch (KeyNotFoundException) { Destroy(this); } gameObject.AddComponent <AudioPlayer>().LoadSoundsFrom(ConfigUtil.GetDllDirectoryPath() + "/../sounds"); gameObject.AddComponent <BiomeFilter>(); gameObject.AddComponent <ExperimentManager>(); gameObject.AddComponent <WindowEventLogic>(); excludeFilters = new ExcludeFilters(); ScanInterfaceType = Settings.Instance.ScanInterfaceType; //ToolbarType = Settings.Instance.ToolbarInterfaceType; #if false string[] resourceNames = this.GetType().Assembly.GetManifestResourceNames(); foreach (string resourceName in resourceNames) { Debug.Log("resource: " + resourceName); } #endif SliceAtlasTexture(); CreateButton(); }
private IEnumerator DoStart() { while (ResearchAndDevelopment.Instance == null) { yield return(0); } while (FlightGlobals.ActiveVessel == null) { yield return(0); } while (!FlightGlobals.ready) { yield return(0); } Instance = this; while (ScienceAlertProfileManager.Instance == null || !ScienceAlertProfileManager.Instance.Ready) { yield return(0); } try { ScienceExperiment experiment = ResearchAndDevelopment.GetExperiment("asteroidSample"); if (experiment != null) { experiment.experimentTitle = "Sample (Asteroid)"; } } catch (KeyNotFoundException) { Destroy(this); } DMagicFactory.InitDMagicFactory(); gameObject.AddComponent <AudioPlayer>().LoadSoundsFrom(ConfigUtil.GetDllDirectoryPath() + "/../sounds"); gameObject.AddComponent <BiomeFilter>(); gameObject.AddComponent <ExperimentManager>(); gameObject.AddComponent <WindowEventLogic>(); excludeFilters = new ExcludeFilters(); ScanInterfaceType = Settings.Instance.ScanInterfaceType; SliceAtlasTexture(); CreateButton(); }