public void ResetBoxValues() { Dictionary <string, string> InitialBoxValues = SelectaObjects.SetInitialBoxValues(isNewLayout); foreach (string boxKey in Boxes.Keys) { SetProduct(boxKey, InitialBoxValues[boxKey]); } }
public void ChangeLayout(bool newLayout) { //Move all boxes currently in Boxes back into the corresponding Layout Gameobject foreach (GameObject Box in Boxes.Values) { if (isNewLayout) { Box.transform.SetParent(LayoutNew.transform); } else { Box.transform.SetParent(LayoutOld.transform); } } isNewLayout = newLayout; //Fill Boxes with the Boxes from the changed Layout Dictionary <string, string> InitialBoxValues = SelectaObjects.SetInitialBoxValues(newLayout); Boxes = new Dictionary <string, GameObject>(); BoxNutriLabels = new Dictionary <string, TextMesh>(); BoxKeys = new Dictionary <string, string>(); //BoxValues = new List<string>(); SetupOrganizer.Instance.BoxDropdownOptions = new List <string>(); for (int x = 1; x <= 6; x++) { for (int y = 0; y <= 9; y++) { Transform Tmp; if (newLayout) { Tmp = LayoutNew.transform.Find($"{x}{y}"); } else { Tmp = LayoutOld.transform.Find($"{x}{y}"); } if (Tmp != null) { //Put them in their respective Lists //BoxValues.Add(InitialBoxValues[$"{x}{y}"]); BoxKeys.Add($"{x}{y}", InitialBoxValues[$"{x}{y}"]); SetupOrganizer.Instance.BoxDropdownOptions.Add($"{x}{y}"); Boxes.Add($"{x}{y}", Tmp.gameObject); BoxNutriLabels.Add($"{x}{y}", Tmp.transform.Find("Nutrilabel").GetComponent <TextMesh>()); } } } ResetBoxValues(); }
private void Awake() { Instance = this; //gameObject.GetComponent<Renderer>().material = new Material(Shader.Find("Legacy Shaders/Transparent/Diffuse")); //gameObject.GetComponent<Renderer>().material.color = new Color(0,0,0,0); Dictionary <string, string> InitialBoxValues = SelectaObjects.SetInitialBoxValues(isNewLayout); // Initialize the product nutri dict ProductNutris = SelectaObjects.SetProductNutrisDict(); isNewLayout = false; ChangeLayout(isNewLayout); // Set the color for all Products SetColorActive(HasColor); }