Exemplo n.º 1
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;
        selectedTab.Select();
        ResetTabs();

        button.background.sprite = tabActive;
        int index = button.transform.GetSiblingIndex();

        currentTabButtonIndex = index;
        for (int i = 0; i < objectsToSwap.Count; ++i)
        {
            if (i == index)
            {
                objectsToSwap[i].SetActive(true);
            }
            else
            {
                objectsToSwap[i].SetActive(false);
            }
        }

        if (panelGroup != null)
        {
            panelGroup.SetPageIndex(index);
        }
    }
Exemplo n.º 2
0
    public void OnTabSelected(TabButton tab)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = tab;
        selectedTab.Select();

        ResetTabs();
        tab.background.color = tab.buttonColors.colorActive;
        tab.buttonText.color = tab.textColors.colorActive;

        //int index = tab.transform.GetSiblingIndex();
        //
        // for (int i = 0; i < pages.Count; i++)
        // {
        //     pages[i].SetActive(i == index);
        // }

        if (panelGroup != null)
        {
            panelGroup.SetPageIndex(tab.transform.GetSiblingIndex());
        }
    }
Exemplo n.º 3
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTabs();
        button.backGround.color = tabActive;

        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < panelToSwap.Count; i++)
        {
            if (i == index)
            {
                panelToSwap[i].SetActive(true);
            }
            else
            {
                panelToSwap[i].SetActive(false);
            }
        }
    }
Exemplo n.º 4
0
    public void OnTabSelected(TabButton tabButton)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = tabButton;

        selectedTab.Select();

        ResetTabs();
        tabButton.background.color = tabSelectedColor;
        int index = tabButton.transform.GetSiblingIndex();

        for (int i = 0; i < tabPages.Count; i++)
        {
            if (i == index)
            {
                tabPages[i].SetActive(true);
            }
            else
            {
                tabPages[i].SetActive(false);
            }
        }
    }
    public void OnTabClick(TabButton tab)
    {
        //if selected exist => deselect
        if (SelectedTab != null)
        {
            SelectedTab.Deselect();
        }
        //select this tab from pointer action + select call function
        SelectedTab = tab;
        SelectedTab.Select();

        ResetTabs();
        tab.background.color = Selected;
        //as start does not hava a precise order the more relaible way to connect tabs to  pages is to use the order as siblings
        //element(index of this child element compared to the all list of child elements of the father element)
        int index = tab.transform.GetSiblingIndex();

        //activate corrispondent page
        for (int i = 0; i < SwapList.Count; i++)
        {
            if (i == index)
            {
                SwapList[i].SetActive(true);
            }
            else
            {
                SwapList[i].SetActive(false);
            }
        }
    }
Exemplo n.º 6
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTab();
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < objectsToSwap.Count; i++)
        {
            if (i == index)
            {
                objectsToSwap[i].SetActive(true);
            }
            else
            {
                objectsToSwap[i].SetActive(false);
            }
        }
    }
Exemplo n.º 7
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTabs();
        button.background.color = tabActive;
        int index = button.transform.GetSiblingIndex();

        //for (int i = 0; i < objectsToSwap.Count; i++)
        //{
        //    if (i == index) objectsToSwap[i].SetActive(true);
        //    else objectsToSwap[i].SetActive(false);

        //}

        if (panelGroup != null)
        {
            panelGroup.SetPageIndex(index);
        }
    }
Exemplo n.º 8
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTabs();
        button.backgroundB.sprite = tabActive;

        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < objectsToShow.Count; i++)
        {
            if (i == index)
            {
                objectsToShow[i].SetActive(true);
            }
            else
            {
                objectsToShow[i].SetActive(false);
            }
        }
    }
Exemplo n.º 9
0
 public void OnTabDeselected(TabButton tab)
 {
     tab.Deselect();
     CloseTabMenu(tab);
     _selectedTab = null;
     ResetTabs();
 }
Exemplo n.º 10
0
    private void DeselectTab(TabButton tabButton)
    {
        VisualElement target = tabButton.Target;

        Remove(target);
        tabButton.Deselect();
    }
Exemplo n.º 11
0
    public void OnTabSelected(TabButton button)
    {
        // Selected Tab Function
        if (_selectedTab != null)
        {
            _selectedTab.Deselect();
        }

        _selectedTab = button;
        _selectedTab.Select();

        // UI Image Change
        ResetTabButtons();
        button.BackGround.sprite = _tabActive;

        // Page Active
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < _pages.Count; i++)
        {
            if (i == index)
            {
                _pages[i].gameObject.SetActive(true);
            }
            else
            {
                _pages[i].gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 12
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTabs();
        button.background.color = tabActive;
        FindObjectOfType <AudioManager>().Play("Pressed");
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < objectsToSwap.Count; i++)
        {
            if (i == index)
            {
                objectsToSwap[i].SetActive(true);
            }
            else
            {
                objectsToSwap[i].SetActive(false);
            }
        }
    }
Exemplo n.º 13
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;
        selectedTab.Select();
        button.background.color = tabActive;
        ResetTabs();

        foreach (TabButton tb in tabButtons)
        {
            if (tb == selectedTab)
            {
                tb.toggleObject.SetActive(true);
            }
            else
            {
                tb.toggleObject.SetActive(false);
            }
        }

        Selectable first = selectedTab.toggleObject.gameObject.GetComponentInChildren <Button>();

        if (first != null)
        {
            first.Select();
            first.OnSelect(null);
        }
    }
Exemplo n.º 14
0
    private void DeselectTab(TabButton tabButton)
    {
        VisualElement target = tabButton.Target;

        if (target != null)
        {
            Remove(target);
        }
        tabButton.Deselect();
    }
Exemplo n.º 15
0
    public void SelectedButton(TabButton _button)
    {
        if (tabButton != null)
        {
            tabButton.Deselect();
        }

        tabButton = _button;
        tabButton.Select();
    }
Exemplo n.º 16
0
    public void OnTabSelected(TabButton tabButton)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = tabButton;
        selectedTab.Select();
        ResetTabs();
    }
Exemplo n.º 17
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }
        selectedTab = button;
        selectedTab.Select();

        ResetTabs();
        button.Background.color = tabActive;
    }
    public void OnTabSelected(TabButton button)
    {
        Debug.Log(button.name);
        ResetButtons();

        if (selectedTab != null)
        {
            Debug.Log("deselcting selected tab");
            selectedTab.Deselect();
            button.GetComponent <Image>().sprite = idleImg;
        }
        selectedTab = button;
        button.Select();
        button.GetComponent <Image>().sprite = selectedImg;
    }
Exemplo n.º 19
0
    public void OnTabSelected(TabButton tab)
    {
        if (_selectedTab != null)
        {
            _selectedTab.Deselect();
            CloseTabMenu(_selectedTab);
            _selectedTab = null;
        }

        ResetTabs();

        _selectedTab       = tab;
        tab.TabImage.color = _selectedColor;
        tab.ChangeInImageColor(_spriteSelectedColor);
        tab.Select();
        OpenTabMenu(tab);
    }
Exemplo n.º 20
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null && selectedTab != button)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;
        selectedTab.Select();

        ResetTabs();
        button.background.sprite = tabActive;

        if (panelGroup != null)
        {
            panelGroup.SetPageIndex(button.transform.GetSiblingIndex());
        }
    }
Exemplo n.º 21
0
    public virtual void SelectTab(TabButton tabButton)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = tabButton;

        ResetTabButtonsVisuals();

        int index = tabButton.transform.GetSiblingIndex();

        for (int i = 0; i < pages.Count; i++)
        {
            pages[i].SetActive(index == i);
        }
    }
Exemplo n.º 22
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        ResetTabs();
        button.Style(tabActive);
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < tabs.Count; i++)
        {
            tabs[i].SetActive(i == index);
        }
        selectedTab.Select();
    }
Exemplo n.º 23
0
    private void SetActive(int index)
    {
        if (_selectedTab != null)
        {
            _selectedTab.Deselect();
        }
        ResetTabs();

        if (index < 0)
        {
            OnTabSelected(_tabButtons.Where(x => x.index == _tabButtons.Count - 1).ToArray()[0]);
        }
        else if (index >= _tabButtons.Count)
        {
            OnTabSelected(_tabButtons.Where(x => x.index == 0).ToArray()[0]);
        }
        else
        {
            OnTabSelected(_tabButtons.Where(x => x.index == index).ToArray()[0]);
        }
    }
    /// <summary>
    /// Handles mouse click events.
    /// </summary>
    /// <param name="button">The tab button highlighted</param>

    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        selectedTab = button;

        selectedTab.Select();

        ResetTabs();

        button.UpdateBackground(tabActive);
        button.UpdateText(txtLight);

        if (panelGroup != null)
        {
            panelGroup.SetPageIndex(selectedTab.transform.GetSiblingIndex());
        }
    }
Exemplo n.º 25
0
 public void OnTabSelected(TabButton button)
 {
     if (selectedButton != null)
     {
         selectedButton.Deselect();
     }
     selectedButton = button;
     selectedButton.Select();
     ResetTabs();
     button.background.color = active;
     if (shouldSwapObjects)
     {
         SwapObjects(button);
     }
     else
     {
         if (panelGroup != null)
         {
             panelGroup.SetPageIndex(button.transform.GetSiblingIndex());
         }
     }
 }
Exemplo n.º 26
0
    /// <summary>
    /// Event for when a TabButton has been selected
    /// </summary>
    /// <param name="button"></param>
    public void OnTabSelected(TabButton button)
    {
        //Dont reselect the selected button
        if (button == selectedTab)
        {
            return;
        }

        //Callback for the old selected TabButton
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }

        //Set the new selected TabButton
        selectedTab = button;

        //Callback for the new selected TabButton
        selectedTab.Select();

        ResetTabs();
        button.SetBackground(spriteSelected);

        //Turn on the correct page and disable the rest
        int index = button.transform.GetSiblingIndex();

        for (int i = 0; i < pages.Count; i++)
        {
            if (i == index)
            {
                pages[i].SetActive(true);
            }
            else
            {
                pages[i].SetActive(false);
            }
        }
    }
Exemplo n.º 27
0
    public void OnTabSelected(TabButton button)
    {
        if (selectedTab != null)
        {
            selectedTab.Deselect();
        }
        selectedTab = button;
        selectedTab.Select();
        ResetTabs();
        button.background.color = tabSelected;

        for (int i = 0; i < objectsToSwap.Count; i++)
        {
            if (i == button.tabID)
            {
                objectsToSwap[i].SetActive(true);
            }
            else
            {
                objectsToSwap[i].SetActive(false);
            }
        }
    }