Exemplo n.º 1
0
        public void OnGUI()
        {
            if (!m_generatedLabels)
            {
                GenerateLabels();
            }

            UIStyles.HorizontalLine(Color.grey);

            GUILayout.BeginHorizontal();

            if (GUILayout.Button(m_isExpanded ? "Less" : "More", GUILayout.Width(50)))
            {
                m_isExpanded = !m_isExpanded;
            }

            GUILayout.Label($"{m_weaponName} | <b>Damage:</b> {Damage.TotalDamage} | <b>DPS:</b> {DPS}");

            GUILayout.EndHorizontal();

            if (m_isExpanded)
            {
                GUILayout.Label(m_longDescription);
            }
        }
 public override void OnGUI()
 {
     if (!m_picking)
     {
         if (GUILayout.Button("Choose Allowed Weapon-Types", GUILayout.Width(200)))
         {
             m_picking = true;
         }
     }
     else
     {
         if (GUILayout.Button("< Back", GUILayout.Width(100)))
         {
             m_picking = false;
         }
         else
         {
             base.OnGUI();
             UIStyles.HorizontalLine(Color.grey);
         }
     }
 }
Exemplo n.º 3
0
        // =========== GUI DRAW =========== //

        public override void WindowFunction(int windowID)
        {
            try
            {
                // ====== HEADER ======

                var rect = WindowManager.TabView ? TabViewWindow.Instance.m_rect : this.m_rect;

                if (!WindowManager.TabView)
                {
                    Header();
                    GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
                }

                var asInstance = this as InstanceInspector;

                GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
                var labelWidth = (asInstance != null && asInstance.m_uObj)
                    ? new GUILayoutOption[] { GUILayout.Width(245f) }
                    : new GUILayoutOption[0];
                GUILayout.Label("<b>Type:</b> <color=cyan>" + TargetType.FullName + "</color>", labelWidth);

                if (asInstance != null)
                {
                    asInstance.DrawInstanceControls(rect);
                }
                else
                {
                    GUILayout.EndHorizontal();
                }

                UIStyles.HorizontalLine(Color.grey);

                GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("<b>Search:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
                m_search = GUIUnstrip.TextField(m_search, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();

                GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("<b>Filter:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
                FilterTypeToggle(MemberTypes.All, "All");
                FilterTypeToggle(MemberTypes.Property, "Properties");
                FilterTypeToggle(MemberTypes.Field, "Fields");
                FilterTypeToggle(MemberTypes.Method, "Methods");
                GUILayout.EndHorizontal();

                if (this is InstanceInspector)
                {
                    GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
                    GUILayout.Label("<b>Scope:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
                    FilterScopeToggle(MemberScopes.Both, "Both");
                    FilterScopeToggle(MemberScopes.Instance, "Instance");
                    FilterScopeToggle(MemberScopes.Static, "Static");
                    GUILayout.EndHorizontal();
                }

                GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Label("<b>Values:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
                if (GUILayout.Button("Update", new GUILayoutOption[] { GUILayout.Width(100) }))
                {
                    UpdateValues();
                }
                GUI.color              = m_autoUpdate ? Color.green : Color.red;
                m_autoUpdate           = GUILayout.Toggle(m_autoUpdate, "Auto-update?", new GUILayoutOption[] { GUILayout.Width(100) });
                GUI.color              = m_hideFailedReflection ? Color.green : Color.red;
                m_hideFailedReflection = GUILayout.Toggle(m_hideFailedReflection, "Hide failed Reflection?", new GUILayoutOption[] { GUILayout.Width(150) });
                GUI.color              = Color.white;
                GUILayout.EndHorizontal();

                GUIUnstrip.Space(10);

                Pages.ItemCount = m_cachedMembersFiltered.Length;

                // prev/next page buttons
                GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);

                Pages.DrawLimitInputArea();

                if (Pages.ItemCount > Pages.ItemsPerPage)
                {
                    if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) }))
                    {
                        Pages.TurnPage(Turn.Left, ref this.scroll);
                    }

                    Pages.CurrentPageLabel();

                    if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) }))
                    {
                        Pages.TurnPage(Turn.Right, ref this.scroll);
                    }
                }
                GUILayout.EndHorizontal();

                // ====== BODY ======

                scroll = GUIUnstrip.BeginScrollView(scroll);

                GUIUnstrip.Space(10);

                UIStyles.HorizontalLine(Color.grey);

                GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, null);

                var members = this.m_cachedMembersFiltered;
                int start   = Pages.CalculateOffsetIndex();

                for (int j = start; (j < start + Pages.ItemsPerPage && j < members.Length); j++)
                {
                    var holder = members[j];

                    GUIUnstrip.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(25) });
                    try
                    {
                        holder.Draw(rect, 180f);
                    }
                    catch
                    {
                        GUILayout.EndHorizontal();
                        continue;
                    }
                    GUILayout.EndHorizontal();

                    // if not last element
                    if (!(j == (start + Pages.ItemsPerPage - 1) || j == (members.Length - 1)))
                    {
                        UIStyles.HorizontalLine(new Color(0.07f, 0.07f, 0.07f), true);
                    }
                }

                GUILayout.EndVertical();
                GUIUnstrip.EndScrollView();

                if (!WindowManager.TabView)
                {
                    m_rect = ResizeDrag.ResizeWindow(rect, windowID);

                    GUIUnstrip.EndArea();
                }
            }
            catch (Exception e) when(e.Message.Contains("in a group with only"))
            {
                // suppress
            }
            catch (Exception e)
            {
                ExplorerCore.LogWarning("Exception drawing ReflectionWindow: " + e.GetType() + ", " + e.Message);
                DestroyWindow();
                return;
            }
        }
Exemplo n.º 4
0
        public override void DrawWindow()
        {
            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUILayout.Label("<color=orange><size=16><b>Options</b></size></color>", new GUILayoutOption[0]);
            GUI.skin.label.alignment = TextAnchor.MiddleLeft;

            GUIHelper.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Menu Toggle Key:", new GUILayoutOption[] { GUILayout.Width(215f) });
            toggleKeyInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            UIStyles.HorizontalLine(Color.black, true);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Default Window Size:", new GUILayoutOption[] { GUILayout.Width(215f) });
            defaultSizeInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            UIStyles.HorizontalLine(Color.black, true);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Default Items per Page:", new GUILayoutOption[] { GUILayout.Width(215f) });
            defaultPageLimitInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            UIStyles.HorizontalLine(Color.black, true);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Enable Bitwise Editing:", new GUILayoutOption[] { GUILayout.Width(215f) });
            bitwiseSupportInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            UIStyles.HorizontalLine(Color.black, true);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Enable Tab View:", new GUILayoutOption[] { GUILayout.Width(215f) });
            tabViewInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            UIStyles.HorizontalLine(Color.black, true);

            GUIHelper.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label($"Default Output Path:", new GUILayoutOption[] { GUILayout.Width(215f) });
            defaultOutputPathInput.IValue.DrawValue(MainMenu.MainRect, MainMenu.MainRect.width - 215f);
            GUILayout.EndHorizontal();

            if (GUILayout.Button("<color=lime><b>Apply and Save</b></color>", new GUILayoutOption[0]))
            {
                ApplyAndSave();
            }

            GUILayout.EndVertical();

            GUIHelper.Space(10f);

            GUI.skin.label.alignment = TextAnchor.MiddleCenter;
            GUILayout.Label("<color=orange><size=16><b>Other</b></size></color>", new GUILayoutOption[0]);
            GUI.skin.label.alignment = TextAnchor.MiddleLeft;

            GUIHelper.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);

            if (GUILayout.Button("Inspect Test Class", new GUILayoutOption[0]))
            {
                WindowManager.InspectObject(Tests.TestClass.Instance, out bool _);
            }

            GUILayout.EndVertical();
        }