Пример #1
0
    private void PositionTabs()
    {
        // To make the tabs overlap, they have to be equal to their proportional width plus a specific fraction of the overlap
        Vector2 tabSize = new Vector2(
            (this.size.x / tabs.Count) + (this.tabOverlap * (tabs.Count - 1) / tabs.Count),
            this.tabHeight
            );

        float realHeight = RealTabHeight();
        float tabY       = (this.size.y / 2) - (realHeight / 2);

        float nextTabX = -1 * (this.size.x / 2);

        for (int tabIndex = 0; tabIndex < tabs.Count; tabIndex++)
        {
            TabController2 tab = tabs[tabIndex];

            nextTabX += tabSize.x / 2;

            Vector2 realSize = new Vector2(tabSize.x, realHeight);
            Vector2 tabPos   = new Vector2(nextTabX, tabY);
            tab.PositionTab(realSize, tabPos, this, (tabIndex == activeWindow));

            nextTabX += (tabSize.x / 2) - tabOverlap;
        }
    }
Пример #2
0
    public float RealTabHeight()
    {
        TabController2 TC           = tabs[0].GetComponent <TabController2>();
        float          actualHeight = this.tabHeight + TC.NeckHeight();

        actualHeight += TC.NeckHeight();
        actualHeight /= TC.GetResolution();
        return(actualHeight);
    }
Пример #3
0
    private void PositionWindows()
    {
        TabController2 TC           = tabs[0].GetComponent <TabController2>();
        float          windowHeight = size.y - RealTabHeight() + (TC.NeckHeight() / TC.GetResolution());
        float          windowY      = -1 * (size.y - windowHeight) / 2;

        for (int windowIndex = 0; windowIndex < windows.Count; windowIndex++)
        {
            WindowLayout2 window = windows[windowIndex];

            if (windowIndex == activeWindow)
            {
                window.gameObject.SetActive(true);
                window.PlaceElement(new Vector2(size.x, windowHeight), new Vector2(0f, windowY));
            }
            else
            {
                window.gameObject.SetActive(false);
            }
        }
    }