private static string TextFieldWithUndo(
            this Object obj,
            string value,
            GUIContent label,
            Regex regex = null
            )
        {
            var originalColor = GUI.color;

            if (GUI.enabled && string.IsNullOrWhiteSpace(value))
            {
                GUI.color = Color.red;
            }

            EditorGUI.BeginChangeCheck();

            var newValue = ScriptableEventGUI.TextField(value, label);

            GUI.color = originalColor;

            if (newValue != null && regex != null)
            {
                newValue = regex.Replace(newValue, string.Empty).Trim();
            }

            if (EditorGUI.EndChangeCheck())
            {
                RecordUndo(obj, label);
            }

            return(newValue);
        }
Example #2
0
        private void DrawContent()
        {
            ScriptableEventGUI.Group(DrawEventArgumentGroup);
            ScriptableEventGUI.Group(DrawEventGroup);
            ScriptableEventGUI.Group(DrawListenerGroup);
            ScriptableEventGUI.Group(DrawEditorGroup);

            GUILayout.FlexibleSpace();

            scriptDirectory = this.DrawScriptDirectory(scriptDirectory);
        }
        private static int IntFieldWithUndo(this Object obj, int value, GUIContent label)
        {
            EditorGUI.BeginChangeCheck();

            var newValue = ScriptableEventGUI.IntField(value, label);

            if (EditorGUI.EndChangeCheck())
            {
                RecordUndo(obj, label);
            }

            return(newValue);
        }
        private static T ObjectFieldWithUndo <T>(
            this Object obj,
            T value,
            GUIContent label
            ) where T : Object
        {
            EditorGUI.BeginChangeCheck();

            var newValue = ScriptableEventGUI.ObjectField(value, label);

            if (EditorGUI.EndChangeCheck())
            {
                RecordUndo(obj, label);
            }

            return(newValue);
        }
        private static bool ToggleWithUndo(
            this Object obj,
            bool value,
            GUIContent label,
            bool isBold = false,
            bool isLeft = false
            )
        {
            EditorGUI.BeginChangeCheck();

            var newValue = ScriptableEventGUI.Toggle(value, label, isBold, isLeft);

            if (EditorGUI.EndChangeCheck())
            {
                RecordUndo(obj, label);
            }

            return(newValue);
        }
 protected override Collider DrawArgField(Collider value)
 {
     return(ScriptableEventGUI.ObjectField(value, isAllowSceneObjects: true));
 }
Example #7
0
 protected override Quaternion DrawArgField(Quaternion value)
 {
     return(ScriptableEventGUI.QuaternionField(value));
 }
 protected override int DrawArgField(int value)
 {
     return(ScriptableEventGUI.IntField(value));
 }
 protected override bool DrawArgField(bool value)
 {
     return(ScriptableEventGUI.Toggle(value));
 }
Example #10
0
 protected override float DrawArgField(float value)
 {
     return(ScriptableEventGUI.FloatField(value));
 }
 protected override Transform DrawArgField(Transform value)
 {
     return(ScriptableEventGUI.ObjectField(value, isAllowSceneObjects: true));
 }
Example #12
0
 protected override double DrawArgField(double value)
 {
     return(ScriptableEventGUI.DoubleField(value));
 }
Example #13
0
 private void OnGUI()
 {
     DrawWindowHeader();
     scrollPosition = ScriptableEventGUI.Scroll(scrollPosition, DrawContent);
     DrawCreateButton();
 }
 protected override string DrawArgField(string value)
 {
     return(ScriptableEventGUI.TextField(value));
 }
 protected override Color DrawArgField(Color value)
 {
     return(ScriptableEventGUI.ColorField(value));
 }
Example #16
0
 protected override GameObject DrawArgField(GameObject value)
 {
     return(ScriptableEventGUI.ObjectField(value, isAllowSceneObjects: true));
 }
 protected override Vector2 DrawArgField(Vector2 value)
 {
     return(ScriptableEventGUI.Vector2Field(value));
 }
Example #18
0
 protected override long DrawArgField(long value)
 {
     return(ScriptableEventGUI.LongField(value));
 }