static object DoField(object obj, Type type, string label, GUIStyle style, FieldFunc fieldFunc, LabelRightFunc labelRightFunc, GUILayoutOption[] options) { using (new GUILayout.VerticalScope(style, options)) { GUILayout.BeginHorizontal(); obj = PrefixLabelDraggable(label, obj, type, out var isLong); if (isLong || labelRightFunc != null) { if (labelRightFunc != null) { obj = labelRightFunc(obj, type); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(PrefixLabelSetting.width + GUI.skin.label.margin.horizontal); } obj = fieldFunc(obj, type); GUILayout.EndHorizontal(); } return(obj); }
static FieldFunc DispatchFieldFunc(Type type) { if (!fieldFuncTable.TryGetValue(type, out var func)) { if (type.IsEnum) { func = new FieldFunc((obj, t) => EnumField(obj)); } else if (TypeUtility.IsList(type)) { func = ListField; } else if (TypeUtility.IsRecursive(type)) { func = new FieldFunc((obj, t) => RecursiveField(obj)); } else { func = StandardField; } fieldFuncTable[type] = func; } return(func); }
static object DoField(object obj, Type type, string label, GUIStyle style, FieldFunc fieldFunc, GUILayoutOption[] options) { using (new GUILayout.VerticalScope(style, options)) using (new GUILayout.HorizontalScope()) { obj = PrefixLabelDraggable(label, obj, type); obj = fieldFunc(obj, type); } return(obj); }