コード例 #1
0
        public static bool Toggle(string text, ref bool state, int fontsize = 17)
        {
            bool pressed      = false;
            int  bordersize   = 1;
            int  boxsize      = 15;
            int  lastfontsize = _TextStyle.fontSize;

            _TextStyle.fontSize = fontsize;
            GUILayout.Space(3);
            Rect area      = GUILayoutUtility.GetRect(150, 15);
            Rect border    = new Rect(area.x + bordersize, area.y + bordersize, boxsize - bordersize * 2, boxsize - bordersize * 2);
            Rect togglebox = MenuUtilities.Inline(border);

            Drawing.DrawRect(border, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(togglebox, _ToggleBoxBG);
            if (GUI.Button(area, GUIContent.none, _TextStyle))
            {
                state   = !state;
                pressed = true;
            }
            if (Event.current.type == EventType.Repaint)
            {
                bool hover  = area.Contains(Event.current.mousePosition);
                bool active = hover && Input.GetMouseButton(0);
                _TextStyle.Draw(new Rect(area.x + 20, area.y, 130, boxsize), text, hover, active, false, false);
            }
            _TextStyle.fontSize = lastfontsize;
            if (state)
            {
                Drawing.DrawRect(togglebox, MenuComponent._Accent2);
            }
            return(pressed);
        }
コード例 #2
0
    public static void MenuArea(Rect area, string header, Action code)
    {
        Rect rect     = new Rect(area.x, area.y + 5f, area.width, area.height - 5f);
        Rect rect2    = MenuUtilities.Inline(rect, 1);
        Rect position = MenuUtilities.Inline(rect2, 1);

        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(rect2, MenuComponent._OutlineBorderLightGray, null);
        Drawing.DrawRect(position, MenuComponent._FillLightBlack, null);
        Vector2 vector = Prefab._HeaderStyle.CalcSize(new GUIContent(header));

        Drawing.DrawRect(new Rect(area.x + 18f, area.y, vector.x + 4f, vector.y), MenuComponent._FillLightBlack, null);
        GUI.Label(new Rect(area.x + 20f, area.y - 3f, vector.x, vector.y), header, Prefab._HeaderStyle);
        GUILayout.BeginArea(area);
        GUILayout.BeginHorizontal(new GUILayoutOption[0]);
        GUILayout.Space(15f);
        GUILayout.BeginVertical(new GUILayoutOption[0]);
        GUILayout.Space(20f);
        try
        {
            code();
        }
        catch (Exception)
        {
        }
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
コード例 #3
0
    public static bool List(Rect position, ref bool showList, ref int listEntry, ref Vector2 scrollPos, GUIContent buttonContent, GUIContent[] listContent, GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle)
    {
        Drawing.DrawRect(position, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(position, 1), MenuComponent._OutlineBorderDarkGray, null);
        int   fontSize  = Prefab._TextStyle.fontSize;
        Color textColor = Prefab._TextStyle.normal.textColor;

        Prefab._TextStyle.fontSize         = 15;
        Prefab._TextStyle.normal.textColor = Prefab._TextStyle.onNormal.textColor;
        Prefab._TextStyle.alignment        = TextAnchor.MiddleLeft;
        GUI.Label(new Rect(position.x + position.height + 4f, position.y, position.width - position.height * 2f, position.height), buttonContent, Prefab._TextStyle);
        bool result = false;
        bool flag   = Prefab.AbsButton(new Rect(position.x, position.y, position.height, position.height), "<=", new GUILayoutOption[0]);

        if (flag)
        {
            result    = true;
            listEntry = Math.Max(0, listEntry - 1);
        }
        bool flag2 = Prefab.AbsButton(new Rect(position.x + position.width - position.height, position.y, position.height, position.height), "=>", new GUILayoutOption[0]);

        if (flag2)
        {
            result    = true;
            listEntry = Math.Min(listContent.Length - 1, listEntry + 1);
        }
        Prefab._TextStyle.alignment        = TextAnchor.UpperLeft;
        Prefab._TextStyle.fontSize         = fontSize;
        Prefab._TextStyle.normal.textColor = textColor;
        return(result);
    }
コード例 #4
0
        public static bool List(Rect position, ref bool showList, ref int listEntry, ref Vector2 scrollPos, GUIContent buttonContent, GUIContent[] listContent,
                                GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle)
        {
            Drawing.DrawRect(position, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(position), MenuComponent._OutlineBorderDarkGray);

            int   lastFont  = _TextStyle.fontSize;
            Color lastColor = _TextStyle.normal.textColor;

            _TextStyle.fontSize         = 15;
            _TextStyle.normal.textColor = _TextStyle.onNormal.textColor;
            _TextStyle.alignment        = TextAnchor.MiddleLeft;

            GUI.Label(new Rect(position.x + position.height + 4, position.y, position.width - position.height * 2, position.height), buttonContent, _TextStyle);

            bool modified = false;

            if (Prefab.AbsButton(new Rect(position.x, position.y, position.height, position.height), "◄"))
            {
                modified  = true;
                listEntry = Math.Max(0, listEntry - 1);
            }

            if (Prefab.AbsButton(new Rect(position.x + position.width - position.height, position.y, position.height, position.height), "►"))
            {
                modified  = true;
                listEntry = Math.Min(listContent.Length - 1, listEntry + 1);
            }

            _TextStyle.alignment        = TextAnchor.UpperLeft;
            _TextStyle.fontSize         = lastFont;
            _TextStyle.normal.textColor = lastColor;

            return(modified);
        }
コード例 #5
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     if (!IsShiftF10(e))
     {
         base.OnKeyDown(e);
     }
     MenuUtilities.ProcessForDirectionalNavigation(e, this, Orientation.Horizontal);
 }
コード例 #6
0
 void ClickableOnClicked()
 {
     var(x, y) = MenuUtilities.GetMenuPosition(m_OverflowMenu, MenuUtilities.AnchorPoint.BottomRight);
     new FloatingMenu()
     .AddEntry("Invite Teammate", OpenLinksUtility.OpenMembersLink, true)
     .SetOpenDirection(MenuUtilities.OpenDirection.DownLeft)
     .Open(x, y);
 }
コード例 #7
0
 protected override void OnContextMenuOpening(ContextMenuEventArgs e)
 {
     if (_openContextMenu)
     {
         return;
     }
     MenuUtilities.HandleOnContextMenuOpening(e, base.OnContextMenuOpening);
 }
コード例 #8
0
        // Token: 0x06000237 RID: 567 RVA: 0x00015874 File Offset: 0x00013A74
        public static void ScrollView(Rect area, string title, ref Vector2 scrollpos, Action code, int padding = 20, params GUILayoutOption[] options)
        {
            Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack, null);
            Drawing.DrawRect(MenuUtilities.Inline(area, 1), MenuComponent._OutlineBorderLightGray, null);
            Rect rect = MenuUtilities.Inline(area, 2);

            Drawing.DrawRect(rect, MenuComponent._FillLightBlack, null);
            Color textColor = Prefab._MenuTabStyle.normal.textColor;
            int   fontSize  = Prefab._MenuTabStyle.fontSize;

            Prefab._MenuTabStyle.normal.textColor = Prefab._MenuTabStyle.onNormal.textColor;
            Prefab._MenuTabStyle.fontSize         = 15;
            Drawing.DrawRect(new Rect(rect.x, rect.y, rect.width, Prefab._MenuTabStyle.CalcSize(new GUIContent(title)).y + 2f), MenuComponent._OutlineBorderLightGray, null);
            GUILayout.BeginArea(rect);
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            GUILayout.FlexibleSpace();
            GUILayout.Label(title, Prefab._MenuTabStyle, Array.Empty <GUILayoutOption>());
            Prefab._MenuTabStyle.normal.textColor = textColor;
            Prefab._MenuTabStyle.fontSize         = fontSize;
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(2f);
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            scrollpos = GUILayout.BeginScrollView(scrollpos, false, true, Array.Empty <GUILayoutOption>());
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            GUILayout.Space((float)padding);
            GUILayout.BeginVertical(new GUILayoutOption[]
            {
                GUILayout.MinHeight(rect.height)
            });
            try
            {
                code();
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
            }
            GUILayout.EndVertical();
            Rect lastRect = GUILayoutUtility.GetLastRect();

            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
            Rect lastRect2 = GUILayoutUtility.GetLastRect();

            GUILayout.Space(1f);
            GUILayout.EndHorizontal();
            GUILayout.Space(1f);
            Drawing.DrawRect(new Rect(lastRect2.x + lastRect2.width - 16f, lastRect2.y, 16f, lastRect2.height), MenuComponent._FillLightBlack, null);
            bool flag  = lastRect.height - lastRect2.height > 0f;
            bool flag2 = flag;

            if (flag2)
            {
                Prefab.VerticalSlider(new Rect(lastRect2.x + 4f, lastRect2.y + 8f, 12f, lastRect2.height - 14f), 0f, lastRect.height - lastRect2.height, ref scrollpos.y);
            }
            GUILayout.EndArea();
        }
コード例 #9
0
        public static void ScrollView(Rect area, string title, ref SerializableVector2 scrollpos, Action code, int padding = 20, params GUILayoutOption[] options)
        {
            Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(area), MenuComponent._OutlineBorderLightGray);
            Rect inlined = MenuUtilities.Inline(area, 2);

            Drawing.DrawRect(inlined, MenuComponent._FillLightBlack);
            Color lastColor    = _MenuTabStyle.normal.textColor;
            int   lastFontSize = _MenuTabStyle.fontSize;

            _MenuTabStyle.normal.textColor = _MenuTabStyle.onNormal.textColor;
            _MenuTabStyle.fontSize         = 15;
            Drawing.DrawRect(new Rect(inlined.x, inlined.y, inlined.width, _MenuTabStyle.CalcSize(new GUIContent(title)).y + 2), MenuComponent._OutlineBorderLightGray);
            GUILayout.BeginArea(inlined);
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(title, _MenuTabStyle);
                    _MenuTabStyle.normal.textColor = lastColor;
                    _MenuTabStyle.fontSize         = lastFontSize;
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(2);
                Rect rects;
                Rect inner;
                GUILayout.BeginHorizontal();
                {
                    scrollpos = GUILayout.BeginScrollView(scrollpos.ToVector2(), false, true);
                    {
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(padding);
                            GUILayout.BeginVertical(GUILayout.MinHeight(inlined.height));
                            {
                                try { code(); }
                                catch (Exception e) { DebugUtilities.Log($"SCROLLVIEW EXCEPTION: {e}"); }
                            }
                            GUILayout.EndVertical();
                            inner = GUILayoutUtility.GetLastRect();
                        }
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndScrollView();
                    rects = GUILayoutUtility.GetLastRect();
                    GUILayout.Space(1);
                }
                GUILayout.EndHorizontal();
                GUILayout.Space(1);
                Drawing.DrawRect(new Rect(rects.x + rects.width - 16, rects.y, 16, rects.height), MenuComponent._FillLightBlack);
                if (inner.height - rects.height > 0)
                {
                    VerticalSlider(new Rect(rects.x + 4, rects.y + 8, 12, rects.height - 14), 0, inner.height - rects.height, ref scrollpos.y);
                }
            }
            GUILayout.EndArea();
        }
コード例 #10
0
 public IEnumerable <MenuBase> GetItems()
 {
     try
     {
         return(MenuUtilities.MergeMenuGroups(new MenuUtilities.MenuBaseEnumerator(this.EnumerateRootMenuItems)));
     }
     catch
     {
         return((IEnumerable <MenuBase>) new List <MenuBase>());
     }
 }
コード例 #11
0
    public static void CheckStyles()
    {
        bool flag = Prefab._MenuTabStyle != null || !LoaderCoroutines.IsLoaded;

        if (!flag)
        {
            Prefab._MenuTabStyle = new GUIStyle
            {
                font     = MenuComponent._TabFont,
                fontSize = 29
            };
            Prefab._HeaderStyle = new GUIStyle
            {
                font      = MenuComponent._TabFont,
                fontSize  = 15,
                alignment = TextAnchor.MiddleCenter
            };
            Prefab._TextStyle = new GUIStyle
            {
                font     = MenuComponent._TextFont,
                fontSize = 17
            };
            Prefab._sliderStyle      = new GUIStyle();
            Prefab._sliderThumbStyle = new GUIStyle(GUI.skin.horizontalSliderThumb)
            {
                fixedWidth = 7f
            };
            Prefab._sliderVThumbStyle = new GUIStyle(GUI.skin.verticalSliderThumb)
            {
                fixedHeight = 7f
            };
            Prefab._listStyle = new GUIStyle();
            Prefab._listStyle.padding.left = (Prefab._listStyle.padding.right = (Prefab._listStyle.padding.top = (Prefab._listStyle.padding.bottom = 4)));
            Prefab._listStyle.alignment    = TextAnchor.MiddleLeft;
            Prefab._listStyle.font         = MenuComponent._TextFont;
            Prefab._listStyle.fontSize     = 15;
            Prefab._ButtonStyle            = new GUIStyle
            {
                alignment = TextAnchor.MiddleLeft,
                font      = MenuComponent._TextFont,
                fontSize  = 15
            };
            Prefab._ButtonStyle.padding.left = (Prefab._ButtonStyle.padding.right = (Prefab._ButtonStyle.padding.top = (Prefab._ButtonStyle.padding.bottom = 4)));
            MenuUtilities.FixGUIStyleColor(Prefab._sliderStyle);
            MenuUtilities.FixGUIStyleColor(Prefab._MenuTabStyle);
            MenuUtilities.FixGUIStyleColor(Prefab._TextStyle);
            MenuComponent.SetGUIColors();
        }
    }
コード例 #12
0
        protected override void AfterInit()
        {
            HudMain.Init();
            RebindDialog.Init();
            RichHudDebug.Init();
            InitSettingsMenu();

            RegisterClientHandler();
            CheckClientQueue();

            if (MenuUtilities.CanAddElements)
            {
                MenuUtilities.AddMenuElements(GetModMenuButton());
            }
        }
コード例 #13
0
    public static void VerticalSlider(Rect pos, float top, float bottom, ref float value)
    {
        GUIStyle sliderVThumbStyle = Prefab._sliderVThumbStyle;
        GUIStyle sliderStyle       = Prefab._sliderStyle;
        float    num = (sliderVThumbStyle.fixedHeight != 0f) ? sliderVThumbStyle.fixedHeight : sliderVThumbStyle.padding.vertical;

        value = GUI.VerticalSlider(pos, value, top, bottom, Prefab._sliderStyle, GUI.skin.verticalSliderThumb);
        Rect  position = pos;
        float num2     = (position.height - sliderStyle.padding.vertical - num) / (bottom - top);
        Rect  rect     = new Rect(position.x + sliderStyle.padding.left, (value - top) * num2 + position.y + sliderStyle.padding.top, position.width - sliderStyle.padding.horizontal, num);

        Drawing.DrawRect(position, MenuComponent._FillLightBlack, null);
        Drawing.DrawRect(new Rect(position.x + position.width / 2f - 2f, position.y, 4f, position.height), Prefab._ToggleBoxBG, null);
        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect, 1), Prefab._MenuTabStyle.onNormal.textColor, null);
    }
コード例 #14
0
    public static bool ColorButton(float width, ColorVariable color, float height = 25f, params GUILayoutOption[] options)
    {
        List <GUILayoutOption> list = options.ToList <GUILayoutOption>();

        list.Add(GUILayout.Height(height));
        list.Add(GUILayout.Width(width));
        Rect rect = GUILayoutUtility.GetRect(width, height, list.ToArray());

        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Rect rect2  = new Rect(rect.x + 4f, rect.y + 4f, rect.height - 8f, rect.height - 8f);
        bool result = GUI.Button(MenuUtilities.Inline(rect, 1), "" + color.name, Prefab._ButtonStyle);

        Drawing.DrawRect(rect2, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect2, 1), MenuComponent._OutlineBorderLightGray, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect2, 2), color.color, null);
        return(result);
    }
コード例 #15
0
        public static bool ColorButton(float width, ColorVariable color, float height = 25, params GUILayoutOption[] options)
        {
            List <GUILayoutOption> parameters = options.ToList();

            parameters.Add(GUILayout.Height(height));
            parameters.Add(GUILayout.Width(width));
            Rect area = GUILayoutUtility.GetRect(width, height, parameters.ToArray());

            Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack);
            Rect preview = new Rect(area.x + 4, area.y + 4, area.height - 8, area.height - 8);
            bool pressed = GUI.Button(MenuUtilities.Inline(area), "      " + color.name, _ButtonStyle);

            Drawing.DrawRect(preview, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(preview), MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(MenuUtilities.Inline(preview, 2), color.color);
            return(pressed);
        }
コード例 #16
0
        public static void CheckStyles()
        {
            if (_MenuTabStyle != null || !LoaderCoroutines.IsLoaded)
            {
                return;
            }

            _MenuTabStyle          = new GUIStyle();
            _MenuTabStyle.font     = MenuComponent._TabFont;
            _MenuTabStyle.fontSize = 29;

            _HeaderStyle           = new GUIStyle();
            _HeaderStyle.font      = MenuComponent._TabFont;
            _HeaderStyle.fontSize  = 15;
            _HeaderStyle.alignment = TextAnchor.MiddleCenter;

            _TextStyle          = new GUIStyle();
            _TextStyle.font     = MenuComponent._TextFont;
            _TextStyle.fontSize = 17;

            _sliderStyle                 = new GUIStyle();
            _sliderThumbStyle            = new GUIStyle(GUI.skin.horizontalSliderThumb);
            _sliderThumbStyle.fixedWidth = 7;

            _sliderVThumbStyle             = new GUIStyle(GUI.skin.verticalSliderThumb);
            _sliderVThumbStyle.fixedHeight = 7;

            _listStyle = new GUIStyle();
            _listStyle.padding.left = _listStyle.padding.right = _listStyle.padding.top = _listStyle.padding.bottom = 4;
            _listStyle.alignment    = TextAnchor.MiddleLeft;
            _listStyle.font         = MenuComponent._TextFont;
            _listStyle.fontSize     = 15;

            _ButtonStyle              = new GUIStyle();
            _ButtonStyle.alignment    = TextAnchor.MiddleLeft;
            _ButtonStyle.font         = MenuComponent._TextFont;
            _ButtonStyle.fontSize     = 15;
            _ButtonStyle.padding.left = _ButtonStyle.padding.right = _ButtonStyle.padding.top = _ButtonStyle.padding.bottom = 4;

            MenuUtilities.FixGUIStyleColor(_sliderStyle);
            MenuUtilities.FixGUIStyleColor(_MenuTabStyle);
            MenuUtilities.FixGUIStyleColor(_TextStyle);

            MenuComponent.SetGUIColors();
        }
コード例 #17
0
        void DoBorder()
        {
            Rect BlackOutline   = new Rect(0, 0, MenuRect.width, MenuRect.height);
            Rect LGrayOutline_1 = MenuUtilities.Inline(BlackOutline);
            Rect DGrayOutline   = MenuUtilities.Inline(LGrayOutline_1);
            Rect LGrayOutline_2 = MenuUtilities.Inline(DGrayOutline, 3);
            Rect Fill           = MenuUtilities.Inline(LGrayOutline_2);
            Rect TopLine1       = new Rect(Fill.x + 2, Fill.y + 2, Fill.width - 4, 2);
            Rect TopLine2       = new Rect(Fill.x + 2, Fill.y + 4, Fill.width - 4, 2);

            Drawing.DrawRect(BlackOutline, _OutlineBorderBlack);
            Drawing.DrawRect(LGrayOutline_1, _OutlineBorderLightGray);
            Drawing.DrawRect(DGrayOutline, _OutlineBorderDarkGray);
            Drawing.DrawRect(LGrayOutline_2, _OutlineBorderLightGray);
            Drawing.DrawRect(Fill, _FillLightBlack);
            Drawing.DrawRect(TopLine1, _Accent1);
            Drawing.DrawRect(TopLine2, _Accent2);
        }
コード例 #18
0
        public static void VerticalSlider(Rect pos, float top, float bottom, ref float value)
        {
            GUIStyle thumb     = _sliderVThumbStyle;
            GUIStyle slider    = _sliderStyle;
            float    thumbSize = thumb.fixedHeight != 0 ? thumb.fixedHeight : thumb.padding.vertical;
            float    start     = top;
            float    end       = bottom;

            value = GUI.VerticalSlider(pos, value, top, bottom, _sliderStyle, GUI.skin.verticalSliderThumb);
            Rect  position       = pos;
            float pixelsPerValue = (position.height - slider.padding.vertical - thumbSize) / (end - start);
            Rect  thumbRect      = new Rect(position.x + slider.padding.left, (value - start) * pixelsPerValue + position.y + slider.padding.top, position.width - slider.padding.horizontal, thumbSize);

            Drawing.DrawRect(position, MenuComponent._FillLightBlack);
            Drawing.DrawRect(new Rect(position.x + position.width / 2 - 2, position.y, 4, position.height), _ToggleBoxBG);
            Drawing.DrawRect(thumbRect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(thumbRect), _MenuTabStyle.onNormal.textColor);
        }
コード例 #19
0
    public static void DoBorder()
    {
        Rect rect      = new Rect(0f, 0f, MenuComponent.MenuRect.width, MenuComponent.MenuRect.height);
        Rect rect2     = MenuUtilities.Inline(rect, 1);
        Rect rect3     = MenuUtilities.Inline(rect2, 1);
        Rect rect4     = MenuUtilities.Inline(rect3, 3);
        Rect position  = MenuUtilities.Inline(rect4, 1);
        Rect position2 = new Rect(position.x + 2f, position.y + 2f, position.width - 4f, 2f);
        Rect position3 = new Rect(position.x + 2f, position.y + 4f, position.width - 4f, 2f);

        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(rect2, MenuComponent._OutlineBorderLightGray, null);
        Drawing.DrawRect(rect3, MenuComponent._OutlineBorderDarkGray, null);
        Drawing.DrawRect(rect4, MenuComponent._OutlineBorderLightGray, null);
        Drawing.DrawRect(position, MenuComponent._FillLightBlack, null);
        Drawing.DrawRect(position2, MenuComponent._Accent1, null);
        Drawing.DrawRect(position3, MenuComponent._Accent2, null);
    }
コード例 #20
0
        public static void Slider(float left, float right, ref float value, int size)
        {
            GUIStyle thumb     = _sliderThumbStyle;
            GUIStyle slider    = _sliderStyle;
            float    thumbSize = thumb.fixedWidth != 0 ? thumb.fixedWidth : thumb.padding.horizontal;
            float    start     = left;
            float    end       = right;

            value = GUILayout.HorizontalSlider(value, left, right, GUI.skin.horizontalSlider, GUI.skin.horizontalSliderThumb, GUILayout.Width(size));
            Rect  position       = GUILayoutUtility.GetLastRect();
            float pixelsPerValue = (position.width - slider.padding.horizontal - thumbSize) / (end - start);
            Rect  thumbRect      = new Rect((value - start) * pixelsPerValue + position.x + slider.padding.left, position.y + slider.padding.top, thumbSize, position.height - slider.padding.vertical);

            Drawing.DrawRect(position, MenuComponent._FillLightBlack);
            Drawing.DrawRect(new Rect(position.x, position.y + position.height / 2 - 2, position.width, 4), _ToggleBoxBG);
            Drawing.DrawRect(thumbRect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(thumbRect), _MenuTabStyle.onNormal.textColor);
            GUILayout.Space(5);
        }
コード例 #21
0
        // Token: 0x06000233 RID: 563 RVA: 0x000152E8 File Offset: 0x000134E8
        public static bool Toggle(string text, ref bool state, int fontsize = 17)
        {
            bool result   = false;
            int  num      = 1;
            int  num2     = 15;
            int  fontSize = Prefab._TextStyle.fontSize;

            Prefab._TextStyle.fontSize = fontsize;
            GUILayout.Space(3f);
            Rect rect     = GUILayoutUtility.GetRect(150f, 15f);
            Rect rect2    = new Rect(rect.x + (float)num, rect.y + (float)num, (float)(num2 - num * 2), (float)(num2 - num * 2));
            Rect position = MenuUtilities.Inline(rect2, 1);

            Drawing.DrawRect(rect2, MenuComponent._OutlineBorderBlack, null);
            Drawing.DrawRect(position, Prefab._ToggleBoxBG, null);
            bool flag  = GUI.Button(rect, GUIContent.none, Prefab._TextStyle);
            bool flag2 = flag;

            if (flag2)
            {
                state  = !state;
                result = true;
            }
            bool flag3 = Event.current.type == EventType.Repaint;
            bool flag4 = flag3;

            if (flag4)
            {
                bool flag5    = rect.Contains(Event.current.mousePosition);
                bool isActive = flag5 && Input.GetMouseButton(0);
                Prefab._TextStyle.Draw(new Rect(rect.x + 20f, rect.y, 130f, (float)num2), text, flag5, isActive, false, false);
            }
            Prefab._TextStyle.fontSize = fontSize;
            bool flag6 = state;
            bool flag7 = flag6;

            if (flag7)
            {
                Drawing.DrawRect(position, MenuComponent._Accent2, null);
            }
            return(result);
        }
コード例 #22
0
    public static void Slider(float left, float right, ref float value, int size)
    {
        GUIStyle sliderThumbStyle = Prefab._sliderThumbStyle;
        GUIStyle sliderStyle      = Prefab._sliderStyle;
        float    num = (sliderThumbStyle.fixedWidth != 0f) ? sliderThumbStyle.fixedWidth : sliderThumbStyle.padding.horizontal;

        value = GUILayout.HorizontalSlider(value, left, right, GUI.skin.horizontalSlider, GUI.skin.horizontalSliderThumb, new GUILayoutOption[]
        {
            GUILayout.Width(size)
        });
        Rect  lastRect = GUILayoutUtility.GetLastRect();
        float num2     = (lastRect.width - sliderStyle.padding.horizontal - num) / (right - left);
        Rect  rect     = new Rect((value - left) * num2 + lastRect.x + sliderStyle.padding.left, lastRect.y + sliderStyle.padding.top, num, lastRect.height - sliderStyle.padding.vertical);

        Drawing.DrawRect(lastRect, MenuComponent._FillLightBlack, null);
        Drawing.DrawRect(new Rect(lastRect.x, lastRect.y + lastRect.height / 2f - 2f, lastRect.width, 4f), Prefab._ToggleBoxBG, null);
        Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
        Drawing.DrawRect(MenuUtilities.Inline(rect, 1), Prefab._MenuTabStyle.onNormal.textColor, null);
        GUILayout.Space(5f);
    }
コード例 #23
0
        public static void MenuArea(Rect area, string header, Action code)
        {
            Rect DarkOutline  = new Rect(area.x, area.y + 5, area.width, area.height - 5);
            Rect LightOutline = MenuUtilities.Inline(DarkOutline);
            Rect Filler       = MenuUtilities.Inline(LightOutline);

            Drawing.DrawRect(DarkOutline, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(LightOutline, MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(Filler, MenuComponent._FillLightBlack);
            Vector2 size = _HeaderStyle.CalcSize(new GUIContent(header));

            Drawing.DrawRect(new Rect(area.x + 18, area.y, size.x + 4, size.y), MenuComponent._FillLightBlack);
            GUI.Label(new Rect(area.x + 20, area.y - 3, size.x, size.y), header, _HeaderStyle);
            GUILayout.BeginArea(area);
            GUILayout.BeginHorizontal();
            GUILayout.Space(15);
            GUILayout.BeginVertical();
            GUILayout.Space(20);
            try { code(); }
            catch (Exception e) { Debug.LogException(e); }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
コード例 #24
0
 void TriggerOverflowMenu()
 {
     var(x, y) = MenuUtilities.GetMenuPosition(m_OverflowButton, MenuUtilities.AnchorPoint.BottomRight);
     OnOverflowButtonClicked?.Invoke(x, y);
 }
コード例 #25
0
        // Token: 0x0600024A RID: 586 RVA: 0x00016AD0 File Offset: 0x00014CD0
        public static void Tab()
        {
            bool flag  = ColorOptions.selectedOption == null;
            bool flag2 = flag;

            if (flag2)
            {
                ColorOptions.previewselected = ColorOptions.preview;
            }
            Prefab.ScrollView(new Rect(0f, 0f, 250f, 436f), "Цвета", ref ColorsTab.ColorScroll, delegate()
            {
                GUILayout.Space(10f);
                List <KeyValuePair <string, ColorVariable> > list = ColorOptions.ColorDict.ToList <KeyValuePair <string, ColorVariable> >();
                list.Sort((KeyValuePair <string, ColorVariable> pair1, KeyValuePair <string, ColorVariable> pair2) => string.Compare(pair1.Value.name, pair2.Value.name, StringComparison.Ordinal));
                for (int i = 0; i < list.Count; i++)
                {
                    ColorVariable color = ColorUtilities.getColor(list[i].Value.identity);
                    bool flag3          = Prefab.ColorButton(205f, color, 25f, Array.Empty <GUILayoutOption>());
                    bool flag4          = flag3;
                    if (flag4)
                    {
                        ColorOptions.selectedOption  = color.identity;
                        ColorOptions.previewselected = new ColorVariable(color);
                        ColorsTab.LastColorPreview1  = color.color;
                    }
                    GUILayout.Space(3f);
                }
                bool flag5 = Prefab.Button("Восстановить по умолчанию", 205f, 25f, Array.Empty <GUILayoutOption>());
                bool flag6 = flag5;
                if (flag6)
                {
                    for (int j = 0; j < list.Count; j++)
                    {
                        ColorVariable color2 = ColorUtilities.getColor(list[j].Value.identity);
                        color2.color         = color2.origColor;
                        MenuComponent.SetGUIColors();
                        ColorOptions.selectedOption = null;
                        ColorsTab.LastColorPreview1 = ColorOptions.preview.color;
                    }
                }
                GUILayout.Space(10f);
            }, 20, Array.Empty <GUILayoutOption>());
            Rect previewRect = new Rect(255f, 0f, 211f, 120f);

            Prefab.MenuArea(previewRect, "Предпросмотр", delegate
            {
                Rect rect = new Rect(5f, 20f, previewRect.width - 10f, previewRect.height - 25f);
                Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack, null);
                Drawing.DrawRect(MenuUtilities.Inline(rect, 1), MenuComponent._OutlineBorderLightGray, null);
                Rect rect2 = MenuUtilities.Inline(rect, 2);
                Drawing.DrawRect(new Rect(rect2.x, rect2.y, rect2.width / 2f, rect2.height), ColorsTab.LastColorPreview1, null);
                Drawing.DrawRect(new Rect(rect2.x + rect2.width / 2f, rect2.y, rect2.width / 2f, rect2.height), ColorOptions.previewselected, null);
            });
            Prefab.MenuArea(new Rect(previewRect.x, previewRect.y + previewRect.height + 5f, previewRect.width, 436f - previewRect.height - 5f), ColorOptions.previewselected.name, delegate
            {
                GUILayout.BeginArea(new Rect(10f, 20f, previewRect.width - 10f, 205f));
                ColorOptions.previewselected.color.r = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.r, "R: ", 30, 0, 255));
                ColorOptions.previewselected.color.r = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.r, 185)));
                GUILayout.FlexibleSpace();
                ColorOptions.previewselected.color.g = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.g, "G: ", 30, 0, 255));
                ColorOptions.previewselected.color.g = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.g, 185)));
                GUILayout.FlexibleSpace();
                ColorOptions.previewselected.color.b = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.b, "B: ", 30, 0, 255));
                ColorOptions.previewselected.color.b = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.b, 185)));
                GUILayout.FlexibleSpace();
                bool flag3 = !ColorOptions.previewselected.disableAlpha;
                bool flag4 = flag3;
                if (flag4)
                {
                    ColorOptions.previewselected.color.a = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.a, "A: ", 30, 0, 255));
                    ColorOptions.previewselected.color.a = (int)((byte)Mathf.Round(Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.a, 185)));
                }
                else
                {
                    Prefab.TextField(ColorOptions.previewselected.color.a, "A: ", 30, 0, 255);
                    Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.a, 185);
                }
                GUILayout.Space(100f);
                GUILayout.EndArea();
                GUILayout.Space(160f);
                GUILayout.FlexibleSpace();
                bool flag5 = Prefab.Button("Отменить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag6 = flag5;
                if (flag6)
                {
                    ColorOptions.selectedOption = null;
                    ColorsTab.LastColorPreview1 = ColorOptions.preview.color;
                }
                GUILayout.Space(3f);
                bool flag7 = Prefab.Button("Восстановить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag8 = flag7;
                if (flag8)
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.origColor);
                    ColorOptions.previewselected.color = ColorOptions.previewselected.origColor;
                    MenuComponent.SetGUIColors();
                }
                GUILayout.Space(3f);
                bool flag9  = Prefab.Button("Применить", 180f, 25f, Array.Empty <GUILayoutOption>());
                bool flag10 = flag9;
                if (flag10)
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.color);
                    MenuComponent.SetGUIColors();
                    ColorsTab.LastColorPreview1 = ColorOptions.previewselected.color;
                }
                GUILayout.Space(30f);
            });
        }
コード例 #26
0
 public static Rect AbsRect(Vector2 pos1, Vector2 pos2)
 {
     return(MenuUtilities.AbsRect(pos1.x, pos1.y, pos2.x, pos2.y));
 }
コード例 #27
0
 public static bool AbsButton(Rect area, string text, params GUILayoutOption[] options)
 {
     Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack, null);
     return(GUI.Button(MenuUtilities.Inline(area, 1), text, Prefab._ButtonStyle));
 }