private void UpdateFilter(int instanceID, SearchFilter filter, float previewSize) { SavedFilter savedFilter = this.Find(instanceID); if (savedFilter != null) { if (filter != null) { SearchFilter filter2 = ObjectCopier.DeepClone <SearchFilter>(filter); savedFilter.m_Filter = filter2; } savedFilter.m_PreviewSize = previewSize; this.Changed(); } else { Debug.LogError(string.Concat(new object[] { "Could not find saved filter ", instanceID, " ", ScriptableSingleton <SavedSearchFilters> .instance.ToString() })); } }
private TreeViewItem BuildTreeView() { this.Init(); if (this.m_SavedFilters.Count == 0) { Debug.LogError("BuildTreeView: No saved filters! We should at least have a root"); return(null); } TreeViewItem root = null; List <TreeViewItem> visibleItems = new List <TreeViewItem>(); for (int i = 0; i < this.m_SavedFilters.Count; i++) { SavedFilter filter = this.m_SavedFilters[i]; int iD = filter.m_ID; int depth = filter.m_Depth; bool isFolder = filter.m_Filter.GetState() == SearchFilter.State.FolderBrowsing; TreeViewItem item = new SearchFilterTreeItem(iD, depth, null, filter.m_Name, isFolder); if (i == 0) { root = item; } else { visibleItems.Add(item); } } TreeViewUtility.SetChildParentReferences(visibleItems, root); return(root); }
private int GetNextAvailableID() { List <int> intList = new List <int>(); using (List <SavedFilter> .Enumerator enumerator = this.m_SavedFilters.GetEnumerator()) { while (enumerator.MoveNext()) { SavedFilter current = enumerator.Current; if (current.m_ID >= ProjectWindowUtil.k_FavoritesStartInstanceID) { intList.Add(current.m_ID); } } } intList.Sort(); int favoritesStartInstanceId = ProjectWindowUtil.k_FavoritesStartInstanceID; for (int index = 0; index < 1000; ++index) { if (intList.BinarySearch(favoritesStartInstanceId) < 0) { return(favoritesStartInstanceId); } ++favoritesStartInstanceId; } Debug.LogError((object)("Could not assign valid ID to saved filter " + DebugUtils.ListToString <int>((IEnumerable <int>)intList) + " " + (object)favoritesStartInstanceId)); return(ProjectWindowUtil.k_FavoritesStartInstanceID + 1000); }
private void Move(int instanceID, int parentInstanceID, int targetInstanceID, bool after) { if (!this.IsValidMove(instanceID, parentInstanceID, targetInstanceID, after)) { return; } int index = this.IndexOf(instanceID); int index2 = this.IndexOf(parentInstanceID); int num = this.IndexOf(targetInstanceID); SavedFilter savedFilter = this.m_SavedFilters[index]; SavedFilter savedFilter2 = this.m_SavedFilters[index2]; int num2 = 0; if (this.m_AllowHierarchy) { num2 = savedFilter2.m_Depth + 1 - savedFilter.m_Depth; } List <SavedFilter> savedFilterAndChildren = this.GetSavedFilterAndChildren(instanceID); this.m_SavedFilters.RemoveRange(index, savedFilterAndChildren.Count); foreach (SavedFilter current in savedFilterAndChildren) { current.m_Depth += num2; } num = this.IndexOf(targetInstanceID); if (num != -1) { this.m_SavedFilters.InsertRange(num + 1, savedFilterAndChildren); } this.Changed(); }
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>(); for (int i = 0; i < this.m_SavedFilters.Count; i++) { 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 { list.Add(treeViewItem2); } } TreeViewUtility.SetChildParentReferences(list, treeViewItem); result = treeViewItem; } return(result); }
private TreeViewItem BuildTreeView() { this.Init(); if (this.m_SavedFilters.Count == 0) { Debug.LogError((object)"BuildTreeView: No saved filters! We should at least have a root"); return((TreeViewItem)null); } TreeViewItem root = (TreeViewItem)null; List <TreeViewItem> visibleItems = new List <TreeViewItem>(); for (int index = 0; index < this.m_SavedFilters.Count; ++index) { SavedFilter savedFilter = this.m_SavedFilters[index]; int id = savedFilter.m_ID; int depth = savedFilter.m_Depth; bool isFolder = savedFilter.m_Filter.GetState() == SearchFilter.State.FolderBrowsing; TreeViewItem treeViewItem = (TreeViewItem) new SearchFilterTreeItem(id, depth, (TreeViewItem)null, savedFilter.m_Name, isFolder); if (index == 0) { root = treeViewItem; } else { visibleItems.Add(treeViewItem); } } TreeViewUtility.SetChildParentReferences(visibleItems, root); return(root); }
private void Move(int instanceID, int parentInstanceID, int targetInstanceID, bool after) { if (this.IsValidMove(instanceID, parentInstanceID, targetInstanceID, after)) { int index = this.IndexOf(instanceID); int num2 = this.IndexOf(parentInstanceID); int num3 = this.IndexOf(targetInstanceID); SavedFilter filter = this.m_SavedFilters[index]; SavedFilter filter2 = this.m_SavedFilters[num2]; int num4 = 0; if (this.m_AllowHierarchy) { num4 = (filter2.m_Depth + 1) - filter.m_Depth; } List <SavedFilter> savedFilterAndChildren = this.GetSavedFilterAndChildren(instanceID); this.m_SavedFilters.RemoveRange(index, savedFilterAndChildren.Count); foreach (SavedFilter filter3 in savedFilterAndChildren) { filter3.m_Depth += num4; } num3 = this.IndexOf(targetInstanceID); if (num3 != -1) { this.m_SavedFilters.InsertRange(num3 + 1, savedFilterAndChildren); } this.Changed(); } }
// 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); }
public static SearchFilter GetFilter(int instanceID) { SavedFilter sf = instance.Find(instanceID); if (sf != null && sf.m_Filter != null) { return(ObjectCopier.DeepClone(sf.m_Filter)); } return(null); }
public static SearchFilter GetFilter(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (savedFilter != null && savedFilter.m_Filter != null) { return(ObjectCopier.DeepClone <SearchFilter>(savedFilter.m_Filter)); } return((SearchFilter)null); }
public static float GetPreviewSize(int instanceID) { SavedFilter sf = instance.Find(instanceID); if (sf != null) { return(sf.m_PreviewSize); } return(-1f); }
public static float GetPreviewSize(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (savedFilter != null) { return(savedFilter.m_PreviewSize); } return(-1f); }
public static string GetName(int instanceID) { SavedFilter filter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (filter != null) { return(filter.m_Name); } Debug.LogError(string.Concat(new object[] { "Could not find saved filter ", instanceID, " ", ScriptableSingleton <SavedSearchFilters> .instance.ToString() })); return(string.Empty); }
public static string GetName(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (savedFilter != null) { return(savedFilter.m_Name); } Debug.LogError((object)("Could not find saved filter " + (object)instanceID + " " + ScriptableSingleton <SavedSearchFilters> .instance.ToString())); return(string.Empty); }
public override string ToString() { string text = "Saved Filters "; for (int i = 0; i < m_SavedFilters.Count; ++i) { int instanceID = m_SavedFilters[i].m_ID; SavedFilter s = m_SavedFilters[i]; text += string.Format(": {0} ({1})({2})({3}) ", s.m_Name, instanceID, s.m_Depth, s.m_PreviewSize); } return(text); }
public static string GetName(int instanceID) { SavedFilter filter = instance.Find(instanceID); if (filter != null) { return(filter.m_Name); } Debug.LogError("Could not find saved filter " + instanceID + " " + instance); return(""); }
public override string ToString() { string str = "Saved Filters "; for (int index = 0; index < this.m_SavedFilters.Count; ++index) { int id = this.m_SavedFilters[index].m_ID; SavedFilter savedFilter = this.m_SavedFilters[index]; str += string.Format(": {0} ({1})({2})({3}) ", (object)savedFilter.m_Name, (object)id, (object)savedFilter.m_Depth, (object)savedFilter.m_PreviewSize); } return(str); }
public override string ToString() { string str = "Saved Filters "; for (int i = 0; i < this.m_SavedFilters.Count; i++) { int iD = this.m_SavedFilters[i].m_ID; SavedFilter filter = this.m_SavedFilters[i]; str = str + $": {filter.m_Name} ({iD})({filter.m_Depth})({filter.m_PreviewSize}) "; } return(str); }
public override string ToString() { string str = "Saved Filters "; for (int i = 0; i < this.m_SavedFilters.Count; i++) { int iD = this.m_SavedFilters[i].m_ID; SavedFilter filter = this.m_SavedFilters[i]; object[] args = new object[] { filter.m_Name, iD, filter.m_Depth, filter.m_PreviewSize }; str = str + string.Format(": {0} ({1})({2})({3}) ", args); } return(str); }
int Add(string displayName, SearchFilter filter, float previewSize, int insertAfterInstanceID, bool addAsChild) { SearchFilter filterCopy = null; if (filter != null) { filterCopy = ObjectCopier.DeepClone(filter); } // Clear unused data before saving if (filterCopy.GetState() == SearchFilter.State.SearchingInAllAssets || filterCopy.GetState() == SearchFilter.State.SearchingInAssetsOnly || filterCopy.GetState() == SearchFilter.State.SearchingInPackagesOnly || filterCopy.GetState() == SearchFilter.State.SearchingInAssetStore) { filterCopy.folders = new string[0]; } int afterIndex = 0; // add after root index if (insertAfterInstanceID != 0) { afterIndex = IndexOf(insertAfterInstanceID); if (afterIndex == -1) { Debug.LogError("Invalid insert position"); return(0); } } int depth = m_SavedFilters[afterIndex].m_Depth + (addAsChild ? 1 : 0); SavedFilter savedFilter = new SavedFilter(displayName, filterCopy, depth, previewSize); savedFilter.m_ID = GetNextAvailableID(); if (m_SavedFilters.Count == 0) { m_SavedFilters.Add(savedFilter); } else { m_SavedFilters.Insert(afterIndex + 1, savedFilter); // insert after wanted index } // Select new Saved filter //Selection.activeInstanceID = savedFilter.m_ID; Changed(); return(savedFilter.m_ID); }
public static void SetName(int instanceID, string name) { SavedFilter filter = instance.Find(instanceID); if (filter != null) { filter.m_Name = name; instance.Changed(); } else { Debug.LogError("Could not set name of saved filter " + instanceID + " " + instance); } }
public static void SetName(int instanceID, string name) { SavedFilter filter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (filter != null) { filter.m_Name = name; ScriptableSingleton <SavedSearchFilters> .instance.Changed(); } else { Debug.LogError(string.Concat(new object[] { "Could not set name of saved filter ", instanceID, " ", ScriptableSingleton <SavedSearchFilters> .instance.ToString() })); } }
public static void SetName(int instanceID, string name) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (savedFilter != null) { savedFilter.m_Name = name; ScriptableSingleton <SavedSearchFilters> .instance.Changed(); } else { Debug.LogError((object)("Could not set name of saved filter " + (object)instanceID + " " + ScriptableSingleton <SavedSearchFilters> .instance.ToString())); } }
public static SearchFilter GetFilter(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); SearchFilter result; if (savedFilter != null && savedFilter.m_Filter != null) { result = ObjectCopier.DeepClone <SearchFilter>(savedFilter.m_Filter); } else { result = null; } return(result); }
public static float GetPreviewSize(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); float result; if (savedFilter != null) { result = savedFilter.m_PreviewSize; } else { result = -1f; } return(result); }
void Move(int instanceID, int parentInstanceID, int targetInstanceID, bool after) { if (!IsValidMove(instanceID, parentInstanceID, targetInstanceID, after)) { return; } int index = IndexOf(instanceID); int parentIndex = IndexOf(parentInstanceID); int targetIndex = IndexOf(targetInstanceID); SavedFilter filter = m_SavedFilters[index]; SavedFilter parent = m_SavedFilters[parentIndex]; int depthChange = 0; if (m_AllowHierarchy) { depthChange = (parent.m_Depth + 1) - filter.m_Depth; } // Remove range from list (there could be children that is also moved) List <SavedFilter> moveList = GetSavedFilterAndChildren(instanceID); m_SavedFilters.RemoveRange(index, moveList.Count); // Update depth foreach (SavedFilter s in moveList) { s.m_Depth += depthChange; } // Insert after target targetIndex = IndexOf(targetInstanceID); if (targetIndex != -1) { if (after) { targetIndex += 1; } m_SavedFilters.InsertRange(targetIndex, moveList); } Changed(); }
public override string ToString() { string text = "Saved Filters "; for (int i = 0; i < this.m_SavedFilters.Count; i++) { int iD = this.m_SavedFilters[i].m_ID; SavedFilter savedFilter = this.m_SavedFilters[i]; text += string.Format(": {0} ({1})({2})({3}) ", new object[] { savedFilter.m_Name, iD, savedFilter.m_Depth, savedFilter.m_PreviewSize }); } return(text); }
private void UpdateFilter(int instanceID, SearchFilter filter, float previewSize) { SavedFilter savedFilter = this.Find(instanceID); if (savedFilter != null) { if (filter != null) { SearchFilter searchFilter = ObjectCopier.DeepClone <SearchFilter>(filter); savedFilter.m_Filter = searchFilter; } savedFilter.m_PreviewSize = previewSize; this.Changed(); } else { Debug.LogError((object)("Could not find saved filter " + (object)instanceID + " " + ScriptableSingleton <SavedSearchFilters> .instance.ToString())); } }
private int Add(string displayName, SearchFilter filter, float previewSize, int insertAfterInstanceID, bool addAsChild) { SearchFilter searchFilter = null; if (filter != null) { searchFilter = ObjectCopier.DeepClone <SearchFilter>(filter); } if (searchFilter.GetState() == SearchFilter.State.SearchingInAllAssets || searchFilter.GetState() == SearchFilter.State.SearchingInAssetStore) { searchFilter.folders = new string[0]; } int num = 0; int result; if (insertAfterInstanceID != 0) { num = this.IndexOf(insertAfterInstanceID); if (num == -1) { Debug.LogError("Invalid insert position"); result = 0; return(result); } } int depth = this.m_SavedFilters[num].m_Depth + ((!addAsChild) ? 0 : 1); SavedFilter savedFilter = new SavedFilter(displayName, searchFilter, depth, previewSize); savedFilter.m_ID = this.GetNextAvailableID(); if (this.m_SavedFilters.Count == 0) { this.m_SavedFilters.Add(savedFilter); } else { this.m_SavedFilters.Insert(num + 1, savedFilter); } this.Changed(); result = savedFilter.m_ID; return(result); }