public void FieldValueChanged(InputField inField, SliderID id) { if (!String.IsNullOrEmpty(inField.text)) { int value = Int32.Parse(inField.text); UpdateValue(value, id); } }
private void UpdateValue(int value, SliderID id) { switch (id) { case SliderID.X: CurrentX = value; UpdateMaxValues(); break; case SliderID.Y: CurrentY = value; UpdateMaxValues(); break; case SliderID.Spawn: SpawnSize = value; break; case SliderID.Tree: AmountOfTrees = value; break; case SliderID.TreeSize: TreeSpawnSize = value; break; case SliderID.Water: AmountOfWater = value; break; case SliderID.WaterSize: WaterSpawnSize = value; break; case SliderID.Rock: AmountOfRock = value; break; case SliderID.RockSize: RockSpawnSize = value; break; case SliderID.Iron: AmountOfIron = value; break; case SliderID.IronSize: IronSpawnSize = value; break; default: break; } }
public void SliderValueChanged(Slider changedSlider, SliderID id) { UpdateValue((int)changedSlider.value, id); }
// Handles all 'Slider' changes // ------------------------------------------------------------------------------ void SliderHandler(int id, Slider slider) { string debugMsg = ("Slider value = " + slider.value); debug.Log(debugMsg); SliderID sliderID = (SliderID)id; // Back Light Slider if (sliderID == SliderID.backLight) { GetLightComponent(Child.backLight).intensity = slider.value; return; } // Fill Light Slider if (sliderID == SliderID.fillLight) { GetLightComponent(Child.fillLight).intensity = slider.value; return; } // Key Light Slider if (sliderID == SliderID.keyLight) { GetLightComponent(Child.keyLight).intensity = slider.value; return; } // Roof Light Slider if (sliderID == SliderID.roofLight) { GetLightComponent(Child.roofLight).intensity = slider.value; return; } // Led Intensity Slider if (sliderID == SliderID.ledIntensity) { // Set leds intensity LedLights.LEDLIGHTS.SetIntensity(slider.value, "leds"); // Set halos intensity LedLights.LEDLIGHTS.SetIntensity(slider.value / 150, "halos"); // Adjust value to match halo intensity // Set halos range int halo_range = (int)slider.value; if (halo_range > 15) { halo_range = 15; } else if (halo_range < 10) { halo_range = 10; } LedLights.LEDLIGHTS.SetRange(halo_range, "halos"); return; } }