Ejemplo n.º 1
0
 private void DrawObjectCompareField(ComparerBase comparer)
 {
     otherPathSelector.Draw(comparer.other, comparer,
                            comparer.otherPropertyPath, comparer.GetAccepatbleTypesForB(),
                            go => {
         comparer.other = go;
         AssertionExplorerWindow.Reload();
     },
                            s => {
         comparer.otherPropertyPath = s;
         AssertionExplorerWindow.Reload();
     }
                            );
 }
        private void DrawConstCompareField(ComparerBase comparer)
        {
            if (comparer.ConstValue == null)
            {
                comparer.ConstValue = comparer.GetDefaultConstValue();
            }

            var so = new SerializedObject(comparer);
            var sp = so.FindProperty("constantValueGeneric");

            if (sp != null)
            {
                EditorGUILayout.PropertyField(sp, new GUIContent("Constant"), true);
                so.ApplyModifiedProperties();
            }
        }
Ejemplo n.º 3
0
        private void DrawCompareToType(ComparerBase comparer)
        {
            comparer.compareToType = (ComparerBase.CompareToType)EditorGUILayout.EnumPopup("Compare to type",
                                                                                           comparer.compareToType,
                                                                                           EditorStyles.popup);

            if (comparer.compareToType == ComparerBase.CompareToType.CompareToConstantValue)
            {
                try {
                    DrawConstCompareField(comparer);
                } catch (NotImplementedException) {
                    Debug.LogWarning("This comparer can't compare to static value");
                    comparer.compareToType = ComparerBase.CompareToType.CompareToObject;
                }
            }
            else if (comparer.compareToType == ComparerBase.CompareToType.CompareToObject)
            {
                DrawObjectCompareField(comparer);
            }
        }