コード例 #1
0
        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" }
                }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public void ColumnTitleClicked(TableColumnInfo column)
 {
     sortingState.ClickOnColumn(column);
     UpdateContent();
 }
コード例 #4
0
 public SortingState(TableColumnInfo sortingColumn, SortMode sortMode)
 {
     this.sortingColumn = sortingColumn;
     this.sortMode      = sortMode;
 }