using UnityEditor; namespace Superlazy.UI { public static class SLValueComparisonInspector { public static void OnInspector(this SLValueComparison comp, SLUIObjectOnOff session, string inspectorName = "Check Value") { comp.checkValue = EditorGUILayout.TextField(inspectorName, comp.checkValue); comp.useCheckValue = string.IsNullOrEmpty(comp.checkValue) == false; if (comp.useCheckValue == false) { EditorGUILayout.LabelField("[" + session.BindPath + "] Check"); } else { var checkValuePath = comp.checkValue.IsLeft(".") || double.TryParse(comp.checkValue, out _) || comp.checkValue == "True" || comp.checkValue == "False" ? comp.checkValue : session.BindPath.CombinePath(comp.checkValue); if (checkValuePath.IsLeft(".")) { checkValuePath = checkValuePath.Substring(1); } comp.useCompValue = EditorGUILayout.Toggle("Use Comparison", comp.useCompValue); if (comp.useCompValue) { EditorGUILayout.BeginHorizontal(); { var comps = new string[] { ">", "<", "==", "!=", ">=", "<=" }; var type = (int)comp.compType; var newComp = EditorGUILayout.Popup("[" + checkValuePath + "]", type, comps); if (newComp >= 0) { comp.compType = (SLValueComparison.CompType)newComp; comp.compValue = EditorGUILayout.TextField(comp.compValue); comp.useCheckValue = comp.checkValue != ""; } } EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.LabelField("[" + checkValuePath + "] Check"); } } } } }