/// <summary>
        /// Call this inside a <see cref="MonoBehaviour.OnGUI"/> method.
        /// </summary>
        public void OnGUI()
        {
            if (!Enabled)
            {
                return;
            }

            GUISkin skin     = GUI.skin;
            string  skinName = GetSkinName();

            switch (SkinCreationOptions)
            {
            case GUISkinCreationOptions.DEFAULT:
                skin = GUISkinUtils.RegisterDerivedOnce("debuggers.default", s =>
                {
                    SetBaseStyle(s);
                    OnSetSkinImpl(s);
                });
                break;

            case GUISkinCreationOptions.UNITYCOPY:
                skin = GUISkinUtils.RegisterDerivedOnce(skinName, OnSetSkinImpl);
                break;

            case GUISkinCreationOptions.DERIVEDCOPY:
                GUISkin baseSkin = GUISkinUtils.RegisterDerivedOnce("debuggers.default", SetBaseStyle);
                skin = GUISkinUtils.RegisterDerivedOnce(skinName, OnSetSkinImpl, baseSkin);
                break;
            }
            GUISkinUtils.RenderWithSkin(skin, () =>
            {
                WindowRect = GUILayout.Window(GUIUtility.GetControlID(FocusType.Keyboard), WindowRect, RenderInternal, $"[DEBUGGER] {DebuggerName}", GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
            });
        }
Exemple #2
0
        /// <summary>
        /// Gets (a copy of) a skin specified by <see cref="GUISkinCreationOptions"/>.
        /// </summary>
        /// <returns>A reference to an existing or copied skin.</returns>
        private GUISkin GetSkin()
        {
            GUISkin skin     = GUI.skin;
            string  skinName = GetSkinName();

            switch (SkinCreationOptions)
            {
            case GUISkinCreationOptions.DEFAULT:
                skin = GUISkinUtils.RegisterDerivedOnce("debuggers.default", s =>
                {
                    SetBaseStyle(s);
                    OnSetSkinImpl(s);
                });
                break;

            case GUISkinCreationOptions.UNITYCOPY:
                skin = GUISkinUtils.RegisterDerivedOnce(skinName, OnSetSkinImpl);
                break;

            case GUISkinCreationOptions.DERIVEDCOPY:
                GUISkin baseSkin = GUISkinUtils.RegisterDerivedOnce("debuggers.default", SetBaseStyle);
                skin = GUISkinUtils.RegisterDerivedOnce(skinName, OnSetSkinImpl, baseSkin);
                break;
            }

            return(skin);
        }
Exemple #3
0
        private GUISkin GetGUISkin(string skinName, int labelWidth)
        {
            return(GUISkinUtils.RegisterDerivedOnce(skinName, s => {
                s.textField.fontSize = 14;
                s.textField.richText = false;
                s.textField.alignment = TextAnchor.MiddleLeft;
                s.textField.wordWrap = true;
                s.textField.stretchHeight = true;
                s.textField.padding = new RectOffset(10, 10, 5, 5);

                s.label.fontSize = 14;
                s.label.alignment = TextAnchor.MiddleRight;
                s.label.stretchHeight = true;
                s.label.fixedWidth = labelWidth;

                s.button.fontSize = 14;
                s.button.stretchHeight = true;
            }));
        }
Exemple #4
0
        private GUISkin GetGUISkin()
        {
            return(GUISkinUtils.RegisterDerivedOnce("menus.server", s =>
            {
                s.textField.fontSize = 14;
                s.textField.richText = false;
                s.textField.alignment = TextAnchor.MiddleLeft;
                s.textField.wordWrap = true;
                s.textField.stretchHeight = true;
                s.textField.padding = new RectOffset(10, 10, 5, 5);

                s.label.fontSize = 14;
                s.label.alignment = TextAnchor.MiddleRight;
                s.label.stretchHeight = true;
                s.label.fixedWidth = 80; //change this when adding new labels that need more space.

                s.button.fontSize = 14;
                s.button.stretchHeight = true;
            }));
        }