Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
		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);
		}
Ejemplo n.º 3
0
		private void Start()
		{
			GameEvents.onVesselSOIChanged.Add(SOIChange);
			GameEvents.onVesselCreate.Add(newVesselCheck);
			GameEvents.onPartCouple.Add(dockingCheck);
			GameEvents.Contract.onContractsLoaded.Add(contractsCheck);
			if (HighLogic.LoadedSceneIsFlight)
			{
				if (!body_data.ContainsKey(FlightGlobals.currentMainBody.name))
					body_data.Add(FlightGlobals.currentMainBody.name, new SCANdata(FlightGlobals.currentMainBody));
				RenderingManager.AddToPostDrawQueue(5, drawTarget);
				try
				{
					mainMap = gameObject.AddComponent<SCANmainMap>();
					settingsWindow = gameObject.AddComponent<SCANsettingsUI>();
					instrumentsWindow = gameObject.AddComponent<SCANinstrumentUI>();
					colorManager = gameObject.AddComponent<SCANcolorSelection>();
					BigMap = gameObject.AddComponent<SCANBigMap>();
				}
				catch (Exception e)
				{
					SCANUtil.SCANlog("Something Went Wrong Initializing UI Objects: {0}", e);
				}
			}
			else if (HighLogic.LoadedSceneHasPlanetarium)
			{
				if (!body_data.ContainsKey(Planetarium.fetch.Home.name))
					body_data.Add(Planetarium.fetch.Home.name, new SCANdata(Planetarium.fetch.Home));
				try
				{
					kscMap = gameObject.AddComponent<SCANkscMap>();
					settingsWindow = gameObject.AddComponent<SCANsettingsUI>();
					colorManager = gameObject.AddComponent<SCANcolorSelection>();
				}
				catch (Exception e)
				{
					SCANUtil.SCANlog("Something Went Wrong Initializing UI Objects: {0}", e);
				}
			}
			if (useStockAppLauncher)
				appLauncher = gameObject.AddComponent<SCANappLauncher>();
		}