public void OnEditorGUI(ICField field, ICLayout layout, ICComRect pos, SerializedObject serializedObject) { int value = field.GetVariable <int>(); string name = (label != "") ? label : field.name; layout.IntField(ref value, pos, name, tooltip); serializedObject.FindProperty(field.name).intValue = value; }
public override void OnInspectorGUI() { if (layout == null) { layout = new ICLayout(); } layout.InitInspector(); foreach (var one in targetInfo.fields) { ICField field = one.Value; var attrs = field.attributes; ICComRect pos = new zOneline(); foreach (var attr in attrs) { if (attr is ICAOneLine) { var at = attr as ICAOneLine; pos = at.pos; continue; } if (attr is ICASpeOneline) { var at = attr as ICASpeOneline; pos = at.pos; continue; } if (attr is ICAToLeft) { var at = attr as ICAToLeft; pos = at.pos; continue; } if (attr is ICAToRight) { var at = attr as ICAToRight; pos = at.pos; continue; } if (attr is ICAFullCompoment) { var at = attr as ICAFullCompoment; pos = at.pos; continue; } if (attr is ICAOffset) { var at = attr as ICAOffset; pos.offset = at.offset; continue; } if (attr is ICAFloatField) { var at = attr as ICAFloatField; at.OnEditorGUI(field, layout, pos, serializedObject); continue; } if (attr is ICAIntField) { var at = attr as ICAIntField; at.OnEditorGUI(field, layout, pos, serializedObject); continue; } } serializedObject.ApplyModifiedProperties(); } layout.FinishInspector(); }
//传入当前环境 public void Init(ICLayout layout) { this.layout = layout; }