void OnEnable() { string[] assetPaths = AssetDatabaseUtility.FindAssets <AvatarCreatorData>(); dataListView = new EGUIListView <string> { Header = "Data List", OnSelectedChange = OnListViewItemSelected, OnDrawItem = (rect, index) => { string assetPath = dataListView.GetItem(index); EditorGUI.LabelField(rect, Path.GetFileNameWithoutExtension(assetPath), EGUIStyles.BoldLabelStyle); }, }; dataListView.AddItems(assetPaths); AvatarPartCreatorDataDrawer.CreatePartBtnClick = (data) => { CreatePart(data); }; AvatarPartCreatorDataDrawer.PreviewPartBtnClick = (data) => { PreviewPart(data); }; previewer = new AvatarPreviewer(); }
void OnGUI() { if (fontConfigListView == null) { fontConfigListView = new EGUIListView <BitmapFontConfig>(); fontConfigListView.AddItems(fontConfigs.ToArray()); fontConfigListView.OnSelectedChange = (index) => { SelectedChanged(index); }; } Rect toolbarRect = new Rect(0, 0, position.width, TOOLBAR_HEIGHT); DrawToolbar(toolbarRect); Rect listViewRect = new Rect(0, TOOLBAR_HEIGHT, listViewWidth, position.height - TOOLBAR_HEIGHT); DrawListView(listViewRect); EGUI.DrawAreaLine(listViewRect, Color.grey); Rect listViewDragRect = new Rect(listViewRect.x + listViewRect.width, listViewRect.y, LISTVIEW_DRAG_WIDTH, listViewRect.height); DrawListViewDrag(listViewDragRect); EGUI.DrawAreaLine(listViewDragRect, Color.grey); Rect contentRect = new Rect(listViewDragRect.x + listViewDragRect.width, listViewRect.y, position.width - listViewDragRect.x - listViewDragRect.width, listViewRect.height); DrawContent(contentRect); EGUI.DrawAreaLine(contentRect, Color.grey); }
private void DrawListView(Rect rect) { if (fontConfigListView == null) { fontConfigListView = new EGUIListView <BitmapFontConfig>(); fontConfigListView.AddItems(fontConfigs.ToArray()); } fontConfigListView.OnGUI(rect); }
public SimpleListTreeView(EGUIListView <T> listView) : base(new TreeViewState()) { this.listView = listView; showAlternatingRowBackgrounds = true; showBorder = true; useScrollView = true; Reload(); }
public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); { base.OnInspectorGUI(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Execute", GUILayout.Height(40))) { AssetAddressUtil.UpdateConfigByGroup(target as AssetAddressGroup); EditorUtility.DisplayDialog("Finished", "Finished", "OK"); } if (GUILayout.Button("Filter", GUILayout.Height(40))) { List <string> files = new List <string>(); AssetAddressGroup group = target as AssetAddressGroup; foreach (var filter in group.filters) { files.AddRange(filter.Filter()); } listViewer = new EGUIListView <string>(); listViewer.Header = "Asset List"; listViewer.OnDrawItem = (rect, index) => { Rect indexRect = new Rect(rect.x, rect.y, 20, rect.height); EditorGUI.PrefixLabel(indexRect, new GUIContent("" + index)); Rect itemRect = new Rect(rect.x + indexRect.width, rect.y, rect.width - indexRect.width, rect.height); EditorGUI.LabelField(itemRect, listViewer.GetItem(index)); }; listViewer.AddItems(files.ToArray()); } EGUILayout.DrawHorizontalLine(); if (listViewer != null) { Rect lastRect = EditorGUILayout.GetControlRect(false, 300, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); if (Event.current.type == EventType.Repaint) { listViewer.OnGUI(lastRect); } } } EditorGUILayout.EndVertical(); }