Beispiel #1
0
    private void SetProjFilterBtnStates()
    {
        ViRMA_UIScrollable[] scrollableUis = ui_projectedFilters.GetComponentsInChildren <ViRMA_UIScrollable>();
        for (int i = 0; i < scrollableUis.Length; i++)
        {
            Button[] buttons = scrollableUis[i].GetComponentsInChildren <Button>();
            for (int j = 0; j < buttons.Length; j++)
            {
                GameObject buttonObj = buttons[j].gameObject;
                buttonObj.transform.localScale = Vector3.one * 0.9f;
                ViRMA_UiElement vrUiElement = buttonObj.GetComponent <ViRMA_UiElement>();

                if (i == 0)
                {
                    // x
                    if (j == buttons.Length - 1)
                    {
                        buttonObj.transform.localScale = Vector3.one;
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.axisRed, Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RemoveAxis(buttonObj));
                    }
                    else
                    {
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.BrightenColor(ViRMA_Colors.axisRed), Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RollUpAxis(buttonObj));
                    }
                }
                else if (i == 1)
                {
                    // y
                    if (j == buttons.Length - 1)
                    {
                        buttonObj.transform.localScale = Vector3.one;
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.axisGreen, Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RemoveAxis(buttonObj));
                    }
                    else
                    {
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.BrightenColor(ViRMA_Colors.axisGreen), Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RollUpAxis(buttonObj));
                    }
                }
                else if (i == 2)
                {
                    // z
                    if (j == buttons.Length - 1)
                    {
                        buttonObj.transform.localScale = Vector3.one;
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.axisBlue, Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RemoveAxis(buttonObj));
                    }
                    else
                    {
                        vrUiElement.GenerateBtnDefaults(ViRMA_Colors.BrightenColor(ViRMA_Colors.axisBlue), Color.white);
                        buttonObj.GetComponent <Button>().onClick.AddListener(() => RollUpAxis(buttonObj));
                    }
                }
            }
        }
    }
Beispiel #2
0
    public void SetBtnDefaultState()
    {
        foreach (Button key in keys)
        {
            key.onClick.AddListener(() => SubmitKey(key));

            Text keyText = key.GetComponentInChildren<Text>();
            Image keyBackground = key.GetComponent<Image>();
            ViRMA_UiElement virmaBtn = key.GetComponent<ViRMA_UiElement>();

            Color32 bgCol;
            Color32 textCol;

            if (key.name == "CLEAR")
            {
                bgCol = ViRMA_Colors.flatOrange;
                textCol = Color.white;
            }
            else if (key.name == "CLOSE")
            {
                bgCol = new Color32(192, 57, 43, 255);
                textCol = Color.white;
            }
            else if (key.name == "BACKSPACE")
            {
                bgCol = ViRMA_Colors.darkBlue;
                textCol = Color.white;
            }
            else if (key.name == "MOVE")
            {
                bgCol = ViRMA_Colors.grey;
                textCol = Color.white;
            }
            else if (key.name == "SUBMIT")
            {
                bgCol = new Color32(39, 174, 96, 255);
                textCol = Color.white;
            }
            else
            {
                bgCol = ViRMA_Colors.darkBlue;
                textCol = Color.white;
            }

            virmaBtn.GenerateBtnDefaults(bgCol, textCol);
        }
    }