//Function to disable the tab system
        public void DisableTabSystem()
        {
            //Set selected tab to null
            selectedTab = null;
            //For every main body window
            for (int i = 0; i < objectsToSwap.Count; i++)
            {
                //Call deselect callback on tab
                if (i < tabButtons.Count)
                {
                    if (tabButtons[i] != null)
                    {
                        tabButtons[i].Deselect();
                    }
                }

                //If disable tabs on switch mode
                if (handleTabDisabled)
                {
                    //Try to get animator
                    JUCLUIAnimator animator = objectsToSwap[i].GetComponent <JUCLUIAnimator>();
                    //If animator is present
                    if (animator != null)
                    {
                        //Run disable animation
                        animator.Disable();
                    }
                    else
                    {
                        //Disable body window
                        objectsToSwap[i].SetActive(false);
                    }
                }
            }
            //Reset the tab colours
            ResetTabColours();

            //Disable header
            JUCLUIAnimator headerAnimator = GetComponent <JUCLUIAnimator>();

            headerAnimator.Disable();
        }
示例#2
0
        //When the tab is selected
        public void OnTabSelected(JUCLTabButton button)
        {
            //If tabs cannot be reselected
            if (!canReselectTabs)
            {
                //If new tab is equal to current tab
                if (button == selectedTab)
                {
                    //return out of function
                    return;
                }
            }

            //Callback on deselect
            if (selectedTab != null)
            {
                selectedTab.Deselect();
            }

            //Assign selected tab
            selectedTab = button;

            //Select callback
            selectedTab.Select();

            //Reset tabs
            ResetTabColours();
            //Set to active colour
            button.background.color = tabActiveColour;
            //Get page index for that tab
            int index = button.transform.GetSiblingIndex();

            //Set page index active
            for (int i = 0; i < objectsToSwap.Count; i++)
            {
                if (i == index)
                {
                    if (handleTabEnabled)
                    {
                        //Try to get animator
                        JUCLUIAnimator animator = objectsToSwap[i].GetComponent <JUCLUIAnimator>();
                        //If animator is present
                        if (animator != null)
                        {
                            //Run show animation
                            animator.Show();
                        }
                        else
                        {
                            //Disable body window
                            objectsToSwap[i].SetActive(true);
                        }
                    }
                }
                else
                {
                    //If tab should be disabled automatically
                    if (handleTabDisabled)
                    {
                        //Try to get animator
                        JUCLUIAnimator animator = objectsToSwap[i].GetComponent <JUCLUIAnimator>();
                        //If animator is present
                        if (animator != null)
                        {
                            //Run disable animation
                            animator.Disable();
                        }
                        else
                        {
                            //Disable body window
                            objectsToSwap[i].SetActive(false);
                        }
                    }
                }
            }
        }