Exemple #1
0
        void RenderTab(TabDetails tabDetails)
        {
            SizedTab tabToRender = tabDetails.Get(_currentTabSize);

            if (SelectedTab.Window == tabDetails.Window)
            {
                _tabButton = new GUIStyle(GUI.skin.label);
                _tabButton.normal.background = TabButtonBackgroundSelectedTexture;
            }
            else
            {
                _tabButton = new GUIStyle(GUI.skin.button);
                _tabButton.normal.background = TabButtonBackgroundTexture;
            }

            _tabButton.alignment        = TextAnchor.MiddleCenter;
            _tabButton.margin           = new RectOffset(-2, -2, 0, 0);
            _tabButton.fontSize         = tabToRender.FontSize;
            _tabButton.normal.textColor = tabToRender.TextColor;

            Nexus.Self.Button(tabToRender.TabText, tabDetails.Get(TabSize.Large).TabText,
                              new Nexus.SwatDelegate(delegate() {
                SelectedTab = tabDetails;
            }), _tabButton, new GUILayoutOption[] {
                GUILayout.Height(25),
                GUILayout.Width(_tabWidthTotal / SwatWindows.Count - (_closeButtonWidth / SwatWindows.Count)),
                GUILayout.MaxWidth(125)
            });
        }
        public static void SetTabPreferences()
        {
            lastPassDock    = dock = Swat.DockNextTo;
            _tabPreferences = new List <KeyValuePair <string, string> >();

            for (int w = 0; w < Nexus.Self.SwatWindows.Count; w++)
            {
                TabDetails match = Nexus.Self.SwatWindows.Find(x => x.PriorityID == w + 1);
                if (match == null)
                {
                    continue;
                }
                string windowName = match.Window.GetType().Name;
                //If no data exists for this window, add it to the end of existing ranked windows.
                if (!_tabPreferences.FindAll(x => x.Key == windowName).Any())
                {
                    _tabPreferences.Add(new KeyValuePair <string, string>(windowName, match.Get(TabSize.Small).TabText));
                }
            }
        }