public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); TableColumnInfo tableColumnInfo = (TableColumnInfo)property.GetTargetObjectOfProperty(); if (tableColumnInfo.elementType == null) { return; } TableEditor.OrientedWordsContainer orientedWords = tableColumnInfo.table == null ? TableEditor.VERTICAL_WORDS : TableEditor.GetOrientedWords(tableColumnInfo.table.horizontal); SerializedProperty fieldName = property.FindPropertyRelative("fieldName"); SerializedProperty cellPrefab = property.FindPropertyRelative("cellPrefab"); SerializedProperty width = property.FindPropertyRelative("width"); SerializedProperty useRelativeWidth = property.FindPropertyRelative("useRelativeWidth"); SerializedProperty autoWidth = property.FindPropertyRelative("autoWidth"); SerializedProperty isSortable = property.FindPropertyRelative("isSortable"); SerializedProperty expandableHeight = property.FindPropertyRelative("expandableHeight"); SerializedProperty autoColumnTitle = property.FindPropertyRelative("autoColumnTitle"); SerializedProperty columnTitle = property.FindPropertyRelative("columnTitle"); SerializedProperty useColumnTitleImage = property.FindPropertyRelative("useColumnTitleImage"); SerializedProperty columnTitleImage = property.FindPropertyRelative("columnTitleImage"); SerializedProperty cellStyle = property.FindPropertyRelative("cellStyle"); TableCell[] allCellPrefabs = AssetDatabase.FindAssets("t:Prefab") .Select(guid => AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GUIDToAssetPath(guid))) .Where(prefab => prefab.GetComponent <TableCell>() != null) .Select(prefab => prefab.GetComponent <TableCell>()) .ToArray(); position = position.SetPositionForFirstLine(); MemberInfo[] members = tableColumnInfo.GetValidMembers(); string[] propertyOptions = members .Select(pi => pi.Name) .ToArray(); string[] propertyWithTypeOptions = members .Select(pi => (pi.MemberType == MemberTypes.Method) ? string.Format("{0} ()", pi.Name) : string.Format("{1} {0}", pi.Name, GetTypeName(new PropertyOrFieldInfo(pi).Type))) .ToArray(); int selectedPropertyIndex = System.Array.IndexOf(propertyOptions, fieldName.stringValue); property.serializedObject.ApplyModifiedProperties(); bool wasValid = tableColumnInfo.IsMemberValid; if (!wasValid) { if (string.IsNullOrEmpty(fieldName.stringValue)) { propertyWithTypeOptions = new string[] { "No Property" } }
public void ClickOnColumn(TableColumnInfo column) { if (column == sortingColumn) { sortMode = (SortMode)((((int)sortMode) + 1) % System.Enum.GetValues(typeof(SortMode)).Length); } else { sortingColumn = column; sortMode = SortMode.Ascending; } }
public void ColumnTitleClicked(TableColumnInfo column) { sortingState.ClickOnColumn(column); UpdateContent(); }
public SortingState(TableColumnInfo sortingColumn, SortMode sortMode) { this.sortingColumn = sortingColumn; this.sortMode = sortMode; }