private IEnumerator<YieldInstruction> LoadBodies() { ConfigNode settings = ConfigNode.Load(KRESUtils.DataURL); double max = FlightGlobals.Bodies.Count; double current = -1d; System.Random random = new System.Random(); foreach (CelestialBody planet in FlightGlobals.Bodies) { current++; loadPercent = current / max; ResourceBody body = new ResourceBody(planet.bodyName); var b = body.LoadItems(settings.GetNode("KRES"), random); while (b.MoveNext()) { yield return b.Current; } ResourceController.Instance.ResourceBodies.Add(body); } settings.Save(KRESUtils.DataURL); loadPercent = 1d; loaded = true; DebugWindow.Instance.Print("- Loaded Resources -"); }
private void LoadData() { body = ResourceController.Instance.GetCurrentBody(); print(body.Name); items.Clear(); items.AddRange(body.GetItemsOfType(scannerType)); print(String.Join(", ", items.Select(i => i.Name).ToArray())); DataBody data = ResourceController.Instance.GetDataBody(this); print(data.Name + " " + data.CurrentError); this.currentError = data.CurrentError; }