Esempio n. 1
0
        protected override void BeforeRowsGUI()
        {
            IList <TreeViewItem> rows = this.GetRows();
            int num;
            int num2;

            base.GetFirstAndLastVisibleRows(out num, out num2);
            if (num2 != -1)
            {
                for (int i = num; i <= num2; i++)
                {
                    ((SerializedPropertyTreeView.SerializedPropertyItem)rows[i]).GetData().Update();
                }
            }
            IList <TreeViewItem> list = base.FindRows(base.GetSelection());

            using (IEnumerator <TreeViewItem> enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SerializedPropertyTreeView.SerializedPropertyItem serializedPropertyItem = (SerializedPropertyTreeView.SerializedPropertyItem)enumerator.Current;
                    serializedPropertyItem.GetData().Update();
                }
            }
            base.BeforeRowsGUI();
        }
Esempio n. 2
0
 protected override void RowGUI(TreeView.RowGUIArgs args)
 {
     SerializedPropertyTreeView.SerializedPropertyItem item = (SerializedPropertyTreeView.SerializedPropertyItem)args.item;
     for (int i = 0; i < args.GetNumVisibleColumns(); i++)
     {
         this.CellGUI(args.GetCellRect(i), item, args.GetColumn(i), ref args);
     }
 }
Esempio n. 3
0
        protected override IList <TreeViewItem> BuildRows(TreeViewItem root)
        {
            if (this.m_Items == null)
            {
                SerializedPropertyDataStore.Data[] elements = this.m_DataStore.GetElements();
                this.m_Items = new List <TreeViewItem>(elements.Length);
                for (int i = 0; i < elements.Length; i++)
                {
                    SerializedPropertyTreeView.SerializedPropertyItem item2 = new SerializedPropertyTreeView.SerializedPropertyItem(elements[i].objectId, 0, elements[i]);
                    this.m_Items.Add(item2);
                }
            }
            IEnumerable <TreeViewItem> enumerable = this.m_Items;

            if (this.m_bFilterSelection)
            {
                if (this.m_SelectionFilter == null)
                {
                    this.m_SelectionFilter = Selection.instanceIDs;
                }
                enumerable = from item in this.m_Items
                             where this.m_SelectionFilter.Contains(item.id)
                             select item;
            }
            else
            {
                this.m_SelectionFilter = null;
            }
            enumerable = this.Filter(enumerable);
            List <TreeViewItem> list = enumerable.ToList <TreeViewItem>();

            if (base.multiColumnHeader.sortedColumnIndex >= 0)
            {
                this.Sort(list, base.multiColumnHeader.sortedColumnIndex);
            }
            this.m_ChangedId = 0;
            TreeViewUtility.SetParentAndChildrenForItems(list, root);
            return(list);
        }
Esempio n. 4
0
 private void CellGUI(Rect cellRect, SerializedPropertyTreeView.SerializedPropertyItem item, int columnIndex, ref TreeView.RowGUIArgs args)
 {
     Profiler.BeginSample("SerializedPropertyTreeView.CellGUI");
     base.CenterRectUsingSingleLineHeight(ref cellRect);
     SerializedPropertyDataStore.Data  data   = item.GetData();
     SerializedPropertyTreeView.Column column = (SerializedPropertyTreeView.Column)base.multiColumnHeader.GetColumn(columnIndex);
     if (column.drawDelegate == SerializedPropertyTreeView.DefaultDelegates.s_DrawName)
     {
         Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.LabelField");
         TreeView.DefaultGUI.Label(cellRect, data.name, base.IsSelected(args.item.id), false);
         Profiler.EndSample();
     }
     else if (column.drawDelegate != null)
     {
         SerializedProperty[] properties = data.properties;
         int num = (column.dependencyIndices == null) ? 0 : column.dependencyIndices.Length;
         for (int i = 0; i < num; i++)
         {
             this.m_ColumnsInternal[columnIndex].dependencyProps[i] = properties[column.dependencyIndices[i]];
         }
         if (args.item.id == base.state.lastClickedID && base.HasFocus() && columnIndex == base.multiColumnHeader.state.visibleColumns[(base.multiColumnHeader.state.visibleColumns[0] != 0) ? 0 : 1])
         {
             GUI.SetNextControlName(SerializedPropertyTreeView.Styles.focusHelper);
         }
         SerializedProperty serializedProperty = data.properties[columnIndex];
         EditorGUI.BeginChangeCheck();
         Profiler.BeginSample("SerializedPropertyTreeView.OnItemGUI.drawDelegate");
         column.drawDelegate(cellRect, serializedProperty, this.m_ColumnsInternal[columnIndex].dependencyProps);
         Profiler.EndSample();
         if (EditorGUI.EndChangeCheck())
         {
             this.m_ChangedId = ((column.filter == null || !column.filter.Active()) ? this.m_ChangedId : GUIUtility.keyboardControl);
             data.Store();
             IList <int> selection = base.GetSelection();
             if (selection.Contains(data.objectId))
             {
                 IList <TreeViewItem> list = base.FindRows(selection);
                 Undo.RecordObjects((from r in list
                                     select((SerializedPropertyTreeView.SerializedPropertyItem)r).GetData().serializedObject.targetObject).ToArray <UnityEngine.Object>(), "Modify Multiple Properties");
                 foreach (TreeViewItem current in list)
                 {
                     if (current.id != args.item.id)
                     {
                         SerializedPropertyDataStore.Data data2 = ((SerializedPropertyTreeView.SerializedPropertyItem)current).GetData();
                         if (SerializedPropertyTreeView.IsEditable(data2.serializedObject.targetObject))
                         {
                             if (column.copyDelegate != null)
                             {
                                 column.copyDelegate(data2.properties[columnIndex], serializedProperty);
                             }
                             else
                             {
                                 SerializedPropertyTreeView.DefaultDelegates.s_CopyDefault(data2.properties[columnIndex], serializedProperty);
                             }
                             data2.Store();
                         }
                     }
                 }
             }
         }
         Profiler.EndSample();
     }
 }