Label() public static method

public static Label ( GUIContent content ) : void
content GUIContent
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Draws a dummy GUI layout element and measures its rect.
        /// If the current event is not the repaint event, then use the backup rect reference.
        /// </summary>
        public static U.Rect FindLayoutAreaRect(ref U.Rect backupRect, int border = 0)
        {
            //DRAW DUMMY LAYOUT GROUP TO GET THE RECT FROM
            Gl.BeginVertical(Gl.MaxWidth(U.Screen.width), Gl.MaxHeight(U.Screen.height));
            Gl.Label("");             //<- layout dummy
            Gl.EndVertical();
            U.Rect _fieldRect = U.GUILayoutUtility.GetLastRect();

            //rect update handling (ignore dummy rect at layout event)
            if (U.Event.current.type != U.EventType.Repaint)
            {
                _fieldRect = backupRect;
            }
            else
            {
                backupRect = _fieldRect;
            }

            _fieldRect.x      += border;
            _fieldRect.y      += border;
            _fieldRect.width  -= border * 2;
            _fieldRect.height -= border * 2;

            return(_fieldRect);
        }
    protected override void DoSpecializedGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label(string.Format("Text (Length: {0})", m_Text.Length), Styles.BoldLabel);
        GUILayout.Label(m_Text, Styles.BoldLabel);
        GUILayout.EndHorizontal();
        m_GUIText = GUILayout.TextField(m_GUIText, Styles.BoldTextField);

        if (Configuration.Instance.OldInputEnabled == false)
        {
            GUILayout.Label("Old Input Disabled", Styles.BoldLabel);
            return;
        }
        m_KeysScrollPosition = GUILayout.BeginScrollView(m_KeysScrollPosition);
        foreach (var key in m_Keys)
        {
            var k = key.Value;
            if (k.keyCounter == 0 || k.keyDown == 0 || k.keyUp == 0)
            {
                continue;
            }
            GUILayout.Label(string.Format("{0} down - {1}, up - {2}, counter - {3}", key.Key, k.keyDown, k.keyUp, k.keyCounter), Styles.BoldLabel);
        }

        GUILayout.EndScrollView();
    }
Ejemplo n.º 3
0
        private void OnGUI()
        {
            scrollView = Gl.BeginScrollView(scrollView);
            {
                Gl.TextArea(log);
            }
            Gl.EndScrollView();

            EditorUtil.HorizontalRule();

            Gl.BeginHorizontal();
            {
                Gl.Label("Save Log:", Gl.ExpandWidth(false));
                outputPath = Gl.TextField(outputPath);
            }
            Gl.EndHorizontal();

            Gl.BeginHorizontal();
            {
                if (Gl.Button("Save"))
                {
                    PrintLog();
                }

                if (Gl.Button("Close"))
                {
                    Close();
                }
            }
            Gl.EndHorizontal();
        }
Ejemplo n.º 4
0
        private void OnGUIVendors(Vendors.Vendor vendor)
        {
            using (new GUISubScope())
            {
                using (new GL.HorizontalScope())
                {
                    GL.Label(string.Format("{0}: ", vendor.DisplayName), MenuHelpers.LabelStyleFixed, falseWidth);
                    if (GL.Button(Local["Menu_Btn_MoveVendor"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        var position = Game.Instance.Player.MainCharacter.Value.Position;
                        var rotation = Game.Instance.Player.MainCharacter.Value.OrientationDirection;

                        SettingsWrapper.Positions[vendor.UnitGuid] = position;
                        SettingsWrapper.Rotations[vendor.UnitGuid] = rotation;
                        vendor.Move(position, rotation);
                    }
                    if (GL.Button(Local["Menu_Btn_Enable"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        SettingsWrapper.VendorEnabled[vendor.UnitGuid] = true;
                        vendor.Enable();
                    }
                    if (GL.Button(Local["Menu_Btn_Disable"], MenuHelpers.ButtonStyle, falseWidth))
                    {
                        SettingsWrapper.VendorEnabled[vendor.UnitGuid] = false;
                        vendor.Disable();
                    }
                }
            }
        }
Ejemplo n.º 5
0
 void updateShopItems()
 {
     for (int i = 0; i <= (vars.characters.Count - 1); i++)
     {
         GL.Label("Character " + (i + 1) + " options:", EditorStyles.boldLabel);
         BV();
         GL.Label("Sprite1 for Open Eye / Sprite2 for Close Eye ", EditorStyles.boldLabel);
         BH();
         vars.characters[i].gameCharacterSprite1 = EGL.ObjectField("Game Character sprite1", vars.characters[i].gameCharacterSprite1, typeof(Sprite), false) as Sprite;
         vars.characters[i].gameCharacterSprite2 = EGL.ObjectField("Game Character sprite2", vars.characters[i].gameCharacterSprite2, typeof(Sprite), false) as Sprite;
         EH();
         BH();
         vars.characters[i].shopCharacterSprite = EGL.ObjectField("Shop Character sprite", vars.characters[i].shopCharacterSprite, typeof(Sprite), false) as Sprite;
         EH();
         BH();
         vars.characters[i].characterName = EGL.TextField("Character name", vars.characters[i].characterName);
         if (i != 0)
         {
             vars.characters[i].characterPrice = EGL.IntField("Character price", vars.characters[i].characterPrice);
         }
         EH();
         EV();
         separator();
     }
 }
Ejemplo n.º 6
0
        private void OnGUIThroneRoom()
        {
            using (new GUISubScope(Local["Menu_Tab_TRV"], "box"))
            {
                if (!HamHelpers.InThroneRoom())
                {
                    GL.Label(Local["Menu_Txt_NotInThrone"]);
                    return;
                }

                GL.Label(Local["Menu_Lbl_MoveVendor"], MenuHelpers.LabelStyleWrap, falseWidth);

                foreach (KeyValuePair <string, Vendors.Vendor> kvp in Vendors.VendorBlueprints.NewVendors.Where(n => n.Value.AreaId == Vendors.Vendor.Area.ThroneRoom))
                {
                    OnGUIVendors(kvp.Value);
                }

                GL.Label(Local["Menu_Txt_CleanOld"]);
                if (GL.Button(Local["Menu_Btn_CleanOld"], MenuHelpers.ButtonStyle, falseWidth))
                {
                    foreach (UnitEntityData unit in Game.Instance.State.Units)
                    {
                        if (oldVendors.Contains(unit.Blueprint.AssetGuid))
                        {
                            unit.Destroy();
                        }
                    }
                }
                GUI.enabled = true;
            }
        }
Ejemplo n.º 7
0
        public void DrawLuaScript(string filePath)
        {
            FindLuaTableInfo(filePath);
            // 以上是初始化环节
            var luaName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1).Replace(".lua", "");

            GL.BeginVertical("OL box");
            GL.Label(luaName, EditorStyles.boldLabel);
            if (mExecuteFunctionDirt == null || mExecuteFunctionDirt.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法", MessageType.Warning);
            }
            else
            {
                foreach (var m in mExecuteFunctionDirt)
                {
                    GL.BeginHorizontal("box");
                    var methodName = string.Format("{0}:{1}", luaName, m.Key);
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        UnityEngine.Debug.LogFormat("<color=#FFA80B>Execute {0}:{1}</color>", luaName, m.Key);
                        m.Value.Invoke();
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
Ejemplo n.º 8
0
        private void DrawDatas()
        {
            var packages = BaseData["Packages"];

            if (packages.Count > 0)
            {
                for (int i = 0; i < packages.Count; i++)
                {
                    var value = packages[i];
                    GL.BeginVertical("OL box");
                    GL.BeginHorizontal("box");
                    GL.Label(value["name"].ToString());
                    GL.Label(value["version"].ToString());

                    if (Directory.Exists(value["localpath"].ToString()))
                    {
                        if (GL.Button("pack", GUILayout.Width(100)))
                        {
                            Export(value["name"].ToString(), value["localpath"].ToString());
                        }
                    }
                    else if (ExistsLocalPackage(value["name"].ToString()))
                    {
                        if (GL.Button("Import", GUILayout.Width(100)))
                        {
                        }
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                }
            }
        }
Ejemplo n.º 9
0
        private void DrawAssurer(VAssetManager Manager)
        {
            GL.BeginVertical("OL box");
            GL.Label(Manager.ManagerName);
            var list = Manager.GetAssurerList();

            if (list.Count == 0)
            {
                EGL.HelpBox("暂无资产", MessageType.Info);
            }
            else
            {
                list.ForEach(assurer =>
                {
                    GL.BeginVertical("GroupBox");
                    GL.BeginHorizontal();
                    GL.Label(String.Format("{0} : Ref {1}", assurer.Value.AssetPath, assurer.Value.UseCount));
                    if (GL.Button("Kill", GUILayout.Width(100)))
                    {
                        assurer.Value.ForceRecycle();
                    }
                    GL.EndHorizontal();
                    GL.EndVertical();
                    GL.Space(2);
                });
            }



            GL.EndVertical();
        }
Ejemplo n.º 10
0
 string ToolbarSearchField(string str, SearchField field)
 {
     EGL.BeginHorizontal(EditorStyles.toolbar);
     GL.Label("", GL.Width(150));
     str = field.OnToolbarGUI(str);
     EGL.EndHorizontal();
     return(str);
 }
Ejemplo n.º 11
0
 public static void HorizontalSlider(Setting <float> val, string label, float min, float max)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val.Value = UGUI.HorizontalSlider(val.Value, min, max, Style.Slider, Style.SliderBody, DefaultOption);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 12
0
 public static void ToggleButton(Setting <bool> val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 13
0
 public static void TextField(Setting <int> val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     TextField(val);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 14
0
 public static void Toggle(Setting <bool> val, string label, GUILayoutOption[] labelOpts, GUILayoutOption[] tglOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, labelOpts);
     UGUI.FlexibleSpace();
     val.Value = UGUI.Toggle(val.Value, string.Empty, Style.Toggle, tglOpts);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 15
0
 public static void TextField(Setting <int> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     TextField(val, txtopts);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 16
0
 public static void TextField(Setting <string> val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val.Value = UGUI.TextField(val.Value, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 17
0
 public static void TextField(Setting <string> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val.Value = UGUI.TextField(val.Value, Style.TextButton, txtopts);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 18
0
 public static void HorizontalSlider(Setting <float> val, string label, float min, float max, GUILayoutOption[] lblOpts, GUILayoutOption[] sliderOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val.Value = UGUI.HorizontalSlider(val.Value, min, max, Style.Slider, Style.SliderBody, sliderOpts);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 19
0
 public static void ToggleButton(Setting <bool> val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val.Value = UGUI.Button(val.Value ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts);
     UGUI.EndHorizontal();
 }
Ejemplo n.º 20
0
 public static string TextField(string val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val = UGUI.TextField(val, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 21
0
 public static bool ToggleButton(bool val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] btnOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, btnOpts);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 22
0
 public static bool ToggleButton(bool val, string label)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, DefaultOption);
     UGUI.Space(5f);
     val = UGUI.Button(val ? GUI.LabelEnabled : GUI.LabelDisabled, Style.TextButton, DefaultOption);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 23
0
 public static bool Toggle(bool val, string label, GUILayoutOption[] labelOpts, GUILayoutOption[] tglOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, labelOpts);
     UGUI.FlexibleSpace();
     val = UGUI.Toggle(val, string.Empty, Style.Toggle, tglOpts);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 24
0
 public static string TextField(string val, string label, GUILayoutOption[] lblOpts, GUILayoutOption[] txtopts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val = UGUI.TextField(val, Style.TextButton, txtopts);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 25
0
 public static float HorizontalSlider(float val, string label, float min, float max, GUILayoutOption[] lblOpts, GUILayoutOption[] sliderOpts)
 {
     UGUI.BeginHorizontal();
     UGUI.Label(label, Style.Label, lblOpts);
     UGUI.Space(5f);
     val = UGUI.HorizontalSlider(val, min, max, Style.Slider, Style.SliderBody, sliderOpts);
     UGUI.EndHorizontal();
     return(val);
 }
Ejemplo n.º 26
0
        void OnGUI()
        {
            if (!model.enable)
            {
                model.enable = ToggleLeft("Log", model.enable); return;
            }
            instance = this; // TODO: why do this here?
            BeginHorizontal();
            if (GL.Button("˂", GL.ExpandWidth(false)))
            {
                model.SelectPreviousFrame();
                SceneView.RepaintAll();
            }
            GL.Button(frameNo, GL.MaxWidth(48f));
            if (GL.Button("˃", GL.ExpandWidth(false)))
            {
                model.SelectNextFrame();
                SceneView.RepaintAll();
            }
            GL.FlexibleSpace();
            EndHorizontal();
            //
            scroll = BeginScrollView(scroll);
            GUI.backgroundColor = Color.black;
            var style = GUI.skin.textArea;
            var f     = font;

            if (f == null)
            {
                Debug.LogError("font not available");
            }
            style.font              = f;
            style.fontSize          = FontSize;
            style.normal.textColor  = Color.white * 0.9f;
            style.focused.textColor = Color.white;
            style.focused.textColor = Color.white;
            GL.TextArea(model.output, GL.ExpandHeight(true));
            EndScrollView();
            //
            GUI.backgroundColor = Color.white;
            //
            var w30 = GL.MaxWidth(30f);

            BeginHorizontal();
            model.enable = ToggleLeft($"Log", model.enable, GL.MaxWidth(60));
            model.trails = ToggleLeft("Trails", model.trails, GL.MaxWidth(50));
            GL.Label("Offset: ", GL.ExpandWidth(false));
            var rs = model.renderSettings;

            rs.offset = FloatField(model.renderSettings.offset, w30);
            GL.Label("Size: ", w30);
            rs.size = FloatField(rs.size, w30);
            GL.Label("Col: ", w30);
            rs.color = EditorGUILayout.ColorField(rs.color);
            EndHorizontal();
        }
Ejemplo n.º 27
0
        private void DrawScript(Type t)
        {
            var att = t.RTGetAttribute <QuickExecuteAttribute>(false);

            if (att == null)
            {
                return;
            }
            GL.BeginVertical("OL box");
            GL.Label(t.Name, EditorStyles.boldLabel);
            var methods = t.GetMethods().Where((i) => { return(i.RTGetAttribute <ExecuteMethodAttribute>(false) != null); });

            if (methods.Count() < 1)
            {
                EGL.HelpBox("没有可以被执行的方法(请检查是否添加了[ExecuteMethodAttribute])", MessageType.Warning);
            }
            else
            {
                foreach (var m in methods)
                {
                    GL.Space(2);
                    GL.BeginHorizontal();
                    var methodName = m.Name + ":(";
                    var param      = m.GetParameters();
                    for (int i = 0; i < param.Length; i++)
                    {
                        var p = param[i];
                        if (i != param.Length - 1)
                        {
                            methodName += string.Format("<b>{0}</b> , ", p.ToString());
                        }
                        else
                        {
                            methodName += string.Format("<b>{0}</b>", p.ToString());
                        }
                    }
                    methodName += ")";
                    GL.Label(methodName);
                    if (GL.Button("Execute", GUILayout.Width(100)))
                    {
                        var o = ReflectionTools.CreateObject(t);
                        //TODO 扩展编辑参数
                        if (param.Length == 0)
                        {
                            m.Invoke(o, null);
                        }
                        Log.I(string.Format("<color=#FFA80B>Execute {0}</color>", methodName));
                    }
                    GL.EndHorizontal();
                    GL.Space(2);
                }
            }
            GL.EndVertical();
        }
Ejemplo n.º 28
0
 public static bool NotInGameMessage()
 {
     if (!HamHelpers.InGame())
     {
         GL.Label(Main.Local["Menu_Lbl_NotInGame"]);
         return(false);
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 29
0
 public static bool NotInThroneRoomMessage()
 {
     if (!HamHelpers.InThroneRoom())
     {
         GL.Label(Main.Local["Menu_Txt_NotInThrone"]);
         return(false);
     }
     else
     {
         return(true);
     }
 }
Ejemplo n.º 30
0
 void blockHeader(string mainHeader, string secondHeader, int blockIdex)
 {
     BV();
     GL.Label(mainHeader, "TL Selection H2");
     BH();
     if (GL.Button(buttons[blockIdex], GL.Height(25f), GL.Width(50f))) toggles[blockIdex] = !toggles[blockIdex];
     BHS("HelpBox");
     GL.Label(secondHeader, "infoHelpBoxText");
     GL.Label(book, GL.Height(18f), GL.Width(20f));
     EH();
     EH();
     GL.Space(3);
 }