private void RenderCriteriaField()

in Assets/MixedRealityToolkit/Inspectors/Profiles/MixedRealityInputActionRulesInspector.cs [235:384]


        private void RenderCriteriaField(MixedRealityInputAction action, SerializedProperty criteriaValue = null)
        {
            var isWideMode = EditorGUIUtility.wideMode;
            EditorGUIUtility.wideMode = true;
            if (action != MixedRealityInputAction.None)
            {
                switch (action.AxisConstraint)
                {
                    default:
                        EditorGUILayout.HelpBox("Base rule must have a valid axis constraint.", MessageType.Warning);
                        break;
                    case AxisType.Digital:
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.BeginChangeCheck();
                        var boolValue = EditorGUILayout.Toggle(GUIContent.none, criteriaValue?.boolValue ?? currentBoolCriteria, GUILayout.Width(64), GUILayout.ExpandWidth(true));

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.boolValue = boolValue;
                            }
                            else
                            {
                                currentBoolCriteria = boolValue;
                            }
                        }

                        EditorGUILayout.EndHorizontal();
                        break;
                    case AxisType.SingleAxis:
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.BeginChangeCheck();
                        var floatValue = EditorGUILayout.FloatField(GUIContent.none, criteriaValue?.floatValue ?? currentSingleAxisCriteria, GUILayout.Width(64), GUILayout.ExpandWidth(true));

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.floatValue = floatValue;
                            }
                            else
                            {
                                currentSingleAxisCriteria = floatValue;
                            }
                        }

                        EditorGUILayout.EndHorizontal();
                        break;
                    case AxisType.DualAxis:
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.indentLevel++;
                        EditorGUI.BeginChangeCheck();
                        var dualAxisValue = EditorGUILayout.Vector2Field("Position", criteriaValue?.vector2Value ?? currentDualAxisCriteria, GUILayout.Width(64), GUILayout.ExpandWidth(true));

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.vector2Value = dualAxisValue;
                            }
                            else
                            {
                                currentDualAxisCriteria = dualAxisValue;
                            }
                        }

                        EditorGUI.indentLevel--;
                        break;
                    case AxisType.ThreeDofPosition:
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.indentLevel++;
                        EditorGUI.BeginChangeCheck();
                        var positionValue = EditorGUILayout.Vector3Field("Position", criteriaValue?.vector3Value ?? currentVectorCriteria, GUILayout.ExpandWidth(true));

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.vector3Value = positionValue;
                            }
                            else
                            {
                                currentVectorCriteria = positionValue;
                            }
                        }

                        EditorGUI.indentLevel--;
                        break;
                    case AxisType.ThreeDofRotation:
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.indentLevel++;
                        EditorGUI.BeginChangeCheck();
                        var rotationValue = EditorGUILayout.Vector3Field("Rotation", criteriaValue?.quaternionValue.eulerAngles ?? currentQuaternionCriteria.eulerAngles, GUILayout.ExpandWidth(true));

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.quaternionValue = Quaternion.Euler(rotationValue);
                            }
                            else
                            {
                                currentQuaternionCriteria = Quaternion.Euler(rotationValue);
                            }
                        }

                        EditorGUI.indentLevel--;
                        break;
                    case AxisType.SixDof:
                        EditorGUILayout.LabelField(CriteriaContent, GUILayout.Width(128));
                        EditorGUI.indentLevel++;

                        var posePosition = currentPoseCriteria.Position;
                        var poseRotation = currentPoseCriteria.Rotation;

                        if (criteriaValue != null)
                        {
                            posePosition = criteriaValue.FindPropertyRelative("position").vector3Value;
                            poseRotation = criteriaValue.FindPropertyRelative("rotation").quaternionValue;
                        }

                        EditorGUI.BeginChangeCheck();
                        posePosition = EditorGUILayout.Vector3Field("Position", posePosition);

                        poseRotation.eulerAngles = EditorGUILayout.Vector3Field("Rotation", poseRotation.eulerAngles);

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (criteriaValue != null)
                            {
                                criteriaValue.FindPropertyRelative("position").vector3Value = posePosition;
                                criteriaValue.FindPropertyRelative("rotation").quaternionValue = poseRotation;
                            }
                            else
                            {
                                currentPoseCriteria.Position = posePosition;
                                currentPoseCriteria.Rotation = poseRotation;
                            }
                        }

                        EditorGUI.indentLevel--;
                        break;
                }

                EditorGUIUtility.wideMode = isWideMode;
            }
        }