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
 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();
     }
 }