/// <summary> /// Unity OnDestroy Method to clean up /// </summary> public void OnDestroy() { RTSettings.OnSettingsChanged.Remove(OnRtSettingsChanged); GameEvents.onLevelWasLoaded.Remove(onLevelWasLoaded); GameEvents.OnUpgradeableObjLevelChange.Remove(OnUpgradeableObjLevelChange); _optionWindow.Hide(); _optionWindow = null; if (LauncherButton != null) { ApplicationLauncher.Instance.RemoveModApplication(LauncherButton); } }
/// <summary> /// Start method for RTSpaceCentre /// </summary> public void Start() { // create the option window _optionWindow = new OptionWindow(); GameEvents.onLevelWasLoaded.Add(onLevelWasLoaded); GameEvents.OnUpgradeableObjLevelChange.Add(OnUpgradeableObjLevelChange); RTSettings.OnSettingsChanged.Add(OnRtSettingsChanged); _rtOptionBtn = RTUtil.LoadImage("gitpagessat"); LauncherButton = ApplicationLauncher.Instance.AddModApplication( _optionWindow.toggleWindow, null, null, null, null, null, ApplicationLauncher.AppScenes.SPACECENTER, _rtOptionBtn); }