Esempio n. 1
0
    public void ChangeTab(ResearchTabType newTab)
    {
        GameObject currentTabButton = TabButtonForResearchTabType(currentTab);
        GameObject newTabButton     = TabButtonForResearchTabType(newTab);

        RectTransform currentTabButtonRect = currentTabButton.GetComponent <RectTransform>();

        currentTabButtonRect.Translate(0, 1, 0);
        currentTabButtonRect.sizeDelta = new Vector2(currentTabButtonRect.sizeDelta.x, currentTabButtonRect.sizeDelta.y - 2);
        RectTransform currentTabButtonTextRect = currentTabButton.transform.GetChild(0).GetComponent <RectTransform>();

        currentTabButtonTextRect.Translate(0, -1, 0);

        RectTransform newTabButtonRect = newTabButton.GetComponent <RectTransform>();

        newTabButtonRect.Translate(0, -1, 0);
        newTabButtonRect.sizeDelta = new Vector2(newTabButtonRect.sizeDelta.x, newTabButtonRect.sizeDelta.y + 2);
        RectTransform newTabButtonTextRect = newTabButton.transform.GetChild(0).GetComponent <RectTransform>();

        newTabButtonTextRect.Translate(0, 1, 0);

        GetComponent <Image>().color = newTabButton.GetComponent <Image>().color;

        TabContentForResearchTabType(currentTab).gameObject.SetActive(false);
        TabContentForResearchTabType(newTab).gameObject.SetActive(true);
        currentTab = newTab;
    }
Esempio n. 2
0
    public ResearchTab TabContentForResearchTabType(ResearchTabType tabType)
    {
        switch (tabType)
        {
        case ResearchTabType.lab:
            return(lab);

        case ResearchTabType.hr:
            return(hr);

        case ResearchTabType.marketing:
            return(marketing);

        default:
            return(lab);
        }
    }
Esempio n. 3
0
    public GameObject TabButtonForResearchTabType(ResearchTabType tabType)
    {
        switch (tabType)
        {
        case ResearchTabType.lab:
            return(labTabButton);

        case ResearchTabType.hr:
            return(hrTabButton);

        case ResearchTabType.marketing:
            return(marketingTabButton);

        default:
            return(labTabButton);
        }
    }