protected override void OnCompleted() { List <CelestialBody> PotentialDiscovery = new List <CelestialBody>(); foreach (CelestialBody body in Database.instance.BodyList) { if (!Database.instance.CelestialBodies[body].isResearched && RBRange.WithinObsRange(body.transform)) { PotentialDiscovery.Add(body); } } if (PotentialDiscovery.Count > 0) { int discovered = Random.Range(0, PotentialDiscovery.Count - 1); bool withParent; CelestialBody parentBody; ResearchBodiesController.FoundBody(Database.instance.RB_SettingsParms.ScienceReward, PotentialDiscovery[discovered], out withParent, out parentBody); return; } Vector2 anchormin = new Vector2(0.5f, 0.5f); Vector2 anchormax = new Vector2(0.5f, 0.5f); string msg = "Despite our best efforts, we were unable to find anything intersting in the sky."; string title = "Research Bodies"; UISkinDef skin = HighLogic.UISkin; DialogGUIBase[] dialogGUIBase = new DialogGUIBase[1]; dialogGUIBase[0] = new DialogGUIButton("Ok", delegate { }); PopupDialog.SpawnPopupDialog(anchormin, anchormax, new MultiOptionDialog(title, msg, title, skin, dialogGUIBase), false, HighLogic.UISkin, true, string.Empty); }
protected override void OnCompleted() { foreach (CelestialBody body in Database.instance.BodyList) { if (Database.instance.CelestialBodies[body].isResearched && Database.instance.CelestialBodies[body].researchState < 100) { if (RBRange.WithinObsRange(body.transform)) { ResearchBodiesController.Research(body, 10); return; } } } Vector2 anchormin = new Vector2(0.5f, 0.5f); Vector2 anchormax = new Vector2(0.5f, 0.5f); string msg = "Despite our best efforts, we were unable to find anything new that's interesting in the sky."; string title = "Research Bodies"; UISkinDef skin = HighLogic.UISkin; DialogGUIBase[] dialogGUIBase = new DialogGUIBase[1]; dialogGUIBase[0] = new DialogGUIButton("Ok", delegate { }); PopupDialog.SpawnPopupDialog(anchormin, anchormax, new MultiOptionDialog(title, msg, title, skin, dialogGUIBase), false, HighLogic.UISkin, true, string.Empty); }
public override bool RequirementMet(ConfiguredContract contract) { foreach (CelestialBody body in Database.instance.BodyList) { if (Database.instance.CelestialBodies[body].isResearched && Database.instance.CelestialBodies[body].researchState < 100) { if (host == "Observatory") { if (RBRange.WithinObsRange(body.transform)) { return(true); } } else { if (FlightGlobals.fetch != null) { for (int i = 0; i < FlightGlobals.Vessels.Count; i++) { double range = 0; if (RBRange.VesselHasModuleTrackBodies(FlightGlobals.Vessels[i], out range)) { if (RBRange.WithinVslRange(FlightGlobals.Vessels[i], body.transform)) { return(true); } } } } } } } return(false); }