private void setSite(LaunchSite newSite) { ConfigNode site = KSCLoader.instance.Sites.getSiteByName(newSite.name); if (site == null) { return; } if (KSCSwitcher.setSite(site)) { activeSite = newSite.name; ScreenMessages.PostScreenMessage("Launch site changed to " + newSite.displayName, 2.5f, ScreenMessageStyle.LOWER_CENTER); showWindow = false; } }
public SortedList <string, LaunchSite> GetSitesGeographicalList() { SortedList <string, LaunchSite> siteLocations = new SortedList <string, LaunchSite>(); double dtmp; foreach (ConfigNode site in KSCLoader.instance.Sites.Sites) { ConfigNode pqsCity = site.GetNode("PQSCity"); LaunchSite temp = new LaunchSite { name = site.GetValue("name"), displayName = site.GetValue("displayName") }; double.TryParse(pqsCity.GetValue("latitude"), out double lat); double.TryParse(pqsCity.GetValue("longitude"), out double lon); temp.geographicLocation = new Vector2d(lat, lon); if (site.HasValue("description")) { temp.description = site.GetValue("description"); } if (site.HasValue("PQSName")) { temp.description = site.GetValue("PQSName"); } else { temp.PQSName = "Kerbin"; } if (site.HasValue("availableFromUT")) { if (double.TryParse(site.GetValue("availableFromUT"), out dtmp)) { temp.availableFromUT = dtmp; } } if (site.HasValue("availableUntilUT")) { if (double.TryParse(site.GetValue("availableUntilUT"), out dtmp)) { temp.availableUntilUT = dtmp; } } siteLocations.Add(temp.name, temp); } return(siteLocations); }