示例#1
0
        // Token: 0x0600020C RID: 524 RVA: 0x00013DF8 File Offset: 0x00011FF8
        public static bool Toggle(string text, ref bool state)
        {
            bool result   = false;
            int  num      = 15;
            int  fontSize = Prefab._TextStyle.fontSize;

            Prefab._TextStyle.fontSize = 17;
            float x = Prefab._TextStyle.CalcSize(new GUIContent(text)).x;

            GUILayout.Space(3f);
            Rect rect     = GUILayoutUtility.GetRect(x, 15f);
            Rect rect2    = new Rect(rect.x + 1f, rect.y + 1f, 13f, 13f);
            Rect position = MenuUtilities.Inline(rect2, 1f);

            Drawing.DrawRect(rect2, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(position, Prefab._ToggleBoxBG);
            if (GUI.Button(rect, GUIContent.none, Prefab._TextStyle))
            {
                state  = !state;
                result = true;
            }
            if (Event.current.type == EventType.Repaint)
            {
                bool isHover;
                bool isActive = (isHover = rect.Contains(Event.current.mousePosition)) && Input.GetMouseButton(0);
                Prefab._TextStyle.Draw(new Rect(rect.x + 20f, rect.y, x, (float)num), text, isHover, isActive, false, false);
            }
            Prefab._TextStyle.fontSize = fontSize;
            if (state)
            {
                Drawing.DrawRect(position, MenuComponent._Accent2);
            }
            return(result);
        }
示例#2
0
        // Token: 0x06000211 RID: 529 RVA: 0x000144EC File Offset: 0x000126EC
        public static int Arrows(float width, int listEntry, string content, int max)
        {
            Rect rect = GUILayoutUtility.GetRect(width, 25f, new GUILayoutOption[]
            {
                GUILayout.Height(25f),
                GUILayout.Width(width)
            });

            if (Prefab.Button("<", new Rect(rect.x, rect.y, 25f, 25f)))
            {
                listEntry--;
            }
            GUI.Label(MenuUtilities.Inline(new Rect(rect.x + 25f, rect.y, rect.width - 50f, 25f), 1f), content, Prefab._listStyle);
            if (Prefab.Button(">", new Rect(rect.x + rect.width - 25f, rect.y, 25f, 25f)))
            {
                listEntry++;
            }
            if (listEntry >= 0)
            {
                if (listEntry > max)
                {
                    listEntry = 0;
                }
            }
            else
            {
                listEntry = max;
            }
            return(listEntry);
        }
示例#3
0
        // Token: 0x0600020A RID: 522 RVA: 0x00013C68 File Offset: 0x00011E68
        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, 1f);

            Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(rect2, MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(MenuUtilities.Inline(rect2, 1f), MenuComponent._FillLightBlack);
            Vector2 vector = Prefab._HeaderStyle.CalcSize(new GUIContent(header));

            Drawing.DrawRect(new Rect(area.x + 19f, area.y, vector.x + 2f, vector.y), MenuComponent._FillLightBlack);
            GUI.Label(new Rect(area.x + 20f, area.y - 3f, vector.x, vector.y), header, Prefab._HeaderStyle);
            GUILayout.BeginArea(area);
            GUILayout.BeginHorizontal(Array.Empty <GUILayoutOption>());
            GUILayout.Space(15f);
            GUILayout.BeginVertical(Array.Empty <GUILayoutOption>());
            GUILayout.Space(20f);
            try
            {
                code();
            }
            catch (Exception exception)
            {
                Debug.LogException(exception);
            }
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
示例#4
0
        // Token: 0x06000218 RID: 536 RVA: 0x00014AD8 File Offset: 0x00012CD8
        public static void ScrollView(Rect area, string title, ref SerializableVector2 scrollpos, Action code, int padding = 20)
        {
            Drawing.DrawRect(area, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(area, 1f), MenuComponent._OutlineBorderLightGray);
            Rect rect = MenuUtilities.Inline(area, 2f);

            Drawing.DrawRect(rect, MenuComponent._FillLightBlack);
            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);
            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.ToVector2(), 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);
            if (lastRect.height - lastRect2.height > 0f)
            {
                Prefab.VerticalSlider(new Rect(lastRect2.x + 4f, lastRect2.y + 8f, 12f, lastRect2.height - 14f), 0f, lastRect.height - lastRect2.height, ref scrollpos.y);
            }
            GUILayout.EndArea();
        }
示例#5
0
        // Token: 0x06000212 RID: 530 RVA: 0x000145DC File Offset: 0x000127DC
        public static bool Button(string text, float width, float height = 25f)
        {
            Rect rect = GUILayoutUtility.GetRect(width, height, new GUILayoutOption[]
            {
                GUILayout.Height(height),
                GUILayout.Width(width)
            });

            Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
            return(GUI.Button(MenuUtilities.Inline(rect, 1f), text, Prefab._ButtonStyle));
        }
示例#6
0
        // Token: 0x0600020F RID: 527 RVA: 0x00014130 File Offset: 0x00012330
        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 : ((float)sliderVThumbStyle.padding.vertical);

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

            Drawing.DrawRect(position, MenuComponent._FillLightBlack);
            Drawing.DrawRect(new Rect(position.x + position.width / 2f - 2f, position.y, 4f, position.height), Prefab._ToggleBoxBG);
            Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(rect, 1f), Prefab._MenuTabStyle.onNormal.textColor);
        }
示例#7
0
        // Token: 0x06000152 RID: 338 RVA: 0x0000EF8C File Offset: 0x0000D18C
        private void DoBorder()
        {
            Rect rect     = new Rect(0f, 0f, MenuComponent.MenuRect.width, MenuComponent.MenuRect.height);
            Rect rect2    = MenuUtilities.Inline(rect, 1f);
            Rect rect3    = MenuUtilities.Inline(rect2, 1f);
            Rect rect4    = MenuUtilities.Inline(rect3, 3f);
            Rect position = MenuUtilities.Inline(rect4, 1f);

            Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(rect2, MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(rect3, MenuComponent._OutlineBorderDarkGray);
            Drawing.DrawRect(rect4, MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(position, MenuComponent._FillLightBlack);
            Drawing.DrawRect(new Rect(position.x + 2f, position.y + 2f, position.width - 4f, 2f), MenuComponent._Accent1);
            Drawing.DrawRect(new Rect(position.x + 2f, position.y + 4f, position.width - 4f, 2f), MenuComponent._Accent2);
        }
示例#8
0
        // Token: 0x06000214 RID: 532 RVA: 0x00014630 File Offset: 0x00012830
        public static bool ColorButton(float width, ColorVariable color, float height = 25f)
        {
            Rect rect = GUILayoutUtility.GetRect(width, height, new GUILayoutOption[]
            {
                GUILayout.Height(height),
                GUILayout.Width(width)
            });

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

            Drawing.DrawRect(rect2, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(rect2, 1f), MenuComponent._OutlineBorderLightGray);
            Drawing.DrawRect(MenuUtilities.Inline(rect2, 2f), color.color);
            return(result);
        }
示例#9
0
        // Token: 0x0600020D RID: 525 RVA: 0x00013F40 File Offset: 0x00012140
        public static void ToggleLast(ref bool state)
        {
            Rect lastRect = GUILayoutUtility.GetLastRect();

            lastRect = new Rect(lastRect.x + 161f, lastRect.y - 14f, 13f, 13f);
            Rect position = MenuUtilities.Inline(lastRect, 1f);

            Drawing.DrawRect(lastRect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(position, Prefab._ToggleBoxBG);
            if (GUI.Button(lastRect, GUIContent.none, Prefab._TextStyle))
            {
                state = !state;
            }
            if (state)
            {
                Drawing.DrawRect(position, MenuComponent._Accent2);
            }
        }
示例#10
0
        // Token: 0x0600020E RID: 526 RVA: 0x00013FD8 File Offset: 0x000121D8
        public static float Slider(float left, float right, float value, int size)
        {
            GUIStyle sliderThumbStyle = Prefab._sliderThumbStyle;
            GUIStyle sliderStyle      = Prefab._sliderStyle;
            float    num = (sliderThumbStyle.fixedWidth != 0f) ? sliderThumbStyle.fixedWidth : ((float)sliderThumbStyle.padding.horizontal);

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

            Drawing.DrawRect(lastRect, MenuComponent._FillLightBlack);
            Drawing.DrawRect(new Rect(lastRect.x, lastRect.y + lastRect.height / 2f - 2f, lastRect.width, 4f), Prefab._ToggleBoxBG);
            Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
            Drawing.DrawRect(MenuUtilities.Inline(rect, 1f), Prefab._MenuTabStyle.onNormal.textColor);
            return(value);
        }
示例#11
0
 // Token: 0x06000213 RID: 531 RVA: 0x0000477D File Offset: 0x0000297D
 public static bool Button(string text, Rect rect)
 {
     Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
     return(GUI.Button(MenuUtilities.Inline(rect, 1f), text, Prefab._ButtonStyle));
 }
示例#12
0
        // Token: 0x06000205 RID: 517 RVA: 0x00013598 File Offset: 0x00011798
        static Prefab()
        {
            Prefab._None = new GUIStyle();
            Prefab._None.normal.background = null;
            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 = 16
            };
            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
            {
                alignment = TextAnchor.MiddleCenter,
                font      = MenuComponent._TextFont,
                fontSize  = 15
            };
            RectOffset padding  = Prefab._listStyle.padding;
            RectOffset padding2 = Prefab._listStyle.padding;
            RectOffset padding3 = Prefab._listStyle.padding;

            Prefab._listStyle.padding.bottom = 4;
            padding3.top        = 4;
            padding2.right      = 4;
            padding.left        = 4;
            Prefab._ButtonStyle = new GUIStyle
            {
                alignment = TextAnchor.MiddleLeft,
                font      = MenuComponent._TextFont,
                fontSize  = 15
            };
            RectOffset padding4 = Prefab._ButtonStyle.padding;
            RectOffset padding5 = Prefab._ButtonStyle.padding;
            RectOffset padding6 = Prefab._ButtonStyle.padding;

            Prefab._ButtonStyle.padding.bottom = 4;
            padding6.top   = 4;
            padding5.right = 4;
            padding4.left  = 4;
            MenuUtilities.FixGUIStyleColor(Prefab._sliderStyle);
            MenuUtilities.FixGUIStyleColor(Prefab._MenuTabStyle);
            MenuUtilities.FixGUIStyleColor(Prefab._TextStyle);
            Prefab.UpdateColors();
            Fonts.Apply();
        }
示例#13
0
        // Token: 0x06000083 RID: 131 RVA: 0x00008BD8 File Offset: 0x00006DD8
        public static void Tab()
        {
            ColorOptions.errorColor = new ColorVariable("errorColor", "#ERROR.NOTFOUND", Color.magenta, true);
            ColorOptions.preview    = new ColorVariable("preview", "Цвет не выбран", Color.white, true);
            if (ColorOptions.selectedOption == null)
            {
                ColorOptions.previewselected = ColorOptions.preview;
            }
            Prefab.ScrollView(new Rect(0f, 0f, 395f, 406f), "Цвета", ref ColorsTab.ColorScroll, delegate()
            {
                GUILayout.Space(10f);
                List <KeyValuePair <string, ColorVariable> > list = ColorOptions.ColorDict2.ToList <KeyValuePair <string, ColorVariable> >();
                list.Sort((KeyValuePair <string, ColorVariable> pair1, KeyValuePair <string, ColorVariable> pair2) => pair1.Value.name.CompareTo(pair2.Value.name));
                for (int i = 0; i < list.Count; i++)
                {
                    ColorVariable color = ColorUtilities.getColor(list[i].Value.identity);
                    if (Prefab.ColorButton(350f, color, 25f))
                    {
                        ColorOptions.selectedOption  = color.identity;
                        ColorOptions.previewselected = new ColorVariable(color);
                        ColorsTab.LastColorPreview1  = color.color;
                    }
                    GUILayout.Space(3f);
                }
                if (Prefab.Button("Восстановить цвета", 350f, 25f))
                {
                    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);
            Rect previewRect = new Rect(400f, 0f, 211f, 120f);

            Prefab.MenuArea(previewRect, "Просмотр", delegate
            {
                Rect rect = new Rect(5f, 20f, previewRect.width - 10f, previewRect.height - 25f);
                Drawing.DrawRect(rect, MenuComponent._OutlineBorderBlack);
                Drawing.DrawRect(MenuUtilities.Inline(rect, 1f), MenuComponent._OutlineBorderLightGray);
                Rect rect2 = MenuUtilities.Inline(rect, 2f);
                Drawing.DrawRect(new Rect(rect2.x, rect2.y, rect2.width / 2f, rect2.height), ColorsTab.LastColorPreview1);
                Drawing.DrawRect(new Rect(rect2.x + rect2.width / 2f, rect2.y, rect2.width / 2f, rect2.height), ColorOptions.previewselected);
            });
            Prefab.MenuArea(new Rect(previewRect.x, previewRect.y + previewRect.height + 5f, previewRect.width, 406f - 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)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)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)Prefab.Slider(0f, 255f, (float)ColorOptions.previewselected.color.b, 185));
                GUILayout.FlexibleSpace();
                if (!ColorOptions.previewselected.disableAlpha)
                {
                    ColorOptions.previewselected.color.a = (int)((byte)Prefab.TextField(ColorOptions.previewselected.color.a, "A: ", 30, 0, 255));
                    ColorOptions.previewselected.color.a = (int)((byte)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();
                if (Prefab.Button("Снять выделение", 180f, 25f))
                {
                    ColorOptions.selectedOption = null;
                    ColorsTab.LastColorPreview1 = ColorOptions.preview.color;
                }
                GUILayout.Space(3f);
                if (Prefab.Button("Восстановить", 180f, 25f))
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.origColor.ToColor());
                    ColorOptions.previewselected.color = ColorOptions.previewselected.origColor;
                    MenuComponent.SetGUIColors();
                }
                GUILayout.Space(3f);
                if (Prefab.Button("Применить", 180f, 25f))
                {
                    ColorUtilities.setColor(ColorOptions.previewselected.identity, ColorOptions.previewselected.color.ToColor());
                    MenuComponent.SetGUIColors();
                    ColorsTab.LastColorPreview1 = ColorOptions.previewselected.color;
                }
                GUILayout.Space(30f);
            });
        }