void OnDestroy() { this.Log_DebugOnly("OnDestroy", "."); if (appLauncherButton != null) { ApplicationLauncher.Instance.DisableMutuallyExclusive(appLauncherButton); ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); appLauncherButton = null; } if (this.crewFitnessController != null) { Destroy(crewFitnessController); crewFitnessController = null; } if (this.crewRosterController != null) { Destroy(crewRosterController); crewRosterController = null; } if (this.geeEffectsController != null) { Destroy(geeEffectsController); geeEffectsController = null; } }
public override void OnAwake() { this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene); base.OnAwake(); if (mainWindow == null) { mainWindow = gameObject.AddComponent <MainWindow>(); mainWindow.Init(this); } if (logWindow == null) { logWindow = gameObject.AddComponent <LogWindow>(); logWindow.Init(this); } if (configWindow == null) { configWindow = gameObject.AddComponent <ConfigWindow>(); configWindow.Init(this); } if (rosterWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing rosterWindow"); rosterWindow = gameObject.AddComponent <RosterWindow>(); rosterWindow.Init(this); } if (allVesselsWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow"); allVesselsWindow = gameObject.AddComponent <AllVesselsWindow>(); allVesselsWindow.Init(this); } if (appLauncherButton != null) { this.Log_DebugOnly("OnAwake", "AppLauncher button already here"); } else { this.Log_DebugOnly("OnAwake", "Adding AppLauncher button"); Texture toolbarButtonTexture = (Texture)GameDatabase.Instance.GetTexture("Timmers/KeepFit/KeepFit", false); ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.TRACKSTATION; appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn, onAppLaunchToggleOff, onAppLaunchHoverOn, onAppLaunchHoverOff, onAppLaunchEnable, onAppLaunchDisable, scenes, toolbarButtonTexture); ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition); } this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController"); crewRosterController = gameObject.AddComponent <KeepFitCrewRosterController>(); crewRosterController.Init(this); if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.SPACECENTER) { this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController"); crewFitnessController = gameObject.AddComponent <KeepFitCrewFitnessController>(); crewFitnessController.Init(this); } if (HighLogic.LoadedScene == GameScenes.FLIGHT) { this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController"); this.geeEffectsController = gameObject.AddComponent <KeepFitGeeEffectsController>(); this.geeEffectsController.Init(this); } }
void OnDestroy() { this.Log_DebugOnly("OnDestroy", "."); if (appLauncherButton == null) { this.Log_DebugOnly("OnDestroy", "No appLauncher button to remove."); } else { this.Log_DebugOnly("OnDestroy", "Removing appLauncher button."); ApplicationLauncher.Instance.DisableMutuallyExclusive(appLauncherButton); ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); appLauncherButton = null; } if (toolmodLauncherButton != null) { toolmodLauncherButton.Destroy(); toolmodLauncherButton = null; } if (this.crewFitnessController == null) { this.Log_DebugOnly("OnDestroy", "No crewFitness controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying crewFitness controller."); Destroy(crewFitnessController); crewFitnessController = null; } if (this.crewRosterController == null) { this.Log_DebugOnly("OnDestroy", "No crewRoster controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying crewRoster controller."); Destroy(crewRosterController); crewRosterController = null; } if (this.geeEffectsController == null) { this.Log_DebugOnly("OnDestroy", "No geeEffects controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying geeEffects controller."); Destroy(geeEffectsController); geeEffectsController = null; } if (mainWindow != null) { Destroy(mainWindow); mainWindow = null; } if (logWindow != null) { Destroy(logWindow); logWindow = null; } if (configWindow != null) { Destroy(configWindow); configWindow = null; } if (rosterWindow != null) { Destroy(rosterWindow); rosterWindow = null; } if (allVesselsWindow == null) { Destroy(allVesselsWindow); allVesselsWindow = null; } }
public override void OnAwake() { this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene); base.OnAwake(); if (cls == null) { cls = CLSClient.GetCLS(); } if (mainWindow == null) { mainWindow = gameObject.AddComponent <MainWindow>(); mainWindow.Init(this); } if (logWindow == null) { logWindow = gameObject.AddComponent <LogWindow>(); logWindow.Init(this); } if (configWindow == null) { configWindow = gameObject.AddComponent <ConfigWindow>(); configWindow.Init(this); } if (rosterWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing rosterWindow"); rosterWindow = gameObject.AddComponent <RosterWindow>(); rosterWindow.Init(this); } if (allVesselsWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow"); allVesselsWindow = gameObject.AddComponent <AllVesselsWindow>(); allVesselsWindow.Init(this); } if (appLauncherButton != null) { this.Log_DebugOnly("OnAwake", "AppLauncher button already here"); } else { this.Log_DebugOnly("OnAwake", "Adding AppLauncher button"); Texture toolbarButtonTexture = (Texture)GameDatabase.Instance.GetTexture("KeepFit/KeepFit", false); ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT | //ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.SPACECENTER | //ApplicationLauncher.AppScenes.SPH | //ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.TRACKSTATION; appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn, onAppLaunchToggleOff, onAppLaunchHoverOn, onAppLaunchHoverOff, onAppLaunchEnable, onAppLaunchDisable, scenes, toolbarButtonTexture); ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition); if (ToolbarManager.ToolbarAvailable && ToolbarManager.Instance != null) { this.Log_DebugOnly("OnAwake", "Adding Toolbar Button"); this.toolmodLauncherButton = ToolbarManager.Instance.add("KeepFit", "MainButton"); if (this.toolmodLauncherButton != null) { appLauncherButton.VisibleInScenes = scenes; // TODO this.toolmodLauncherButton.Visibility = new GameScenesVisibility(new GameScenes[] { GameScenes.SPACECENTER, GameScenes.EDITOR, GameScenes.FLIGHT, GameScenes.TRACKSTATION }); this.toolmodLauncherButton.TexturePath = "KeepFit/UIResources/KeepFit"; this.toolmodLauncherButton.ToolTip = "KeepFit Toolbar"; this.toolmodLauncherButton.OnClick += ((e) => this.toolmodButtonToggle()); } } } this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController"); crewRosterController = gameObject.AddComponent <KeepFitCrewRosterController>(); crewRosterController.Init(this); if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.SPACECENTER) { this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController"); crewFitnessController = gameObject.AddComponent <KeepFitCrewFitnessController>(); crewFitnessController.Init(this); } if (HighLogic.LoadedScene == GameScenes.FLIGHT) { this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController"); this.geeEffectsController = gameObject.AddComponent <KeepFitGeeEffectsController>(); this.geeEffectsController.Init(this); } }
public override void OnAwake() { this.Log_DebugOnly("OnAwake", "Scene[{0}]", HighLogic.LoadedScene); base.OnAwake(); if (cls == null) { cls = CLSClient.GetCLS(); } if (mainWindow == null) { mainWindow = gameObject.AddComponent<MainWindow>(); mainWindow.Init(this); } if (logWindow == null) { logWindow = gameObject.AddComponent<LogWindow>(); logWindow.Init(this); } if (configWindow == null) { configWindow = gameObject.AddComponent<ConfigWindow>(); configWindow.Init(this); } if (rosterWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing rosterWindow"); rosterWindow = gameObject.AddComponent<RosterWindow>(); rosterWindow.Init(this); } if (allVesselsWindow == null) { this.Log_DebugOnly("OnAwake", "Constructing allVesselsWindow"); allVesselsWindow = gameObject.AddComponent<AllVesselsWindow>(); allVesselsWindow.Init(this); } if (appLauncherButton != null) { this.Log_DebugOnly("OnAwake", "AppLauncher button already here"); } else { this.Log_DebugOnly("OnAwake", "Adding AppLauncher button"); Texture toolbarButtonTexture = (Texture)GameDatabase.Instance.GetTexture("KeepFit/KeepFit", false); ApplicationLauncher.AppScenes scenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.TRACKSTATION; appLauncherButton = ApplicationLauncher.Instance.AddModApplication(onAppLaunchToggleOn, onAppLaunchToggleOff, onAppLaunchHoverOn, onAppLaunchHoverOff, onAppLaunchEnable, onAppLaunchDisable, scenes, toolbarButtonTexture); ApplicationLauncher.Instance.AddOnRepositionCallback(onAppLauncherReposition); } this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewRosterController"); crewRosterController = gameObject.AddComponent<KeepFitCrewRosterController>(); crewRosterController.Init(this); if (HighLogic.LoadedScene == GameScenes.FLIGHT || HighLogic.LoadedScene == GameScenes.TRACKSTATION || HighLogic.LoadedScene == GameScenes.SPACECENTER) { this.Log_DebugOnly("OnAwake", "Adding KeepFitCrewFitnessController"); crewFitnessController = gameObject.AddComponent<KeepFitCrewFitnessController>(); crewFitnessController.Init(this); } if (HighLogic.LoadedScene == GameScenes.FLIGHT) { this.Log_DebugOnly("OnAwake", "Adding KeepFitGeeEffectsController"); this.geeEffectsController = gameObject.AddComponent<KeepFitGeeEffectsController>(); this.geeEffectsController.Init(this); } }
void OnDestroy() { this.Log_DebugOnly("OnDestroy", "."); if (appLauncherButton == null) { this.Log_DebugOnly("OnDestroy", "No appLauncher button to remove."); } else { this.Log_DebugOnly("OnDestroy", "Removing appLauncher button."); ApplicationLauncher.Instance.DisableMutuallyExclusive(appLauncherButton); ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); appLauncherButton = null; } if (this.crewFitnessController == null) { this.Log_DebugOnly("OnDestroy", "No crewFitness controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying crewFitness controller."); Destroy(crewFitnessController); crewFitnessController = null; } if (this.crewRosterController == null) { this.Log_DebugOnly("OnDestroy", "No crewRoster controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying crewRoster controller."); Destroy(crewRosterController); crewRosterController = null; } if (this.geeEffectsController == null) { this.Log_DebugOnly("OnDestroy", "No geeEffects controller to destroy."); } else { this.Log_DebugOnly("OnDestroy", "Destroying geeEffects controller."); Destroy(geeEffectsController); geeEffectsController = null; } if (mainWindow != null) { Destroy(mainWindow); mainWindow = null; } if (logWindow != null) { Destroy(logWindow); logWindow = null; } if (configWindow != null) { Destroy(configWindow); configWindow = null; } if (rosterWindow != null) { Destroy(rosterWindow); rosterWindow = null; } if (allVesselsWindow == null) { Destroy(allVesselsWindow); allVesselsWindow = null; } }