public IEnumerator GetInitialValues() { Request request = new Request("http://67.207.90.121:3000/stats/planets?fields=pl_rade,pl_ratdor,pl_orbsmax,pl_masse"); Client http = new Client(); yield return(http.Send(request)); if (http.IsSuccessful()) { Response resp = http.Response(); startScreen.SetActive(true); PlanetStatsResponse res = JsonUtility.FromJson <PlanetStatsResponse>(resp.Body()); Constants.dataMinSize = res.pl_rade.min; Constants.dataMaxSize = res.pl_rade.max95; Constants.dataMinDistance = res.pl_orbsmax.min; Constants.dataMaxDIstance = res.pl_orbsmax.max95; Constants.dataMinMass = res.pl_masse.min; Constants.dataMaxMass = res.pl_masse.max95; } Request request2 = new Request("http://67.207.90.121:3000/stats/stars"); Client http2 = new Client(); yield return(http2.Send(request2)); if (http2.IsSuccessful()) { Response resp = http2.Response(); startScreen.SetActive(true); StarStatsResponse res = JsonUtility.FromJson <StarStatsResponse>(resp.Body()); starConfig.SetMinMaxValues(res); } }
public void SetMinMaxValues(StarStatsResponse res) { ageSlider.minValue = res.st_age.min; ageSlider.maxValue = res.st_age.max; massSlider.minValue = res.st_mass.min; massSlider.maxValue = res.st_mass.max; temperatureSlider.minValue = res.st_teff.min; temperatureSlider.maxValue = res.st_teff.max; radiusSlider.minValue = res.st_rad.min; radiusSlider.maxValue = res.st_rad.max; }