//Draw the window tab options private void windowTabs(int id) { growE(); if (GUILayout.Button("Altimetry")) { windowMode = 0; currentTerrain = new SCANterrainConfig(data.TerrainConfig); bodyIndex = data.Body.flightGlobalsIndex; updateUI(); } if (GUILayout.Button("Slope")) { windowMode = 1; } if (GUILayout.Button("Biome")) { windowMode = 2; } if (SCANconfigLoader.GlobalResource) { if (GUILayout.Button("Resources")) { windowMode = 3; fineControlMode = oldFineControl = false; currentResource.CurrentBodyConfig(data.Body.name); bodyIndex = data.Body.flightGlobalsIndex; updateUI(); } } stopE(); }
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); }
protected override void DrawWindowPre(int id) { //Some clumsy logic is used here to ensure that the color selection fields always remain in sync with the current map in each scene if (HighLogic.LoadedSceneIsFlight) { if (data == null) { data = SCANUtil.getData(FlightGlobals.currentMainBody); if (data == null) { data = new SCANdata(FlightGlobals.currentMainBody); SCANcontroller.controller.addToBodyData(FlightGlobals.currentMainBody, data); } } if (bigMapObj.Visible && SCANBigMap.BigMap != null) { data = bigMapObj.Data; bigMap = SCANBigMap.BigMap; } else if (data.Body != FlightGlobals.currentMainBody) { data = SCANUtil.getData(FlightGlobals.currentMainBody); if (data == null) { data = new SCANdata(FlightGlobals.currentMainBody); SCANcontroller.controller.addToBodyData(FlightGlobals.currentMainBody, data); } } if (bigMap == null) { if (SCANBigMap.BigMap != null) { bigMap = SCANBigMap.BigMap; } } } //Lock space center click through - Sync SCANdata else if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { 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); } } if (kscMapObj.Visible) { data = kscMapObj.Data; bigMap = SCANkscMap.BigMap; } else if (data.Body != Planetarium.fetch.Home) { data = SCANUtil.getData(Planetarium.fetch.Home); if (data == null) { data = new SCANdata(Planetarium.fetch.Home); SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data); } } if (bigMap == null) { if (SCANkscMap.BigMap != null) { bigMap = SCANkscMap.BigMap; } } Vector2 mousePos = Input.mousePosition; mousePos.y = Screen.height - mousePos.y; if (WindowRect.Contains(mousePos) && !controlLock) { InputLockManager.SetControlLock(ControlTypes.CAMERACONTROLS | ControlTypes.KSC_ALL, lockID); controlLock = true; } else if (!WindowRect.Contains(mousePos) && controlLock) { removeControlLocks(); } } //Lock tracking scene click through - Sync SCANdata else if (HighLogic.LoadedScene == GameScenes.TRACKSTATION) { 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); } } if (kscMapObj.Visible) { data = kscMapObj.Data; bigMap = SCANkscMap.BigMap; } else if (data.Body != Planetarium.fetch.Home) { data = SCANUtil.getData(Planetarium.fetch.Home); if (data == null) { data = new SCANdata(Planetarium.fetch.Home); SCANcontroller.controller.addToBodyData(Planetarium.fetch.Home, data); } } if (bigMap == null) { if (SCANkscMap.BigMap != null) { bigMap = SCANkscMap.BigMap; } } Vector2 mousePos = Input.mousePosition; mousePos.y = Screen.height - mousePos.y; if (WindowRect.Contains(mousePos) && !controlLock) { InputLockManager.SetControlLock(ControlTypes.TRACKINGSTATION_UI, lockID); controlLock = true; } else if (!WindowRect.Contains(mousePos) && controlLock) { removeControlLocks(); } } //This updates all of the fields whenever the palette selection is changed if (windowMode == 0 && (currentLegend == null || bodyIndex != data.Body.flightGlobalsIndex)) { currentTerrain = new SCANterrainConfig(data.TerrainConfig); SCANUtil.SCANdebugLog("Trigger Body Change"); bodyIndex = data.Body.flightGlobalsIndex; currentTerrain = new SCANterrainConfig(data.TerrainConfig); updateUI(); } if (windowMode == 0 && previewLegend == null) { drawPreviewLegend(); } if (!dropDown) { paletteBox = false; resourceBox = false; saveWarning = false; } }