本文整理汇总了C#中SearchFilter.GetState方法的典型用法代码示例。如果您正苦于以下问题:C# SearchFilter.GetState方法的具体用法?C# SearchFilter.GetState怎么用?C# SearchFilter.GetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchFilter
的用法示例。
在下文中一共展示了SearchFilter.GetState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshBuiltinResourceList
private void RefreshBuiltinResourceList(SearchFilter searchFilter)
{
if (!this.m_Owner.allowBuiltinResources || searchFilter.GetState() == SearchFilter.State.FolderBrowsing || searchFilter.GetState() == SearchFilter.State.EmptySearchFilter)
{
this.m_CurrentBuiltinResources = new BuiltinResource[0];
}
else
{
List<BuiltinResource> builtinResourceList1 = new List<BuiltinResource>();
if (searchFilter.assetLabels != null && searchFilter.assetLabels.Length > 0)
{
this.m_CurrentBuiltinResources = builtinResourceList1.ToArray();
}
else
{
List<int> intList = new List<int>();
foreach (string className in searchFilter.classNames)
{
int idCaseInsensitive = BaseObjectTools.StringToClassIDCaseInsensitive(className);
if (idCaseInsensitive >= 0)
intList.Add(idCaseInsensitive);
}
if (intList.Count > 0)
{
using (Dictionary<string, BuiltinResource[]>.Enumerator enumerator1 = this.m_BuiltinResourceMap.GetEnumerator())
{
while (enumerator1.MoveNext())
{
KeyValuePair<string, BuiltinResource[]> current1 = enumerator1.Current;
int classId = BaseObjectTools.StringToClassID(current1.Key);
using (List<int>.Enumerator enumerator2 = intList.GetEnumerator())
{
while (enumerator2.MoveNext())
{
int current2 = enumerator2.Current;
if (BaseObjectTools.IsDerivedFromClassID(classId, current2))
builtinResourceList1.AddRange((IEnumerable<BuiltinResource>) current1.Value);
}
}
}
}
}
BuiltinResource[] array = builtinResourceList1.ToArray();
if (array.Length > 0 && !string.IsNullOrEmpty(searchFilter.nameFilter))
{
List<BuiltinResource> builtinResourceList2 = new List<BuiltinResource>();
string lower = searchFilter.nameFilter.ToLower();
foreach (BuiltinResource builtinResource in array)
{
if (builtinResource.m_Name.ToLower().Contains(lower))
builtinResourceList2.Add(builtinResource);
}
array = builtinResourceList2.ToArray();
}
this.m_CurrentBuiltinResources = array;
}
}
}
示例2: Init
public void Init(Rect rect, HierarchyType hierarchyType, SearchFilter searchFilter, bool checkThumbnails)
{
this.m_TotalRect = this.m_VisibleRect = rect;
this.m_LocalAssets.UpdateFilter(hierarchyType, searchFilter, this.foldersFirst);
this.m_LocalAssets.UpdateAssets();
using (List<ObjectListArea.AssetStoreGroup>.Enumerator enumerator = this.m_StoreAssets.GetEnumerator())
{
while (enumerator.MoveNext())
enumerator.Current.UpdateFilter(hierarchyType, searchFilter, this.foldersFirst);
}
bool flag = searchFilter.GetState() == SearchFilter.State.FolderBrowsing;
if (flag)
{
this.m_LastAssetStoreQuerySearchFilter = string.Empty;
this.m_LastAssetStoreQueryClassName = new string[0];
this.m_LastAssetStoreQueryLabels = new string[0];
}
else
{
this.m_LastAssetStoreQuerySearchFilter = searchFilter.nameFilter != null ? searchFilter.nameFilter : string.Empty;
this.m_LastAssetStoreQueryClassName = searchFilter.classNames != null && Array.IndexOf<string>(searchFilter.classNames, "Object") < 0 ? searchFilter.classNames : new string[0];
this.m_LastAssetStoreQueryLabels = searchFilter.assetLabels != null ? searchFilter.assetLabels : new string[0];
}
this.m_LastAssetStoreQueryChangeTime = EditorApplication.timeSinceStartup;
this.m_RequeryAssetStore = true;
this.m_ShowLocalAssetsOnly = flag || searchFilter.GetState() != SearchFilter.State.SearchingInAssetStore;
this.m_AssetStoreError = string.Empty;
this.m_AllowThumbnails = !checkThumbnails || this.ObjectsHaveThumbnails(hierarchyType, searchFilter);
this.Repaint();
this.ClearCroppedLabelCache();
this.SetupData(true);
}
示例3: ValidateFilter
private bool ValidateFilter(int savedFilterID, SearchFilter filter)
{
if (filter == null)
return false;
switch (filter.GetState())
{
case SearchFilter.State.FolderBrowsing:
case SearchFilter.State.SearchingInFolders:
foreach (string folder in filter.folders)
{
if (AssetDatabase.GetMainAssetInstanceID(folder) == 0)
{
if (EditorUtility.DisplayDialog("Folder not found", "The folder '" + folder + "' might have been deleted or belong to another project. Do you want to delete the favorite?", "Delete", "Cancel"))
SavedSearchFilters.RemoveSavedFilter(savedFilterID);
return false;
}
}
break;
}
return true;
}
示例4: Init
public void Init(Rect rect, HierarchyType hierarchyType, SearchFilter searchFilter, bool checkThumbnails)
{
this.m_VisibleRect = rect;
this.m_TotalRect = rect;
this.m_LocalAssets.UpdateFilter(hierarchyType, searchFilter, this.foldersFirst);
foreach (ObjectListArea.AssetStoreGroup current in this.m_StoreAssets)
{
current.UpdateFilter(hierarchyType, searchFilter, this.foldersFirst);
}
bool flag = searchFilter.GetState() == SearchFilter.State.FolderBrowsing;
if (flag)
{
this.m_LastAssetStoreQuerySearchFilter = string.Empty;
this.m_LastAssetStoreQueryClassName = new string[0];
this.m_LastAssetStoreQueryLabels = new string[0];
}
else
{
this.m_LastAssetStoreQuerySearchFilter = ((searchFilter.nameFilter != null) ? searchFilter.nameFilter : string.Empty);
bool flag2 = searchFilter.classNames == null || Array.IndexOf<string>(searchFilter.classNames, "Object") >= 0;
this.m_LastAssetStoreQueryClassName = ((!flag2) ? searchFilter.classNames : new string[0]);
this.m_LastAssetStoreQueryLabels = ((searchFilter.assetLabels != null) ? searchFilter.assetLabels : new string[0]);
}
this.m_LastAssetStoreQueryChangeTime = EditorApplication.timeSinceStartup;
this.m_RequeryAssetStore = true;
this.m_ShowLocalAssetsOnly = (flag || searchFilter.GetState() != SearchFilter.State.SearchingInAssetStore);
this.m_AssetStoreError = string.Empty;
if (checkThumbnails)
{
this.m_AllowThumbnails = this.ObjectsHaveThumbnails(hierarchyType, searchFilter);
}
else
{
this.m_AllowThumbnails = true;
}
this.Repaint();
this.ClearCroppedLabelCache();
this.SetupData(true);
}
示例5: RefreshBuiltinResourceList
private void RefreshBuiltinResourceList(SearchFilter searchFilter)
{
if (!this.m_Owner.allowBuiltinResources || searchFilter.GetState() == SearchFilter.State.FolderBrowsing || searchFilter.GetState() == SearchFilter.State.EmptySearchFilter)
{
this.m_CurrentBuiltinResources = new BuiltinResource[0];
return;
}
List<BuiltinResource> list = new List<BuiltinResource>();
if (searchFilter.assetLabels != null && searchFilter.assetLabels.Length > 0)
{
this.m_CurrentBuiltinResources = list.ToArray();
return;
}
List<int> list2 = new List<int>();
string[] classNames = searchFilter.classNames;
for (int i = 0; i < classNames.Length; i++)
{
string classString = classNames[i];
int num = BaseObjectTools.StringToClassIDCaseInsensitive(classString);
if (num >= 0)
{
list2.Add(num);
}
}
if (list2.Count > 0)
{
foreach (KeyValuePair<string, BuiltinResource[]> current in this.m_BuiltinResourceMap)
{
int classID = BaseObjectTools.StringToClassID(current.Key);
foreach (int current2 in list2)
{
if (BaseObjectTools.IsDerivedFromClassID(classID, current2))
{
list.AddRange(current.Value);
}
}
}
}
BuiltinResource[] array = list.ToArray();
if (array.Length > 0 && !string.IsNullOrEmpty(searchFilter.nameFilter))
{
List<BuiltinResource> list3 = new List<BuiltinResource>();
string value = searchFilter.nameFilter.ToLower();
BuiltinResource[] array2 = array;
for (int j = 0; j < array2.Length; j++)
{
BuiltinResource builtinResource = array2[j];
if (builtinResource.m_Name.ToLower().Contains(value))
{
list3.Add(builtinResource);
}
}
array = list3.ToArray();
}
this.m_CurrentBuiltinResources = array;
}
示例6: ValidateFilter
private bool ValidateFilter(int savedFilterID, SearchFilter filter)
{
if (filter == null)
{
return false;
}
SearchFilter.State state = filter.GetState();
if (state == SearchFilter.State.FolderBrowsing || state == SearchFilter.State.SearchingInFolders)
{
string[] folders = filter.folders;
for (int i = 0; i < folders.Length; i++)
{
string text = folders[i];
if (AssetDatabase.GetMainAssetInstanceID(text) == 0)
{
if (EditorUtility.DisplayDialog("Folder not found", "The folder '" + text + "' might have been deleted or belong to another project. Do you want to delete the favorite?", "Delete", "Cancel"))
{
SavedSearchFilters.RemoveSavedFilter(savedFilterID);
}
return false;
}
}
}
return true;
}