public override void DoLayoutList() { base.DoLayoutList(); var rect = ProcessingUtil.GetDragRect(); if (Event.current.type == EventType.DragUpdated && rect.Contains(Event.current.mousePosition)) { ProcessingUtil.UpdateDragedGameObjectsFromScene(dragedGameObjects); if (dragedGameObjects.Count == 0) { ProcessingUtil.UpdateDragedObjectsFromFile(".prefab", dragedGameObjects); } } else if (Event.current.type == EventType.DragPerform && rect.Contains(Event.current.mousePosition)) { foreach (var item in dragedGameObjects) { if (!ProcessingUtil.HaveItem(property, "item", item)) { var prop = property.AddItem(); SetProperty(prop, item); } else { Debug.Log("already exists:" + item); } } } }
protected override void DrawElementCallBack(Rect rect, int index, bool isActive, bool isFocused) { rect = ProcessingUtil.DrawBoxRect(rect, index.ToString()); var prop = property.GetArrayElementAtIndex(index); var list_prop = prop.FindPropertyRelative("processingItems"); var name_prop = prop.FindPropertyRelative("name"); var processItemList = GetProcessItemListDrawer(list_prop, index); processItemList.drawHeaderCallback = (titleRect) => { var labelRect = new Rect(rect.x + 2, rect.y + 2, rect.width * 0.15f, EditorGUIUtility.singleLineHeight); var nameRect = new Rect(rect.x + 2 + rect.width * 0.15f, rect.y + 4, rect.width * 0.15f, EditorGUIUtility.singleLineHeight); EditorGUI.LabelField(labelRect, "name:"); name_prop.stringValue = EditorGUI.TextField(nameRect, name_prop.stringValue, EditorStyles.miniTextField); var btnRect = new Rect(rect.x + rect.width * 0.35f, rect.y, 20, EditorGUIUtility.singleLineHeight); if (GUI.Button(btnRect, new GUIContent("p", "批量处理"), EditorStyles.miniButton)) { if (onProcessGroup != null) { onProcessGroup.Invoke(name_prop.stringValue); } else { Debug.Log("如需批量处理,请填入继承于ProcessingLogic的ScriptObject"); } } }; processItemList.DoList(rect); }