コード例 #1
0
        public void InitButtonList()
        {
            currentSelectedButtonIdx = 0;
            UIContainer buttonObjContainer = this.GetComponent <UIContainer> ();

            if (buttonObjContainer != null)
            {
                //Debug.Log (buttonObjContainer.Buttons.Length);
                buttonList = buttonObjContainer.Buttons;
                if (buttonList != null)
                {
                    buttonNum = buttonList.Length;
                    Button currentSelectedButton = buttonList[currentSelectedButtonIdx];
                    if (currentSelectedButton != null)
                    {
                        EventSystem.current.SetSelectedGameObject(null);
                        EventSystem.current.SetSelectedGameObject(currentSelectedButton.gameObject);

                        /*
                         * currentSelectedButton.Unselect ();
                         * currentSelectedButton.Select ();
                         */
                    }
                }
            }
        }
コード例 #2
0
        /*
         * public Canvas GetCurrentCanvas () {
         *  return currentMenu;
         * }
         */
        public void SetButtonList()
        {
            GameObject  currentMenuObj     = this.transform.GetChild(currentMenuIndex).gameObject;
            UIContainer buttonObjContainer = currentMenuObj.GetComponent <UIContainer> ();

            if (buttonObjContainer != null)
            {
                //Debug.Log (buttonObjContainer.Buttons.Length);
                buttonList = buttonObjContainer.Buttons;
                if (buttonList != null)
                {
                    buttonNum = buttonList.Length;
                    Button currentSelectedButton = buttonList[currentSelectedButtonIdx];
                    if (currentSelectedButton != null)
                    {
                        currentSelectedButton.Select();
                    }
                }
            }
        }