// using System; // using System.Collections.Generic; // using AlicizaX.EditorExtension.Editor; // using UnityEditor; // using UnityEngine; // // public class TestWindow : EditorWindow // { // [MenuItem("Test/Table Window")] // private static void OpenWindow() // { // GetWindow(); // } // // private List _students; // private List> _tableColumns; // private TableView _tableView; // // // private void OnEnable() // { // _students = new List(); // // _tableColumns = new List>(); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("姓名"), // width = 100, // canSort = true, // autoResize = false, // Compare = (a, b) => { return a.name.CompareTo(b.name); }, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.name = EditorGUI.TextField(cellRect, data.name); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("性别"), // width = 100, // canSort = true, // autoResize = false, // Compare = (a, b) => { return a.sex.CompareTo(b.sex); }, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.sex = (Sex)EditorGUI.EnumPopup(cellRect, data.sex); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("年龄"), // width = 100, // canSort = true, // autoResize = false, // Compare = (a, b) => { return a.age.CompareTo(b.age); }, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.age = EditorGUI.IntField(cellRect, data.age); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("班级"), // width = 100, // canSort = true, // autoResize = false, // Compare = (a, b) => { return a.grade.CompareTo(b.grade); }, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.grade = EditorGUI.TextField(cellRect, data.grade); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("家庭住址"), // width = 100, // canSort = true, // autoResize = false, // Compare = (a, b) => { return a.address.CompareTo(b.address); }, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.address = EditorGUI.TextField(cellRect, data.address); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("实体"), // width = 100, // canSort = false, // autoResize = false, // Compare = null, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.entity = (GameObject)EditorGUI.ObjectField(cellRect, data.entity, typeof(GameObject), true); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("颜色"), // width = 100, // canSort = false, // autoResize = false, // Compare = null, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.col = EditorGUI.ColorField(cellRect, data.col); }, // }); // _tableColumns.Add(new TableColumn() // { // headerContent = new GUIContent("头像"), // width = 100, // canSort = false, // autoResize = false, // Compare = null, // DrawCell = (cellRect, data, rowIndex, isSelected, isFocused) => { data.headImage = (Texture)EditorGUI.ObjectField(cellRect, data.headImage, typeof(Texture), true); }, // }); // // _tableView = new TableView(_students, _tableColumns); // } // // private void OnGUI() // { // _tableView.OnGUI(new Rect(0, 0, position.width, position.height)); // } // // public class Student // { // public string name; // public Sex sex; // public int age; // public string grade; // public string address; // public GameObject entity; // public Color col; // public Texture headImage; // } // // public enum Sex // { // Man, // Woman // } // }