internal static void Init(FocusTarget focusTarget) { var openLocation = CollabSettingsManager.Get(CollabSettings.settingDefaultOpenLocation, fallback: CollabSettings.OpenLocation.Docked); CollaborateWindow window; if (openLocation == CollabSettings.OpenLocation.Docked) { // Dock next to inspector, if available var inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); window = GetWindow <CollaborateWindow>(inspectorType); } else { window = GetWindow <CollaborateWindow>(); } // Set up window window.titleContent = new GUIContent("Collaborate"); window.minSize = new Vector2(256, 400); // Display window window.Show(); window.Focus(); if (focusTarget != FocusTarget.None) { window.RequestFocus(focusTarget); } }
// Utility function for building a tree view from saved filter state. Returns root of tree TreeViewItem BuildTreeView() { Init(); if (m_SavedFilters.Count == 0) { Debug.LogError("BuildTreeView: No saved filters! We should at least have a root"); return(null); } TreeViewItem root = null; // Create rest of nodes List <TreeViewItem> items = new List <TreeViewItem>(); for (int i = 0; i < m_SavedFilters.Count; ++i) { SavedFilter savedFilter = m_SavedFilters[i]; int instanceID = savedFilter.m_ID; int depth = savedFilter.m_Depth; bool isFolder = savedFilter.m_Filter.GetState() == SearchFilter.State.FolderBrowsing; TreeViewItem item = new SearchFilterTreeItem(instanceID, depth, null, savedFilter.m_Name, isFolder); if (i == 0) { root = item; } else { if (Collab.instance.collabFilters.ContainsSearchFilter(savedFilter.m_Name, savedFilter.m_Filter.FilterToSearchFieldString())) { if (!Collab.instance.IsCollabEnabledForCurrentProject()) { continue; } } if (SoftlockViewController.Instance.softLockFilters.ContainsSearchFilter(savedFilter.m_Name, savedFilter.m_Filter.FilterToSearchFieldString())) { if (CollabSettingsManager.IsAvailable(CollabSettingType.InProgressEnabled)) { if (!Collab.instance.IsCollabEnabledForCurrentProject() || !CollabSettingsManager.inProgressEnabled) { continue; } } else { continue; } } items.Add(item); } } // Fix child/parent references TreeViewUtility.SetChildParentReferences(items, root); return(root); }
private TreeViewItem BuildTreeView() { this.Init(); TreeViewItem result; if (this.m_SavedFilters.Count == 0) { Debug.LogError("BuildTreeView: No saved filters! We should at least have a root"); result = null; } else { TreeViewItem treeViewItem = null; List <TreeViewItem> list = new List <TreeViewItem>(); int i = 0; while (i < this.m_SavedFilters.Count) { SavedFilter savedFilter = this.m_SavedFilters[i]; int iD = savedFilter.m_ID; int depth = savedFilter.m_Depth; bool isFolder = savedFilter.m_Filter.GetState() == SearchFilter.State.FolderBrowsing; TreeViewItem treeViewItem2 = new SearchFilterTreeItem(iD, depth, null, savedFilter.m_Name, isFolder); if (i == 0) { treeViewItem = treeViewItem2; } else { if (Collab.instance.collabFilters.ContainsSearchFilter(savedFilter.m_Name, savedFilter.m_Filter.FilterToSearchFieldString())) { if (!Collab.instance.IsCollabEnabledForCurrentProject()) { goto IL_133; } } if (SoftlockViewController.Instance.softLockFilters.ContainsSearchFilter(savedFilter.m_Name, savedFilter.m_Filter.FilterToSearchFieldString())) { if (!CollabSettingsManager.IsAvailable(CollabSettingType.InProgressEnabled)) { goto IL_133; } if (!Collab.instance.IsCollabEnabledForCurrentProject() || !CollabSettingsManager.inProgressEnabled) { goto IL_133; } } list.Add(treeViewItem2); } IL_133: i++; continue; goto IL_133; } TreeViewUtility.SetChildParentReferences(list, treeViewItem); result = treeViewItem; } return(result); }