public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            EditorGUI.BeginProperty(pos, label, prop);

            float origX     = pos.x;
            float origWidth = pos.width;

            SerializedProperty runTargetProp = DrawRunTargetAndCallMethod(ref pos, prop, 125);

            SerializedProperty numCheckProp = prop.FindPropertyRelative("numericalCheck");

            pos.width = numericalCheckWidth;
            numCheckProp.enumValueIndex = EditorGUI.Popup(pos, numCheckProp.enumValueIndex, numericalCheckOptions);
            pos.x += pos.width;

            SerializedProperty useGlobalValueThresholdProp = prop.FindPropertyRelative("useGlobalValueThreshold");
            bool useGlobalValueThreshold = useGlobalValueThresholdProp.boolValue;


            if (useGlobalValueThreshold)
            {
                pos.width = 100;
                GlobalGameValues.DrawGlobalValueSelector(pos, prop.FindPropertyRelative("globalValueThresholdName"));
                pos.x += 75;
            }
            else
            {
                pos.width = 60;
                EditorGUI.PropertyField(pos, prop.FindPropertyRelative("threshold"), GUITools.noContent, true);
                pos.x += pos.width;
            }

            GUITools.DrawToolbarDivider(pos.x, pos.y);
            pos.x += GUITools.toolbarDividerSize;

            GUITools.DrawIconToggle(useGlobalValueThresholdProp, useGlobalValueGUI, pos.x, pos.y);
            pos.x += GUITools.iconButtonWidth;

            SerializedProperty trueIfSubjectNullProp = prop.FindPropertyRelative("trueIfSubjectNull");

            GUITools.DrawIconToggle(trueIfSubjectNullProp, new GUIContent("[?]", "Consider True If Subject Is Null Or Method Check Fails"), pos.x, pos.y);
            pos.x += GUITools.iconButtonWidth;

            SerializedProperty orProp = prop.FindPropertyRelative("or");

            GUITools.DrawIconToggle(orProp, new GUIContent(orProp.boolValue ? "||" : "&&"), pos.x, pos.y, GUITools.white, GUITools.white);
            pos.x += GUITools.iconButtonWidth;

            DrawEnd(ref pos, prop, origX, origWidth, runTargetProp);

            EditorGUI.EndProperty();
        }
Beispiel #2
0
        public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
        {
            EditorGUI.BeginProperty(pos, label, prop);

            float origX     = pos.x;
            float origWidth = pos.width;

            pos.width = 65;

            SerializedProperty runTargetProp = prop.FindPropertyRelative("runTarget");

            EditorGUI.PropertyField(pos, runTargetProp, GUITools.noContent, true);

            pos.x += pos.width;

            pos.width = 125;

            GUITools.StringFieldWithDefault(pos.x, pos.y, pos.width, pos.height, prop.FindPropertyRelative("callMethod"), "Call Method");
            pos.x += pos.width;


            SerializedProperty numCheckProp = prop.FindPropertyRelative("numericalCheck");

            pos.width = numericalCheckWidth;
            numCheckProp.enumValueIndex = EditorGUI.Popup(pos, numCheckProp.enumValueIndex, numericalCheckOptions);
            pos.x += pos.width;

            SerializedProperty useGlobalValueThresholdProp = prop.FindPropertyRelative("useGlobalValueThreshold");
            bool useGlobalValueThreshold = useGlobalValueThresholdProp.boolValue;


            if (useGlobalValueThreshold)
            {
                pos.width = 100;

                GlobalGameValues.DrawGlobalValueSelector(pos, prop.FindPropertyRelative("globalValueThresholdName"));
            }
            else
            {
                pos.width = 60;
                EditorGUI.PropertyField(pos, prop.FindPropertyRelative("threshold"), GUITools.noContent, true);
            }
            pos.x += pos.width;

            GUITools.DrawToolbarDivider(pos.x, pos.y);
            pos.x += GUITools.toolbarDividerSize;

            useGlobalValueThreshold = GUITools.DrawToggleButton(useGlobalValueThresholdProp, useGlobalValueGUI, pos.x, pos.y, GUITools.blue, GUITools.white);
            pos.x += GUITools.iconButtonWidth;

            bool showParameters = GUITools.DrawToggleButton(prop.FindPropertyRelative("showParameters"), new GUIContent("P", "Show Parameters"), pos.x, pos.y, GUITools.blue, GUITools.white);

            pos.x += GUITools.iconButtonWidth;

            SerializedProperty orProp = prop.FindPropertyRelative("or");

            orProp.boolValue = GUITools.DrawToggleButton(orProp.boolValue, new GUIContent(orProp.boolValue ? "||" : "&&"), pos.x, pos.y, GUITools.white, GUITools.white);


            if (runTargetProp.enumValueIndex == (int)RunTarget.Reference)
            {
                pos.y    += EditorGUIUtility.singleLineHeight;
                pos.x     = origX;
                pos.width = origWidth;

                EditorGUI.LabelField(pos, "Reference:");

                pos.x     += 65;
                pos.width -= 65;
                EditorGUI.PropertyField(pos, prop.FindPropertyRelative("referenceTarget"), GUITools.noContent, true);
            }


            pos.y    += EditorGUIUtility.singleLineHeight;
            pos.x     = origX;
            pos.width = origWidth;

            if (showParameters)
            {
                EditorGUI.PropertyField(pos, prop.FindPropertyRelative("parameters"), true);
            }
            else
            {
                SerializedProperty paramsProp = prop.FindPropertyRelative("parameters");

                if (paramsProp.FindPropertyRelative("list").arraySize > 0)
                {
                    pos.x     += GUITools.iconButtonWidth;
                    pos.width -= GUITools.iconButtonWidth;

                    ConditionsParametersDrawer.DrawFlat(pos, paramsProp);
                }
            }

            EditorGUI.EndProperty();
        }