public void Start() { GameObject.DontDestroyOnLoad(this); GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady); GameEvents.onHideUI.Add(onHideUI); GameEvents.onShowUI.Add(onShowUI); Instance = this; overlayRenderer = gameObject.AddComponent <OverlayRenderer>(); overlayRenderer.SetGridLevel(KethaneData.GridLevel); var node = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Kethane/Grid.cfg"); if (node == null) { return; } foreach (var body in FlightGlobals.Bodies) { double result; if (double.TryParse(node.GetValue(body.name), out result)) { bodyRadii[body] = result; } } }
public void Start() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; overlayRenderer = gameObject.AddComponent <OverlayRenderer>(); overlayRenderer.SetGridLevel(KethaneData.GridLevel); if (button == null) { var tex = GameDatabase.Instance.GetTexture("Kethane/toolbar", false); button = ApplicationLauncher.Instance.AddModApplication(null, null, null, null, null, null, ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.TRACKSTATION, tex); } var node = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Kethane/Grid.cfg"); if (node == null) { return; } foreach (var body in FlightGlobals.Bodies) { double result; if (double.TryParse(node.GetValue(body.name), out result)) { bodyRadii[body] = result; } } }
private bool startMenuOverlay(OverlayRenderer overlayRenderer) { if (!Misc.Parse(SettingsManager.GetValue("ShowInMenu"), true)) { return(false); } var objects = GameObject.FindObjectsOfType(typeof(GameObject)); if (objects.Any(o => o.name == "LoadingBuffer")) { return(false); } var kerbin = objects.OfType <GameObject>().Where(b => b.name == "Kerbin").LastOrDefault(); if (kerbin == null) { Debug.LogWarning("[Kethane] Couldn't find Kerbin!"); return(false); } overlayRenderer.SetTarget(kerbin.transform); overlayRenderer.SetRadiusMultiplier(1.02f); var random = new System.Random(); var colors = new CellMap <Color32>(KethaneData.GridLevel); foreach (var cell in Cell.AtLevel(KethaneData.GridLevel)) { var rand = random.Next(100); Color32 color; if (rand < 16) { color = rand < 4 ? new Color32(21, 176, 26, 255) : new Color32(128, 128, 128, 192); foreach (var neighbor in cell.GetNeighbors(KethaneData.GridLevel)) { if (random.Next(2) < 1) { colors[neighbor] = color; } } } else { color = new Color32(0, 0, 0, 128); } colors[cell] = color; } overlayRenderer.SetCellColors(colors); return(true); }
private bool startMenuOverlay(OverlayRenderer overlayRenderer) { if (!Misc.Parse(SettingsManager.GetValue("ShowInMenu"), true)) { return false; } var objects = GameObject.FindObjectsOfType(typeof(GameObject)); if (objects.Any(o => o.name == "LoadingBuffer")) { return false; } var kerbin = objects.OfType<GameObject>().Where(b => b.name == "Kerbin").LastOrDefault(); if (kerbin == null) { Debug.LogWarning("[Kethane] Couldn't find Kerbin!"); return false; } overlayRenderer.SetTarget(kerbin.transform); overlayRenderer.SetRadiusMultiplier(1.02f); var random = new System.Random(); var colors = new CellMap<Color32>(KethaneData.GridLevel); foreach (var cell in Cell.AtLevel(KethaneData.GridLevel)) { var rand = random.Next(100); Color32 color; if (rand < 16) { color = rand < 4 ? new Color32(21, 176, 26, 255) : new Color32(128, 128, 128, 192); foreach (var neighbor in cell.GetNeighbors(KethaneData.GridLevel)) { if (random.Next(2) < 1) { colors[neighbor] = color; } } } else { color = new Color32(0, 0, 0, 128); } colors[cell] = color; } overlayRenderer.SetCellColors(colors); return true; }
public void Start() { if (Instance != null) { Destroy(Instance.gameObject); } Instance = this; overlayRenderer = gameObject.AddComponent<OverlayRenderer>(); overlayRenderer.SetGridLevel(KethaneData.GridLevel); if (button == null) { var tex = GameDatabase.Instance.GetTexture("Kethane/toolbar", false); button = ApplicationLauncher.Instance.AddModApplication(null, null, null, null, null, null, ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.TRACKSTATION, tex); } var node = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Kethane/Grid.cfg"); if (node == null) { return; } foreach (var body in FlightGlobals.Bodies) { double result; if (double.TryParse(node.GetValue(body.name), out result)) { bodyRadii[body] = result; } } }
public void Start() { GameObject.DontDestroyOnLoad(this); GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady); GameEvents.onHideUI.Add (onHideUI); GameEvents.onShowUI.Add (onShowUI); Instance = this; overlayRenderer = gameObject.AddComponent<OverlayRenderer>(); overlayRenderer.SetGridLevel(KethaneData.GridLevel); var node = ConfigNode.Load(KSPUtil.ApplicationRootPath + "GameData/Kethane/Grid.cfg"); if (node == null) { return; } foreach (var body in FlightGlobals.Bodies) { double result; if (double.TryParse(node.GetValue(body.name), out result)) { bodyRadii[body] = result; } } }