public void Start() { projectManager = Component.FindObjectOfType <ProjectManagerScript>(); Dictionary <BuildingProperty, MetricMapping> mappings = new Dictionary <BuildingProperty, MetricMapping>(); List <string> metricNames = projectManager.currentProject.metricNames; mappings.Add(BuildingProperty.Height, new MetricMapping(metricNames[7], BuildingProperty.Height, new ValueConverter(0, 1, 0, 1, false), null)); mappings.Add(BuildingProperty.Width, new MetricMapping(metricNames[10], BuildingProperty.Width, new ValueConverter(0, 1, 0, 1, false), null)); mappings.Add(BuildingProperty.Red, new MetricMapping(metricNames[0], BuildingProperty.Red, new ValueConverter(0, 100, 0, 1, true), null)); mappings.Add(BuildingProperty.Green, new MetricMapping(metricNames[0], BuildingProperty.Green, new ValueConverter(0, 100, 0, 1, true), null)); mappings.Add(BuildingProperty.Blue, new MetricMapping(metricNames[0], BuildingProperty.Blue, new ValueConverter(0, 100, 0, 1, true), null)); projectManager.OnMappingChanged(mappings); }
public void OnMappingsApplyClicked() { Dictionary <BuildingProperty, MetricMapping> mappings = new Dictionary <BuildingProperty, MetricMapping>(); Dropdown dropdownMappingHeight = GameObject.Find("DropdownMappingHeight").GetComponent <Dropdown> (); Dropdown dropdownMappingSize = GameObject.Find("DropdownMappingSize").GetComponent <Dropdown> (); Dropdown dropdownMappingColor = GameObject.Find("DropdownMappingColor").GetComponent <Dropdown> (); mappings.Add(BuildingProperty.Height, new MetricMapping(dropdownMappingHeight.options[dropdownMappingHeight.value].text, BuildingProperty.Height, CreateConverter(GameObject.Find("MappingHeight").GetComponent <InputField>().text, false), null)); mappings.Add(BuildingProperty.Width, new MetricMapping(dropdownMappingSize.options[dropdownMappingSize.value].text, BuildingProperty.Width, CreateConverter(GameObject.Find("MappingSize").GetComponent <InputField>().text, false), null)); ColorGradient col = new ColorGradient(new ColorGradient.ColorPoint(0, new Vector3(1, 0, 0)), new ColorGradient.ColorPoint(1, new Vector3(0, 1, 0))); ValueConverter colorValueConverter = CreateConverter(GameObject.Find("MappingColor").GetComponent <InputField> ().text, true); mappings.Add(BuildingProperty.Red, new MetricMapping(dropdownMappingColor.options[dropdownMappingColor.value].text, BuildingProperty.Red, colorValueConverter, col)); mappings.Add(BuildingProperty.Green, new MetricMapping(dropdownMappingColor.options[dropdownMappingColor.value].text, BuildingProperty.Green, colorValueConverter, col)); mappings.Add(BuildingProperty.Blue, new MetricMapping(dropdownMappingColor.options[dropdownMappingColor.value].text, BuildingProperty.Blue, colorValueConverter, col)); projectManager.OnMappingChanged(mappings); CloseUi(); }