public static void LaunchResearchPlan(CelestialBody cb) { CelestialBody cbKey = Database.instance.ContainsBodiesKey(cb.bodyName); if (cbKey != null && Database.instance.CelestialBodies[cbKey].researchState == 0) { if (Funding.Instance != null) { //if (Funding.Instance.Funds >= Database.Instance.RB_SettingsParms.ResearchCost) if (Funding.Instance.Funds >= Database.instance.RB_SettingsParms.ResearchCost) { //Funding.Instance.AddFunds(-Database.Instance.RB_SettingsParms.ResearchCost, TransactionReasons.None); Funding.Instance.AddFunds(-Database.instance.RB_SettingsParms.ResearchCost, TransactionReasons.Progression); Research(cbKey, 10); } else { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00014", cbKey.displayName), 3.0f, ScreenMessageStyle.UPPER_CENTER); } } else { if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) { Research(cbKey, 10); } } } else { RSTLogWriter.Log(Locales.FmtLocaleString("#autoLOC_RBodies_00015", cb.displayName)); } }
/// <summary> /// When a SOI change is triggered by GameEvents we check if the TO body Is Discovered or NOT. /// If it is not discovered we make it discovered. /// If it's researchState is less than 100 we set it to 100. /// Finally we set the discovery Level and ProgressiveCBMap. /// todo: change this dynamic to discover on SOI entry but gradually build up researchState over time as it remains in SOI. /// </summary> /// <param name="HostedfromtoAction"></param> private void onVesselSOIChanged(GameEvents.HostedFromToAction <Vessel, CelestialBody> HostedfromtoAction) { if (Database.instance.CelestialBodies.ContainsKey(HostedfromtoAction.to)) { if (!Database.instance.CelestialBodies[HostedfromtoAction.to].isResearched) { bool withparent; CelestialBody parentCB; FoundBody(0, HostedfromtoAction.to, out withparent, out parentCB); } if (Database.instance.CelestialBodies[HostedfromtoAction.to].researchState < 100) { Database.instance.CelestialBodies[HostedfromtoAction.to].researchState = 100; //ScreenMessages.PostScreenMessage(string.Format(Locales.currentLocale.Values["#autoLOC_RBodies_00012"],HostedfromtoAction.to.GetName(), Database.Instance.RB_SettingsParms.ScienceReward), 5f); //ResearchAndDevelopment.Instance.AddScience(Database.Instance.RB_SettingsParms.ScienceReward,TransactionReasons.None); ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00012", HostedfromtoAction.to.displayName, Database.instance.RB_SettingsParms.ScienceReward.ToString()), 5f); ResearchAndDevelopment.Instance.AddScience(Database.instance.RB_SettingsParms.ScienceReward, TransactionReasons.None); var keyvalue = Database.instance.CelestialBodies.FirstOrDefault(a => a.Key.bodyName == HostedfromtoAction.to.bodyName); if (keyvalue.Key != null) { SetIndividualBodyDiscoveryLevel(keyvalue); } } } }
public void OnGUI() { if (!enable) { instructor_Werner.Instructor.enabled = false; instructor_Linus.Instructor.enabled = false; return; } instructor_Werner.Instructor.enabled = true; instructor_Linus.Instructor.enabled = true; try { if (!Textures.StylesSet) { Textures.SetupStyles(); } } catch (Exception ex) { RSTLogWriter.Log("Unable to set GUI Styles to draw the GUI"); RSTLogWriter.Log("Exception: {0}", ex); } GUI.skin = Textures.ObsSkin; #if DEBUGFACILITY if (showObsdebugUI) { observRect = GUILayout.Window(_RBwindowId + 1, observRect, DrawObservDebug, "Research Bodies"); } #endif if (!showGUI) { return; } if (PSystemSetup.Instance.GetSpaceCenterFacility("TrackingStation").GetFacilityDamage() > 0) { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00018"), 3.0f, ScreenMessageStyle.UPPER_CENTER); return; } try { windowRect.ClampInsideScreen(); windowRect = GUILayout.Window(_RBwindowId, windowRect, DrawWindow, "Research Bodies"); Utilities.DrawToolTip(); } catch (Exception ex) { RSTLogWriter.Log("Unable to draw GUI"); RSTLogWriter.Log("Exception: {0}", ex); } }
public void ToggleGUI() { if (!this.vessel.Landed && this.vessel.atmDensity < 0.1 && this.vessel.altitude > minAltitude) { showGUI = !showGUI; } else { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00019", minAltitude.ToString()), 3.0f, ScreenMessageStyle.UPPER_CENTER); } }
public static bool Research(CelestialBody body, int researchToAdd) { CelestialBody cbKey = Database.instance.ContainsBodiesKey(body.bodyName); if (cbKey != null && Database.instance.CelestialBodies[cbKey].researchState < 100) { if (Funding.Instance != null) { //if (Funding.Instance.Funds >= ResearchBodies.Instance.RBgameSettings.ProgressResearchCost) if (Funding.Instance.Funds >= Database.instance.RB_SettingsParms.ProgressResearchCost) { Database.instance.CelestialBodies[cbKey].researchState += researchToAdd; if (Database.instance.CelestialBodies[cbKey].researchState > 100) { Database.instance.CelestialBodies[cbKey].researchState = 100; } //Funding.Instance.AddFunds(-ResearchBodies.Instance.RBgameSettings.ProgressResearchCost, TransactionReasons.None); Funding.Instance.AddFunds(-Database.instance.RB_SettingsParms.ProgressResearchCost, TransactionReasons.Progression); } else { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00047"), 3.0f, ScreenMessageStyle.UPPER_CENTER); } } else { if (HighLogic.CurrentGame.Mode != Game.Modes.CAREER) { Database.instance.CelestialBodies[cbKey].researchState += researchToAdd; } } KeyValuePair <CelestialBody, CelestialBodyInfo> cb = new KeyValuePair <CelestialBody, CelestialBodyInfo>(cbKey, Database.instance.CelestialBodies[cbKey]); ResearchBodiesController.instance.SetIndividualBodyDiscoveryLevel(cb); if (Database.instance.CelestialBodies[cbKey].researchState == 100 && ResearchAndDevelopment.Instance != null) { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00012", cbKey.displayName, Database.instance.RB_SettingsParms.ScienceReward.ToString()), 5f); //ResearchAndDevelopment.Instance.AddScience(Database.Instance.RB_SettingsParms.ScienceReward, TransactionReasons.None); ResearchAndDevelopment.Instance.AddScience(Database.instance.RB_SettingsParms.ScienceReward, TransactionReasons.None); } return(true); } else { return(false); } }
public static void StopResearchPlan(CelestialBody cb) { CelestialBody cbKey = Database.instance.ContainsBodiesKey(cb.bodyName); if (cbKey != null && Database.instance.CelestialBodies[cbKey].researchState >= 10) { if (Funding.Instance != null) { Funding.Instance.AddFunds(Database.instance.RB_SettingsParms.ResearchCost, TransactionReasons.Progression); } Database.instance.CelestialBodies[cbKey].researchState = 0; KeyValuePair <CelestialBody, CelestialBodyInfo> cbd = new KeyValuePair <CelestialBody, CelestialBodyInfo>(cbKey, Database.instance.CelestialBodies[cbKey]); ResearchBodiesController.instance.SetIndividualBodyDiscoveryLevel(cbd); } else { RSTLogWriter.Log(Locales.FmtLocaleString("#autoLOC_RBodies_00016", cb.displayName)); } }
//This is only called by the Startup Menu GUI to show ignored bodies based on the level passed in. public string GetIgnoredBodies(Level l) { Locales.setLocale(""); string _bodies = Locales.FmtLocaleString("#autoLOC_RBodies_00030") + " : "; //string _bodies = ""; List <CelestialBody> TempBodiesList = new List <CelestialBody>(); for (int i = 0; i < BodyList.Count; i++) { if (CelestialBodies[BodyList[i]].IgnoreData.GetLevel(l) && (BodyList[i].Radius > 100 || BodyList[i].name.Contains("TSTGalaxies"))) { TempBodiesList.Add(BodyList[i]); } } for (int i = 0; i < TempBodiesList.Count; i++) { _bodies += BodyList[i].displayName.LocalizeRemoveGender(); if (i < TempBodiesList.Count - 1) { _bodies += ", "; } } return(_bodies); }
private void DrawWindow(int id) { GUIContent closeContent = new GUIContent(Textures.BtnRedCross, "Close Window"); Rect closeRect = new Rect(windowRect.width - 75, 4, 25, 25); if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle)) { ResearchBodies_Observatory.SpaceCenterObservatory.DeActivateObservatory_SC_Facility(); return; } GUILayout.BeginVertical(); #region Top Half Screen //Screen Top Half Starts GUILayout.BeginHorizontal(); GUILayout.BeginArea(new Rect((Utilities.scaledScreenWidth / 2) - 380, 50, 760, 500)); GUILayout.BeginHorizontal(GUILayout.Width(750)); GUILayout.BeginVertical(); GUILayout.BeginVertical(); #region Wernher_Portrait Panel 1 InstructorscrollViewVector = GUILayout.BeginScrollView(InstructorscrollViewVector, GUILayout.Width(248), GUILayout.Height(186)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (Event.current.type == EventType.Repaint) { GUILayout.Box(instructor_Werner.Portrait, GUILayout.Width(128), GUILayout.Height(128)); } else { GUILayout.Box(string.Empty, GUILayout.Width(128), GUILayout.Height(128)); } GUILayout.Label(instructor_Werner.InstructorName, GUILayout.Width(198)); } else { GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00017"), GUILayout.Width(198), GUILayout.Height(128)); } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.BeginVertical(); #region BodyList Panel 2 scrollViewVector = GUILayout.BeginScrollView(scrollViewVector, GUILayout.Width(248), GUILayout.Height(300)); GUILayout.BeginVertical(); haveTrackedBodies = false; foreach (KeyValuePair <CelestialBody, CelestialBodyInfo> cb in Database.instance.CelestialBodies) { //if (cb.Value.isResearched && !cb.Value.ignore) if (cb.Value.isResearched) { if (GUILayout.Button(cb.Key.bodyDisplayName.LocalizeRemoveGender(), GUILayout.Width(215))) { if (selectedBody == cb.Key) { selectedBody = null; } else { selectedBody = cb.Key; } instructor_Werner.PlayOKEmote(); } if (!cb.Value.ignore) { haveTrackedBodies = true; } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.EndVertical(); GUILayout.BeginVertical(); #region Research Panel 3 ResearchscrollViewVector = GUILayout.BeginScrollView(ResearchscrollViewVector, GUILayout.Width(500), GUILayout.Height(485)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (selectedBody == null) { if (!haveTrackedBodies) { GUILayout.Label("<color=orange>" + Locales.FmtLocaleString("#autoLOC_RBodies_00001") + "</color>", GUILayout.Width(500)); } else { GUILayout.Label("<color=orange>" + Locales.FmtLocaleString("#autoLOC_RBodies_00001") + "</color>", GUILayout.Width(500)); //GUILayout } } else { GUILayout.BeginHorizontal(); GUILayout.Label("<b><size=24><color=orange>" + selectedBody.displayName.LocalizeRemoveGender() + "</color></size></b>", GUILayout.Width(150)); GUILayout.Label("<i>" + (French ? Database.instance.CelestialBodies[selectedBody].discoveryMessage : Localizer.Format("#autoLOC_RBodies_discovery_" + selectedBody.bodyName)) + "</i>", GUILayout.Width(300)); GUILayout.EndHorizontal(); if (selectedBody != Planetarium.fetch.Sun && selectedBody.referenceBody != null && selectedBody.bodyName != selectedBody.referenceBody.bodyName) { if (selectedBody.referenceBody != Planetarium.fetch.Sun) { GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00003", selectedBody.referenceBody.displayName.LocalizeRemoveGender()), GUILayout.Width(150)); } else { GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00004"), GUILayout.Width(150)); } } GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00005", Database.instance.CelestialBodies[selectedBody].researchState.ToString()), GUILayout.Width(480)); if (Database.instance.CelestialBodies[selectedBody].researchState == 0) { if ( GUILayout.Button("<color=#0ef907>" + Locales.FmtLocaleString("#autoLOC_RBodies_00006", selectedBody.displayName.LocalizeRemoveGender()) + "\n</color><size=10><i>(" + Locales.FmtLocaleString("#autoLOC_RBodies_00007", (Database.instance.RB_SettingsParms.ResearchCost + Database.instance.RB_SettingsParms.ProgressResearchCost).ToString() /* 10 */) + ")</i></size>", GUILayout.Width(480))) { LaunchResearchPlan(selectedBody); instructor_Werner.PlayNiceEmote(); } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 1) { if (!Database.instance.CelestialBodies[selectedBody].ignore) { if ( GUILayout.Button("<color=red>" + Locales.FmtLocaleString("#autoLOC_RBodies_00008", selectedBody.displayName.LocalizeRemoveGender()) + "\n</color><size=10><i>(" + Locales.FmtLocaleString("#autoLOC_RBodies_00009", Database.instance.RB_SettingsParms.ResearchCost.ToString() /* 5 */) + ")</i></size>", GUILayout.Width(480))) { StopResearchPlan(selectedBody); instructor_Werner.PlayBadEmote(); } } if (Database.instance.CelestialBodies[selectedBody].researchState < 40 && Database.instance.CelestialBodies[selectedBody].researchState >= 1) { if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX) { if (GUILayout.Button(Locales.FmtLocaleString("#autoLOC_RBodies_00010"), GUILayout.Width(480))) { instructor_Werner.PlayNiceEmote(); Research(selectedBody, 10); } } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 40 && Database.instance.CelestialBodies[selectedBody].researchState < 100) { GUILayout.Label("<i><color=#0ef907>" + Locales.FmtLocaleString("#autoLOC_RBodies_00010") + " ✓</color></i>", GUILayout.Width(480)); if (HighLogic.CurrentGame.Mode == Game.Modes.SANDBOX || HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX) { if (GUILayout.Button(Locales.FmtLocaleString("#autoLOC_RBodies_00011"), GUILayout.Width(480))) { instructor_Werner.PlayNiceEmote(); Research(selectedBody, 10); } } } else if (Database.instance.CelestialBodies[selectedBody].researchState >= 100) { GUILayout.Label("<i><color=#0ef907>" + Locales.FmtLocaleString("#autoLOC_RBodies_00010") + " ✓</color></i>", GUILayout.Width(480)); //new Rect(188, 227, 502, 32), GUILayout.Label("<i><color=#0ef907>" + Locales.FmtLocaleString("#autoLOC_RBodies_00011") + " ✓</color></i>", GUILayout.Width(480)); //new Rect(188, 264, 502, 32), GUILayout.Label("<b>" + Locales.FmtLocaleString("#autoLOC_RBodies_00013", selectedBody.displayName.LocalizeRemoveGender()) + "</b>", GUILayout.Width(480)); } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndHorizontal(); //Screen Top Half Ends. #endregion #region Bottom Half Screen if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER) { GUILayout.BeginHorizontal(); GUILayout.BeginArea(new Rect((Utilities.scaledScreenWidth / 2) - 380, 560, 760, 300)); GUILayout.BeginHorizontal(GUILayout.Width(700)); GUILayout.BeginVertical(); #region Linus_Portrait Panel 1 InstructorscrollViewVector = GUILayout.BeginScrollView(InstructorscrollViewVector, GUILayout.Width(248), GUILayout.Height(186)); GUILayout.BeginVertical(); if ((IsTSlevel1 && Database.instance.allowTSlevel1) || !IsTSlevel1) { if (Event.current.type == EventType.Repaint) { GUILayout.Box(instructor_Linus.Portrait, GUILayout.Width(128), GUILayout.Height(128)); } else { GUILayout.Box(string.Empty, GUILayout.Width(128), GUILayout.Height(128)); } GUILayout.Label(instructor_Linus.InstructorName, GUILayout.Width(178)); } else { GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00017"), GUILayout.Width(188), GUILayout.Height(128)); } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndVertical(); #region ContractsSection ContractsscrollViewVector = GUILayout.BeginScrollView(ResearchscrollViewVector, GUILayout.Width(500), GUILayout.Height(186)); GUILayout.BeginVertical(); GUILayout.Label("<b><size=24><color=orange>" + Locales.FmtLocaleString("#autoLOC_RBodies_00103") + "</color></size></b>", GUILayout.Width(350)); GUILayout.Label("<b>" + Locales.FmtLocaleString("#autoLOC_RBodies_00104") + "</b>", GUILayout.Width(350)); for (int i = 0; i < Contracts.ContractSystem.Instance.Contracts.Count; ++i) { Contract contract = Contracts.ContractSystem.Instance.Contracts[i]; if (contract.ContractState == Contract.State.Active) { ContractConfigurator.ConfiguredContract configuredContract = contract as ContractConfigurator.ConfiguredContract; if (configuredContract != null) { switch (configuredContract.subType) { case "RB_TeleScopeSearchSkies": case "RB_TelescopeResearchBody": case "RB_SearchSkies": case "RB_ResearchBody": //Display Contract GUILayout.Label(configuredContract.Title, GUILayout.Width(400)); ContractParameter parameter = configuredContract.GetParameter("Duration"); if (parameter != null) { GUILayout.Label("<color=#0ef907>" + parameter.Title + "</color>", GUILayout.Width(400)); } break; } } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); #endregion GUILayout.EndHorizontal(); GUILayout.EndArea(); GUILayout.EndHorizontal(); } #endregion GUILayout.EndVertical(); Utilities.SetTooltipText(); }
void DrawWindow(int windowID) { GUIContent closeContent = new GUIContent(Textures.BtnRedCross, Locales.FmtLocaleString("#autoLOC_RBodies_00050")); Rect closeRect = new Rect(windowRect.width - 21, 4, 16, 16); if (GUI.Button(closeRect, closeContent, Textures.ClosebtnStyle)) { showGUI = !showGUI; return; } GUILayout.BeginVertical(); scrollViewBodiesVector = GUILayout.BeginScrollView(scrollViewBodiesVector, GUILayout.MaxHeight(200f)); GUILayout.BeginVertical(); GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00024"), Textures.sectionTitleStyle); //#autoLOC_RBodies_00024 = Available Bodies foreach (var body in Database.instance.CelestialBodies) { if (body.Value.isResearched) { GUILayout.Label(body.Key.GetDisplayName().LocalizeRemoveGender() + " - " + body.Value.researchState.ToString("N0") + "%", Textures.PartListPartStyle); } } GUILayout.EndVertical(); GUILayout.EndScrollView(); scrollViewVector = GUILayout.BeginScrollView(scrollViewVector); GUILayout.BeginVertical(); GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00021", electricChargeRequest.ToString())); //#autoLOC_RBodies_00021 = Each use of the Telescope will use <<1>> Electric Charge if (GUILayout.Button(Locales.FmtLocaleString("#autoLOC_RBodies_00022"))) //#autoLOC_RBodies_00022 = Track Bodies { foundBody = false; withParent = false; foundBodyTooWeak = false; searchButtonDisplayTimer = Planetarium.GetUniversalTime(); searchButtonDisplay = true; nothing = Database.instance.NothingHere[random.Next(Database.instance.NothingHere.Count)]; BodiesInView.Clear(); //Check part dependency.. Unusual, But ok. if (requiresPart) { bool local = false; foreach (Part part in this.vessel.Parts) { if (part.name.Contains(requiredPart)) { local = true; } } if (!local) { canResearch = false; ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00020", requiredPart), 5.0f, ScreenMessageStyle.UPPER_CENTER); //#autoLOC_RBodies_00020 = The vessel must have a <<1>> part attached to it! } } if (canResearch) //Part check is OK { var totalElecreceived = Utilities.RequestResource(this.part, "ElectricCharge", electricChargeRequest); //get power if (totalElecreceived >= electricChargeRequest * 0.99) //If we got power { var randomMax = Database.instance.chances + difficulty; //Calculate the randomness (sic) and if we found something. This needs to be replaced with something better. var randomNum = random.Next(randomMax); if (randomNum == 1 || randomNum == 2) { //Scan the list of CB's and find anything in range? foreach (CelestialBody body in Database.instance.BodyList) { hostPos = this.part.transform.position; targetPos = body.transform.position; angle = Vector3.Angle(targetPos - hostPos, this.part.transform.up); distance = Vector3d.Distance(body.transform.position, this.vessel.transform.position); //Is it within the acceptable Angle? if (angle <= viewAngle) { //Is it within the maximum tracking distance of this part? if (distance <= maxTrackDistance) { if (!IsViewObstructed(this.part.transform, body.transform)) { BodiesInView.Add(body); //We got one! } } //Too far away. else { foundBodyTooWeak = true; } } } if (BodiesInView.Count > 0) //did we find anything? { //Remove any already researched. BodiesInViewResearched.Clear(); for (int i = BodiesInView.Count - 1; i >= 0; --i) { if (Database.instance.CelestialBodies[BodiesInView[i]].isResearched) { BodiesInViewResearched.Add(BodiesInView[i]); } } BodiesInViewResearched.ForEach(id => BodiesInView.Remove(id)); if (BodiesInView.Count > 0) //Do we still have any? If so: { bodyFound = BodiesInView[random.Next(BodiesInView.Count)]; //Randomly pick one. foundBody = true; ScreenMessages.PostScreenMessage(Localizer.Format("#autoLOC_RBodies_00051"), 15f); //#autoLOC_RBodies_00051 = Celestial Body Discovered! difficulty = startingdifficulty; //Reset the difficulty factor to the starting factor now that we found something. ResearchBodiesController.FoundBody(scienceReward, bodyFound, out withParent, out parentBody); } } } else { //We didn't find anything. Reduce the difficulty by one until we do. foundBody = false; if (randomMax > 2) { difficulty--; } } } else // There wasn't enough EC! { ScreenMessages.PostScreenMessage(Locales.FmtLocaleString("#autoLOC_RBodies_00048"), 5.0f, ScreenMessageStyle.UPPER_CENTER); //#autoLOC_RBodies_00048 = Not enough Electric Charge to operate the telescope. } } } //endif button //Populate RB GUI if found. if (searchButtonDisplay) { if (Planetarium.GetUniversalTime() - searchButtonDisplayTimer > 60) { searchButtonDisplayTimer = 0; searchButtonDisplay = false; } //Populate text box on discovery. if (foundBody) //Did we end up finding anything? { if (withParent) //And was a parent body also discovered? { GUILayout.Label(French ? Database.instance.CelestialBodies[bodyFound].discoveryMessage : Localizer.Format("#autoLOC_RBodies_discovery_" + bodyFound.bodyName)); GUILayout.Label(French ? Database.instance.CelestialBodies[parentBody].discoveryMessage : Localizer.Format("#autoLOC_RBodies_discovery_" + parentBody.bodyName)); } else { GUILayout.Label(French ? Database.instance.CelestialBodies[bodyFound].discoveryMessage : Localizer.Format("#autoLOC_RBodies_discovery_" + bodyFound.bodyName)); } } else //Nope, didn't find anything. { if (foundBodyTooWeak) //Was there something just out of telescope range? { GUILayout.Label(Locales.FmtLocaleString("#autoLOC_RBodies_00023"), HighLogic.Skin.label); //#autoLOC_RBodies_00023 = A faint signal has been detected but we need a more powerful Telescope. } else //Nope there was absolutely nothing to see here. { GUILayout.Label(Localizer.Format(nothing), HighLogic.Skin.label); } } } GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.EndVertical(); GUI.DragWindow(); }
public void OnGUI() { if (HighLogic.LoadedSceneIsFlight && !sceneChangeRequested) { if (showGUI && ResearchBodies.Enabled) { GUI.skin = HighLogic.Skin; windowRect.ClampToScreen(); windowRect = GUILayout.Window(_partwindowID, windowRect, DrawWindow, Locales.FmtLocaleString("#autoLOC_RBodies_00026")); } } }