public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { if (target == null) { target = property.GetTraget() as StaticEvent; } float _height = 70; if (target.InvokeInfoList != null) { foreach (var VARIABLE in target.InvokeInfoList) { _height += 50; _height += (VARIABLE.parameterInfos?.Length ?? 0) * 25; } } return(_height); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { // 初始化 if (reorderable == null) { target = property.GetTraget() as StaticEvent; reorderable = new ReorderableList(target.InvokeInfoList, typeof(InvokeInfo), true, true, true, true); reorderable.drawElementCallback = DrawElementCallbackRect; reorderable.onAddDropdownCallback = (rect, list) => target.InvokeInfoList.Add(new InvokeInfo()); reorderable.elementHeightCallback = ElementHeightCallback; reorderable.drawHeaderCallback = rect => GUI.Label(rect, $"StaticEvent-{property.name}({string.Join(" ", Array.ConvertAll(target.constraints, c => c.Name))})"); } if (target != null) { target.Update(); if (target.InvokeInfoList == null) { target.InitializeList(); } if (reorderable.list == null) { reorderable.list = target.InvokeInfoList; } foreach (var VARIABLE in target.InvokeInfoList) { if (target.IsDirty(VARIABLE)) { VARIABLE.MethodInfo = null; VARIABLE.Propertys = null; } } reorderable.DoList(position); } }