internal static Palette paletteLoader(string name, int size) { if (name == "Default" || string.IsNullOrEmpty(name)) { return(PaletteLoader.defaultPalette); } else { try { if (name == "blackForest" || name == "departure" || name == "northRhine" || name == "mars" || name == "wiki2" || name == "plumbago" || name == "cw1_013" || name == "arctic") { //Load the fixed size color palette by name through reflection var fixedPallete = typeof(FixedColorPalettes); var fPaletteMethod = fixedPallete.GetMethod(name); var fColorP = fPaletteMethod.Invoke(null, null); return((Palette)fColorP); } else { //Load the ColorBrewer method by name through reflection var brewer = typeof(BrewerPalettes); var bPaletteMethod = brewer.GetMethod(name); var bColorP = bPaletteMethod.Invoke(null, new object[] { size }); return((Palette)bColorP); } } catch (Exception e) { SCANUtil.SCANlog("Error Loading Color Palette; Revert To Default: {0}", e); return(PaletteLoader.defaultPalette); } } }
internal static FlightBand FinePrintFlightBandValue(SurveyWaypointParameter p) { FlightBand b = FlightBand.NONE; try { b = (FlightBand)_FinePrintFlightBand.GetValue(p); } catch (Exception e) { SCANUtil.SCANlog("Error in detecting FinePrint FlightBand object: {0}", e); } return(b); }
internal static Waypoint FinePrintStationaryWaypointObject(StationaryPointParameter p) { Waypoint w = null; try { w = (Waypoint)_FinePrintStationaryWaypoint.GetValue(p); } catch (Exception e) { SCANUtil.SCANlog("Error in detecting FinePrint Stationary Waypoint object: {0}", e); } return(w); }
public override void OnEncodeToConfigNode() { SCANUtil.SCANlog("Saving SCANsat configuration file..."); SCANUtil.SCANlog("SCANcolors.cfg saved to ---> {0}", FilePath); SCANsat_Altimetry = SCANcontroller.EncodeTerrainConfigs; SCANsat_Resources = SCANcontroller.EncodeResourceConfigs; if (SCANcontroller.controller != null) { lowBiomeColor = SCANcontroller.controller.lowBiomeColor; highBiomeColor = SCANcontroller.controller.highBiomeColor; biomeTransparency = SCANcontroller.controller.biomeTransparency; bottomLowSlopeColor = SCANcontroller.controller.lowSlopeColorOne; bottemHighSlopeColor = SCANcontroller.controller.highSlopeColorOne; topLowSlopeColor = SCANcontroller.controller.lowSlopeColorTwo; topHighSlopeColor = SCANcontroller.controller.highSlopeColorTwo; } }
internal static bool FinePrintWaypointReflection() { if (_FinePrintWaypoint != null) { return(true); } if (FinePrintWaypointRun) { return(false); } FinePrintWaypointRun = true; try { Type sType = typeof(SurveyWaypointParameter); var field = sType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); _FinePrintWaypoint = field[0]; if (_FinePrintWaypoint == null) { SCANUtil.SCANlog("FinePrint Waypoint Field Not Found"); return(false); } SCANUtil.SCANlog("FinePrint Waypoint Field Assigned"); return(_FinePrintWaypoint != null); } catch (Exception e) { SCANUtil.SCANlog("Error in assigning FinePrint Waypoint method: {0}", e); } return(false); }
private ScienceData getAvailableScience(SCANtype sensor, bool notZero) { SCANdata data = SCANUtil.getData(vessel.mainBody); if (data == null) { return(null); } ScienceData sd = null; ScienceExperiment se = null; ScienceSubject su = null; bool found = false; string id = null; double coverage = 0f; float multiplier = 1f; if (!found && (sensor & SCANtype.AltimetryLoRes) != SCANtype.Nothing) { found = true; if (vessel.mainBody.pqsController == null) { multiplier = 0.5f; } id = "SCANsatAltimetryLoRes"; coverage = SCANUtil.getCoveragePercentage(data, SCANtype.AltimetryLoRes); } else if (!found && (sensor & SCANtype.AltimetryHiRes) != SCANtype.Nothing) { found = true; if (vessel.mainBody.pqsController == null) { multiplier = 0.5f; } id = "SCANsatAltimetryHiRes"; coverage = SCANUtil.getCoveragePercentage(data, SCANtype.AltimetryHiRes); } else if (!found && (sensor & SCANtype.Biome) != SCANtype.Nothing) { found = true; if (vessel.mainBody.BiomeMap == null) { multiplier = 0.5f; } id = "SCANsatBiomeAnomaly"; coverage = SCANUtil.getCoveragePercentage(data, SCANtype.Biome); } if (!found) { return(null); } se = ResearchAndDevelopment.GetExperiment(id); if (se == null) { return(null); } su = ResearchAndDevelopment.GetExperimentSubject(se, ExperimentSituations.InSpaceHigh, vessel.mainBody, "surface"); if (su == null) { return(null); } su.scienceCap *= multiplier; SCANUtil.SCANlog("Coverage: {0}, Science cap: {1}, Subject value: {2}, Scientific value: {3}, Science: {4}", new object[5] { coverage.ToString("F1"), su.scienceCap.ToString("F1"), su.subjectValue.ToString("F2"), su.scientificValue.ToString("F2"), su.science.ToString("F2") }); su.scientificValue = 1; float science = (float)coverage; if (science > 95) { science = 100; } if (science < 30) { science = 0; } science = science / 100f; science = Mathf.Max(0, (science * su.scienceCap) - su.science); SCANUtil.SCANlog("Remaining science: {0}, Base value: {1}", new object[2] { science.ToString("F1"), se.baseValue.ToString("F1") }); science /= Mathf.Max(0.1f, su.scientificValue); //look 10 lines up; this is always 1... science /= su.subjectValue; SCANUtil.SCANlog("Resulting science value: {0}", new object[1] { science.ToString("F2") }); if (notZero && science <= 0) { science = 0.00001f; } sd = new ScienceData(science * su.dataScale, 1f, 0f, su.id, se.experimentTitle + " of " + vessel.mainBody.theName); su.title = sd.title; return(sd); }