protected void saveSettings() { KSPSettings.set("PlanetSelectorWindow.x", (int)windowPosition.x); KSPSettings.set("PlanetSelectorWindow.y", (int)windowPosition.y); KSPSettings.save(); }
public void Start() { Log("start"); KSPSettings.load(); psWindow = gameObject.AddComponent <PlanetSelectorWindow>(); if (ToolbarManager.ToolbarAvailable) { LogDebug("add toolbar button"); psButton = ToolbarManager.Instance.add("PS", "PSButton"); psButton.TexturePath = "PlanetSelector/icons/ps_toolbar_button"; psButton.ToolTip = "Planet Selector Window"; psButton.OnClick += (e) => { psWindow.windowVisible = !psWindow.windowVisible; }; } if (KSPSettings.get("showAppLauncher", true)) { GameEvents.onGUIApplicationLauncherReady.Add(onGUIAppLauncherReady); GameEvents.onGUIApplicationLauncherDestroyed.Add(onGUIAppLauncherDestroyed); } }
public void Start() { LogDebug("window start"); windowPosition.x = KSPSettings.get("PlanetSelectorWindow.x", (int)(Screen.width / 2 - windowWidth / 2)); windowPosition.y = KSPSettings.get("PlanetSelectorWindow.y", (int)(Screen.height / 2 - windowHeight / 2)); pCam = MapView.MapCamera; List <MapObject> targets = pCam.targets; foreach (MapObject mo in targets) { LogDebug("MapObject: " + mo.GetName() + " type: " + mo.type); } }
void OnDestroy() { Log("destroy"); if (ToolbarManager.ToolbarAvailable) { psButton.Destroy(); } if (KSPSettings.get("showAppLauncher", true)) { if (appLauncherButton != null) { Log("removing app launcher button"); ApplicationLauncher.Instance.RemoveModApplication(appLauncherButton); } GameEvents.onGUIApplicationLauncherDestroyed.Remove(onGUIAppLauncherDestroyed); GameEvents.onGUIApplicationLauncherReady.Remove(onGUIAppLauncherReady); } }