protected override void Start() { Visible = SCANcontroller.controller.kscMapVisible; if (b == null) { b = Planetarium.fetch.Home; } if (bigmap == null) { bigmap = new SCANmap(b, true); bigmap.setProjection((MapProjection)SCANcontroller.controller.projection); bigmap.setWidth(720); } currentColor = SCANcontroller.controller.colours == 0; lastColor = currentColor; lastResource = SCANcontroller.controller.map_ResourceOverlay; WindowCaption = string.Format("Map of {0}", b.theName); data = SCANUtil.getData(b); if (data == null) { data = new SCANdata(b); SCANcontroller.controller.addToBodyData(b, data); } bigmap.setBody(b); if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); } TooltipsEnabled = SCANcontroller.controller.toolTips; }
public override void OnDecodeFromConfigNode() { resourceType = SCANcontroller.getResourceType(name); sType = resourceType.Type; setDefaultValues(); try { masterBodyConfigs = Resource_Planetary_Config.ToDictionary(a => a.BodyName, a => a); } catch (Exception e) { SCANUtil.SCANlog("Error while loading SCANsat body resource config settings: {0}", e); } }
public void resetMap(bool setRes = true) { mapstep = 0; if (SCANconfigLoader.GlobalResource && setRes) { //Make sure that a resource is initialized if necessary if (resource == null && body != null) { resource = SCANcontroller.getResourceNode(SCANcontroller.controller.resourceSelection); if (resource == null) { resource = SCANcontroller.GetFirstResource; } resource.CurrentBodyConfig(body.name); } } }
private double[] mapline; // all refs are below /* MAP: nearly trivial functions */ public void setBody(CelestialBody b) { if (body == b) { return; } body = b; if (SCANconfigLoader.GlobalResource) { resource = SCANcontroller.getResourceNode(SCANcontroller.controller.resourceSelection); if (resource == null) { resource = SCANcontroller.GetFirstResource; } resource.CurrentBodyConfig(body.name); } }
/* MAP: constructor */ internal SCANdata(CelestialBody b) { body = b; float?clamp = null; if (b.ocean) { clamp = 0; } terrainConfig = SCANcontroller.getTerrainNode(b.name); if (terrainConfig == null) { terrainConfig = new SCANterrainConfig(SCANconfigLoader.SCANNode.DefaultMinHeightRange, SCANconfigLoader.SCANNode.DefaultMaxHeightRange, clamp, SCANUtil.paletteLoader(SCANconfigLoader.SCANNode.DefaultPalette, 7), 7, false, false, body); SCANcontroller.addToTerrainConfigData(body.name, terrainConfig); } }
protected override void Start() { //Initialize the map object Visible = SCANcontroller.controller.bigMapVisible; if (v == null) { v = FlightGlobals.ActiveVessel; } if (b == null) { b = v.mainBody; } if (bigmap == null) { bigmap = new SCANmap(b, true); bigmap.setProjection((MapProjection)SCANcontroller.controller.projection); bigmap.setWidth(SCANcontroller.controller.map_width); } WindowRect.x = SCANcontroller.controller.map_x; WindowRect.y = SCANcontroller.controller.map_y; currentColor = SCANcontroller.controller.colours == 0; lastColor = currentColor; lastResource = SCANcontroller.controller.map_ResourceOverlay; WindowCaption = string.Format("Map of {0}", b.theName); data = SCANUtil.getData(b); if (data == null) { data = new SCANdata(b); SCANcontroller.controller.addToBodyData(b, data); } bigmap.setBody(b); if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); } TooltipsEnabled = SCANcontroller.controller.toolTips; }
internal List <SCANresourceGlobal> GetLoadedResourceList() { return(SCANcontroller.setLoadedResourceList()); }
private void resourceConfirm(int id) { fillS(10); growE(); if (!dropDown) { if (GUILayout.Button("Apply Values", GUILayout.Width(110))) { currentResource.MinColor = resourceColorPicker.ColorLow; currentResource.MaxColor = resourceColorPicker.ColorHigh; SCANcontroller.updateSCANresource(currentResource, false); updateUI(); if (bigMap != null && SCANcontroller.controller.map_ResourceOverlay) { bigMap.resetMap(); } } fillS(6); if (GUILayout.Button("Apply To All Planets", GUILayout.Width(200))) { for (int i = 0; i < currentResource.getBodyCount; i++) { SCANresourceBody r = currentResource.getBodyConfig(i); if (r != null) { r.MinValue = lowRCutoff; r.MaxValue = highRCutoff; } } currentResource.MinColor = resourceColorPicker.ColorLow; currentResource.MaxColor = resourceColorPicker.ColorHigh; SCANcontroller.updateSCANresource(currentResource, true); updateUI(); if (bigMap != null && SCANcontroller.controller.map_ResourceOverlay) { bigMap.resetMap(); } } } else { GUILayout.Label("Apply Values", SCANskins.SCAN_button, GUILayout.Width(110)); fillS(6); GUILayout.Label("Apply To All Planets", SCANskins.SCAN_button, GUILayout.Width(200)); } stopE(); fillS(8); growE(); if (!dropDown) { if (GUILayout.Button("Default Values", GUILayout.Width(110))) { currentResource.CurrentBody.MinValue = currentResource.CurrentBody.DefaultMinValue; currentResource.CurrentBody.MaxValue = currentResource.CurrentBody.DefaultMaxValue; currentResource.MinColor = currentResource.DefaultLowColor; currentResource.MaxColor = currentResource.DefaultHighColor; currentResource.Transparency = currentResource.DefaultTrans; SCANcontroller.updateSCANresource(currentResource, false); updateUI(); if (bigMap != null && SCANcontroller.controller.map_ResourceOverlay) { bigMap.resetMap(); } } fillS(6); if (GUILayout.Button("Default Values For All Planets", GUILayout.Width(200))) { currentResource.MinColor = currentResource.DefaultLowColor; currentResource.MaxColor = currentResource.DefaultHighColor; currentResource.Transparency = currentResource.DefaultTrans; for (int i = 0; i < currentResource.getBodyCount; i++) { SCANresourceBody r = currentResource.getBodyConfig(i); if (r != null) { r.MinValue = r.DefaultMinValue; r.MaxValue = r.DefaultMaxValue; } } SCANcontroller.updateSCANresource(currentResource, true); updateUI(); if (bigMap != null && SCANcontroller.controller.map_ResourceOverlay) { bigMap.resetMap(); } } } else { GUILayout.Label("Default Values", SCANskins.SCAN_button, GUILayout.Width(110)); fillS(6); GUILayout.Label("Default Values For All Planets", SCANskins.SCAN_button, GUILayout.Width(200)); } stopE(); fillS(8); if (!dropDown) { if (GUILayout.Button("Save Values To Config", GUILayout.Width(180))) { dropDown = true; saveWarning = true; } } else { GUILayout.Label("Save Values To Config", SCANskins.SCAN_button, GUILayout.Width(180)); } }
protected override void Start() { if (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.TRACKSTATION) { kscMapObj = (SCANkscMap)SCANcontroller.controller.kscMap; if (SCANkscMap.BigMap != null) { bigMap = SCANkscMap.BigMap; } if (kscMapObj.Data != null) { data = kscMapObj.Data; } } else if (HighLogic.LoadedSceneIsFlight) { bigMapObj = (SCANBigMap)SCANcontroller.controller.BigMap; if (SCANBigMap.BigMap != null) { bigMap = SCANBigMap.BigMap; } if (bigMapObj.Data != null) { data = bigMapObj.Data; } } if (data == null) { data = SCANUtil.getData(Planetarium.fetch.Home); if (data == null) { data = new SCANdata(Planetarium.fetch.Home); SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data); } } currentTerrain = new SCANterrainConfig(data.TerrainConfig); stockBiomes = SCANcontroller.controller.useStockBiomes; minTerrainSlider = new SCANuiSlider(data.TerrainConfig.DefaultMinHeight - SCANconfigLoader.SCANNode.RangeBelowMinHeight, data.TerrainConfig.MaxTerrain - 100, data.TerrainConfig.MinTerrain, "Min: ", "m", -2); maxTerrainSlider = new SCANuiSlider(data.TerrainConfig.MinTerrain + 100, data.TerrainConfig.DefaultMaxHeight + SCANconfigLoader.SCANNode.RangeAboveMaxHeight, data.TerrainConfig.MaxTerrain, "Max: ", "m", -2); clampTerrainSlider = new SCANuiSlider(data.TerrainConfig.MinTerrain + 10, data.TerrainConfig.MaxTerrain - 10, data.TerrainConfig.ClampTerrain ?? data.TerrainConfig.MinTerrain + 10, "Clamp: ", "m", -1); paletteSizeSlider = new SCANuiSlider(3, 12, data.TerrainConfig.PalSize, "Palette Size: ", "", 0); slopeColorPickerLow = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorOne, SCANcontroller.controller.highSlopeColorOne, true); slopeColorPickerHigh = new SCANuiColorPicker(SCANcontroller.controller.lowSlopeColorTwo, SCANcontroller.controller.highSlopeColorTwo, true); slopeColorPickerLow.updateOldSwatches(); slopeColorPickerHigh.updateOldSwatches(); bTrans = SCANcontroller.controller.biomeTransparency; biomeTransSlider = new SCANuiSlider(0, 80, bTrans, "Ter. Trans: ", "%", 0); biomeColorPicker = new SCANuiColorPicker(SCANcontroller.controller.lowBiomeColor, SCANcontroller.controller.highBiomeColor, true); biomeColorPicker.updateOldSwatches(); if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); currentResource = new SCANresourceGlobal(loadedResources[0]); currentResource.CurrentBodyConfig(data.Body.name); if (currentResource != null) { resourceMinSlider = new SCANuiSlider(0, currentResource.CurrentBody.MinValue - 0.1f, currentResource.CurrentBody.MinValue, "Min: ", "%", 1); resourceMaxSlider = new SCANuiSlider(currentResource.CurrentBody.MinValue + 0.1f, 100, currentResource.CurrentBody.MaxValue, "Max: ", "%", 1); resourceTransSlider = new SCANuiSlider(0, 80, currentResource.Transparency, "Trans: ", "%", 0); resourceColorPicker = new SCANuiColorPicker(currentResource.MinColor, currentResource.MaxColor, true); } } bodyIndex = data.Body.flightGlobalsIndex; if (windowMode > 3 || (windowMode > 2 && !SCANconfigLoader.GlobalResource)) { windowMode = 0; } setSizeSlider(currentTerrain.ColorPal.kind); }
//Buttons to apply the new palette or cancel and return to the original private void paletteConfirmation(int id) { growS(); fillS(6); growE(); if (!dropDown) { if (GUILayout.Button("Apply Values", GUILayout.Width(110))) { SCANcontroller.updateTerrainConfig(currentTerrain); updateUI(); if (bigMap != null) { if (bigMap.MType == mapType.Altimetry && SCANcontroller.controller.colours == 0) { bigMap.resetMap(); } } } fillS(6); if (GUILayout.Button("Default Values", GUILayout.Width(110))) { currentTerrain.MinTerrain = data.TerrainConfig.DefaultMinHeight; currentTerrain.MaxTerrain = data.TerrainConfig.DefaultMaxHeight; currentTerrain.ClampTerrain = data.TerrainConfig.DefaultClampHeight; currentTerrain.ColorPal = data.TerrainConfig.DefaultPalette; currentTerrain.PalRev = data.TerrainConfig.DefaultReverse; currentTerrain.PalDis = data.TerrainConfig.DefaultDiscrete; currentTerrain.PalSize = data.TerrainConfig.DefaultPaletteSize; updateUI(); if (bigMap != null) { if (bigMap.MType == mapType.Altimetry && SCANcontroller.controller.colours == 0) { bigMap.resetMap(); } } } } else { GUILayout.Label("Apply Values", SCANskins.SCAN_button, GUILayout.Width(110)); fillS(6); GUILayout.Label("Default Values", SCANskins.SCAN_button, GUILayout.Width(110)); } stopE(); fillS(8); if (!dropDown) { if (GUILayout.Button("Save Values To Config", GUILayout.Width(180))) { dropDown = true; saveWarning = true; } } else { GUILayout.Label("Save Values To Config", SCANskins.SCAN_button, GUILayout.Width(180)); } stopS(); }