Exemplo n.º 1
0
        public void Select(TabControllerButton tab)
        {
            SelectedTab = tab;

            foreach (var obj in Tabs)
            {
                obj.SetSelected(obj == SelectedTab);
            }
        }
Exemplo n.º 2
0
        public virtual void Select(TabControllerButton button)
        {
            SelectedTab = button;

            SelectedTab.Pane.SetActive(true);
            button.SetSelected(true);

            foreach (var obj in m_buttons)
            {
                if (obj != SelectedTab)
                {
                    obj.SetSelected(false);
                    obj.Pane.SetActive(false);
                }
            }
        }
Exemplo n.º 3
0
        void Start()
        {
            m_buttons = GetComponentsInChildren <TabControllerButton>().ToArray();
            TabControllerButton selectedButton = m_buttons.FirstOrDefault();

            foreach (var tabButton in m_buttons)
            {
                var button = tabButton.GetComponent <Button>();

                if (tabButton == SelectedTab)
                {
                    selectedButton = tabButton;
                }

                if (button)
                {
                    var _t = tabButton;

                    button.onClick.AddListener(() => { Select(_t); });
                }
            }

            Select(selectedButton);
        }