private void DrawFindResult() { GUILayout.Label(">>>>>统计数量:" + findResultList.Count); FindResult delete = null; ZGUILayout.ScrollView(ref scrollPosition, () => { findResultList.ZForeachWithIndex((result, index) => { ZGUILayout.Horizontal(() => { // 序号 GUILayout.Label((index + 1).ToString(), GUILayout.Width(30)); // 选中按钮 ZGUILayout.ColorButton(result.obj.name, Color.green, () => { ZEditor.SelectObject(result.obj); }, GUILayout.MinWidth(50)); // 删除按钮 ZGUILayout.ColorButton("X", Color.red, () => { delete = result; }, GUILayout.Width(50)); }); }); }, GUILayout.ExpandWidth(true)); if (delete != null) { findResultList.Remove(delete); } }
// 查找目标类型 private void DrawFindTarget() { EditorGUILayout.LabelField("目标类型:"); ZGUILayout.Horizontal(() => { findPrefab = EditorGUILayout.Toggle("Prefab", findPrefab, GUILayout.ExpandWidth(false)); findMaterial = EditorGUILayout.Toggle("Material", findMaterial, GUILayout.ExpandWidth(false)); }); }
// 查找Object private void DrawFindObject() { ZGUILayout.Horizontal(() => { findObject = EditorGUILayout.ObjectField("Object:", findObject, typeof(UnityEngine.Object)); ZGUILayout.ColorButton(EditorGUIUtility.IconContent("ViewToolZoom"), Color.green, () => { if (findObject == null) { return; } findType = FindType.Object; CollectAndRun(); }, GUILayout.Width(70)); }); }
// 绘制查找项 private string DrawCommonFindItem(string findContent, string label, FindType btnFindType) { ZGUILayout.Horizontal(() => { findContent = EditorGUILayout.TextField(label, findContent); ZGUILayout.ColorButton(EditorGUIUtility.IconContent("ViewToolZoom"), Color.green, () => { if (string.IsNullOrEmpty(findContent)) { return; } findType = btnFindType; CollectAndRun(); }, GUILayout.Width(70)); }); return(findContent); }