public static bool TextFieldButtonWithHint(string text, string hint, params GUILayoutOption[] layoutOptions)
        {
            Color contentColor = GUI.get_contentColor();

            if (string.IsNullOrEmpty(text))
            {
                text = hint;
                Color textColor = EditorStyles.get_label().get_normal().get_textColor();
                textColor.a = 0.5f;
                GUI.set_contentColor(textColor);
            }
            bool result = GUILayout.Button(text, EditorStyles.get_textField(), layoutOptions);

            GUI.set_contentColor(contentColor);
            return(result);
        }
Beispiel #2
0
        internal override void OnHeaderTitleGUI(Rect titleRect, string header)
        {
            this.m_Name = base.get_serializedObject().FindProperty("m_Name");
            base.get_serializedObject().Update();
            Rect rect = titleRect;

            rect.set_height(16f);
            EditorGUI.BeginChangeCheck();
            EditorGUI.set_showMixedValue(this.m_Name.get_hasMultipleDifferentValues());
            TimelineWindow instance = TimelineWindow.instance;
            bool           flag     = instance == null || instance.state == null || instance.state.currentDirector == null;

            EditorGUI.BeginDisabledGroup(flag);
            EditorGUI.BeginChangeCheck();
            string text = EditorGUI.DelayedTextField(rect, this.m_Name.get_stringValue(), EditorStyles.get_textField());

            EditorGUI.set_showMixedValue(false);
            if (EditorGUI.EndChangeCheck() && !string.IsNullOrEmpty(text))
            {
                for (int i = 0; i < base.get_targets().Count <Object>(); i++)
                {
                    ObjectNames.SetNameSmart(base.get_targets()[i], text);
                }
                if (instance != null)
                {
                    instance.Repaint();
                }
            }
            EditorGUI.EndDisabledGroup();
            base.get_serializedObject().ApplyModifiedProperties();
        }