static CelestialBodies() { try { SystemBody = new BodyInfo(PSystemManager.Instance.localBodies.Find(b => b.referenceBody == null || b.referenceBody == b)); if (!SetSelectedBody("Kerbin")) { SelectedBody = SystemBody; SelectedBody.SetSelected(true); } } catch (Exception ex) { Logger.Exception(ex); } }
static CelestialBodies() { try { SystemBody = new BodyInfo(PSystemManager.Instance.localBodies.Find(b => b.referenceBody == null || b.referenceBody == b)); String homeCBName = Planetarium.fetch.Home.bodyDisplayName.LocalizeRemoveGender(); if (!SetSelectedBody(homeCBName)) { SelectedBody = SystemBody; SelectedBody.SetSelected(true); } } catch (Exception ex) { Logger.Exception(ex); } }
/// <summary> /// Sets the selected body to one matching the supplied body name. Returns true if successful. /// </summary> public static bool SetSelectedBody(string bodyName) { try { BodyInfo body = GetBodyInfo(bodyName); if (body != null) { if (SelectedBody != null) { SelectedBody.SetSelected(false); } SelectedBody = body; SelectedBody.SetSelected(true); return(true); } } catch (Exception ex) { Logger.Exception(ex); } return(false); }