Example #1
0
        /// <summary>
        /// Draws a clickable link which looks like a hyperlink.
        /// </summary>
        /// <param name="text">Text to be displayed</param>
        /// <param name="action">action done on click</param>
        /// <param name="indent">Intend on the left</param>
        public static void DrawLink(string text, Action action, int indent = CreatorEditorStyles.Indent)
        {
            if (GUILayout.Button(text, CreatorEditorStyles.ApplyPadding(CreatorEditorStyles.Link, indent)))
            {
                action.Invoke();
            }

            Rect buttonRect = GUILayoutUtility.GetLastRect();

            GUI.Label(new Rect(buttonRect.x, buttonRect.y + 1, buttonRect.width, buttonRect.height), new String('_', 256), CreatorEditorStyles.ApplyPadding(CreatorEditorStyles.Link, indent));
            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
        }
        public void OnGUI(string searchContext)
        {
            EditorGUILayout.Space();
            GUIStyle labelStyle = CreatorEditorStyles.ApplyPadding(CreatorEditorStyles.Paragraph, 0);

            GUILayout.Label("These settings help you to configure the spectator for non-VR users.", labelStyle);
            EditorGUILayout.Space();

            if (GUILayout.Button("Edit key bindings"))
            {
                InputEditorUtils.OpenKeyBindingEditor();
            }

            EditorGUILayout.Space(20f);
        }
Example #3
0
        public static string DrawTextField(string content, int charLimit = -1, int indent = 0, params GUILayoutOption[] options)
        {
            GUILayout.BeginHorizontal();
            {
                GUIStyle style = CreatorEditorStyles.TextField;
                if (indent != 0)
                {
                    style = CreatorEditorStyles.ApplyPadding(style, indent);
                }

                content = GUILayout.TextField(content, charLimit, style, options);

                Rect textFieldRect = GUILayoutUtility.GetLastRect();
                EditorGUIUtility.AddCursorRect(textFieldRect, MouseCursor.Text);
                if (charLimit > 0)
                {
                    GUILayout.Label($"{content.Length}/{charLimit}");
                }
            }
            GUILayout.EndHorizontal();
            return(content);
        }