internal override void OnDestroy() { base.OnDestroy(); Destroy(icon); Destroy(icon_on); Destroy(icon_blizzy); Destroy(icon_blizzy_on); ClearPartHighlighting(); WindTunnelSettings.SaveSettings(); //log.debug("Unregistering GameEvents."); GameEvents.onEditorShipModified.Remove(OnEditorShipModified); if (appLauncherEventSet) { GameEvents.onGUIApplicationLauncherReady.Remove(OnGuiApplicationLauncherReady); } if (appButton != null) { ApplicationLauncher.Instance.RemoveModApplication(appButton); } if (blizzyToolbarButton != null) { blizzyToolbarButton.Destroy(); } //ThreadPool.Dispose(); }
internal override void Awake() { base.Awake(); WindTunnelSettings.InitializeSettings(); Threading.ThreadPool.Start(-1); if (Instance) { Destroy(Instance); } Instance = this; icon.LoadImage(System.IO.File.ReadAllBytes(texPath + iconPath_off)); icon_on.LoadImage(System.IO.File.ReadAllBytes(texPath + iconPath)); icon_blizzy.LoadImage(System.IO.File.ReadAllBytes(texPath + iconPath_blizzy_off)); icon_blizzy_on.LoadImage(System.IO.File.ReadAllBytes(texPath + iconPath_blizzy)); GameEvents.onEditorShipModified.Add(OnEditorShipModified); if (!ActivateBlizzyToolBar()) { //log.debug("Registering GameEvents."); appLauncherEventSet = true; GameEvents.onGUIApplicationLauncherReady.Add(OnGuiApplicationLauncherReady); } guiId = GUIUtility.GetControlID(FocusType.Passive); window = AddComponent <WindTunnelWindow>(); window.WindowRect = new Rect(150, 50, 100, 100); //750, 600 window.Parent = this; window.Mach = WindTunnelSettings.DefaultToMach; window.Minimized = WindTunnelSettings.StartMinimized; }