예제 #1
0
 public void OnTabEnter(TabButton button)
 {
     ResetTabs();
     if (selectedTab == null || button != selectedTab)
     {
         ColorBlock cb = button.GetComponent <Button>().colors;
         cb.highlightedColor = newColor;
         button.GetComponent <Button>().colors = cb;
     }
 }
예제 #2
0
    void Start()
    {
        tabList.AddRange(GetComponentsInChildren <TabButton>());

        float anchorStart = 1;

        if (startAxis == E_Axis.Horizontal)
        {
            anchorStart = 0;
        }
        else
        {
            anchorStart = 1;
        }
        float anchorinterval = (float)1 / transform.childCount;

        for (int index = 0; index < transform.childCount; index++)
        {
            RectTransform temp = tabList[index].GetComponent <RectTransform>();
            tabList[index].parentManager = this;
            if (startAxis == E_Axis.Horizontal)
            {
                temp.anchorMin  = new Vector2(anchorStart, 0);
                temp.anchorMax  = new Vector2(anchorStart + anchorinterval, 1);
                temp.offsetMax -= nonSelectedOffset;
                anchorStart    += anchorinterval;
            }
            else
            {
                temp.anchorMin  = new Vector2(0, anchorStart - anchorinterval);
                temp.anchorMax  = new Vector2(1, anchorStart);
                temp.offsetMin -= nonSelectedOffset;
                anchorStart    -= anchorinterval;
            }
        }
        if (tabList.Count > 0)
        {
            selectedTab = tabList[0];
            ShowPage(0);
            if (startAxis == E_Axis.Horizontal)
            {
                selectedTab.GetComponent <RectTransform>().offsetMax += nonSelectedOffset;
            }
            else
            {
                selectedTab.GetComponent <RectTransform>().offsetMin += nonSelectedOffset;
            }
            selectedTab.Clicked();
        }
    }
    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;
    }
예제 #4
0
 public void OnTabEnter(TabButton t_tabButton)
 {
     ResetTabs();
     if (SelectedTab == null || t_tabButton != SelectedTab)
     {
         t_tabButton.GetComponent <Image>().color = new Color(0, 255, 0);
     }
 }
예제 #5
0
 public void TabSelected(TabButton tab)
 {
     selectedTab.IsSelected(false);
     tab.IsSelected(true);
     if (startAxis == E_Axis.Horizontal)
     {
         selectedTab.GetComponent <RectTransform>().offsetMax -= nonSelectedOffset;
         tab.GetComponent <RectTransform>().offsetMax         += nonSelectedOffset;
     }
     else
     {
         selectedTab.GetComponent <RectTransform>().offsetMin -= nonSelectedOffset;
         tab.GetComponent <RectTransform>().offsetMin         += nonSelectedOffset;
     }
     selectedTab = tab;
     ShowPage(tabList.FindIndex(t => t == tab));
 }
예제 #6
0
    public void OnTabSelected(TabButton button)
    {
        selectedTab = button;
        ResetTabs();
        ColorBlock cb = button.GetComponent <Button>().colors;

        cb.selectedColor = newColor;
        button.GetComponent <Button>().colors = cb;
        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);
            }
        }
    }
예제 #7
0
 GameObject DoChangeTab(TabButton curTab)
 {
     if (null != curHighLightTab)
     {
         curHighLightTab.HighLightTab(false);
     }
     curTab.HighLightTab(true);
     curHighLightTab = curTab;
     if (null != delTabChanged)
     {
         delTabChanged(curTab);
     }
     return(curHighLightTab.GetComponent <TabButton>().targetObject);
 }
예제 #8
0
    public void OnTabSelected(TabButton button, Toggle toggle)
    {
        Toggle ToggleButton = toggle.GetComponent <Toggle>();

        bool buttonState = ToggleButton.isOn;

        selectedTab = button;
        ResetTabs();
        //button.GetComponent<Image>().sprite = tabSelected;
        button.GetComponent <Image>().color = new Color32(255, 255, 255, 60);
        int index = button.transform.GetSiblingIndex();

        if (buttonState == false)
        {
            for (int i = 0; i < displayObjects.Count; i++)
            {
                if (i == index)
                {
                    displayObjects[i].SetActive(true);
                }
                else
                {
                    displayObjects[i].SetActive(false);
                }
            }
        }
        else if (buttonState == true)
        {
            for (int i = 0; i < displayObjects.Count; i++)
            {
                if (i == 3 && index == 0)
                {
                    displayObjects[i].SetActive(true);
                }
                else if (i == index && index != 0)
                {
                    displayObjects[i].SetActive(true);
                }
                else
                {
                    displayObjects[i].SetActive(false);
                }
            }
        }
    }
예제 #9
0
    public void OnTabSelect(TabButton t_tabButton)
    {
        SelectedTab = t_tabButton;
        ResetTabs();
        t_tabButton.GetComponent <Image>().color = new Color(255, 0, 0);

        int index = t_tabButton.transform.GetSiblingIndex();

        for (int i = 0; i < tabs.Count; i++)
        {
            if (i == index)
            {
                tabs[i].SetActive(true);
            }
            else
            {
                tabs[i].SetActive(false);
            }
        }
    }
예제 #10
0
 void TitleOnClick(TabButton value)
 {
     value.GetComponent <TitleInvestitiveItemLogic>().ChooseTitleInvestitive();
 }