public void Apply(SoftStringMatcher match, AssetData data) { if (data.Texture != null) { _image.style.backgroundImage = data.Texture; } else { _image.style.backgroundImage = AssetDatabase.GetCachedIcon(data.Path) as Texture2D; } _name.SetText(data.DisplayName, match.FirstMatch(data.DisplayName)); _path.SetText(data.Path, match.LastMatch(data.Path)); }
public ITerminationHandle SetSearchData(ISelectionPosition selectionPosition, IConsumer <AssetData> consumer, string search) { _filter = search.Trim(); if (_filter.Length == 0) { _results.Clear(); return(null); } var matcher = SoftStringMatcher.New(_filter); _results.SetMatcher(matcher); return(new SearchProcess <AssetData>(_results, selectionPosition, consumer)); }
public AssetStepDriver(SoftStringMatcher matcher, HierarchyProperty parent) { Matcher = matcher; if (parent != null && !parent.isValid) { HierarchyProperty = parent; } else { HierarchyProperty = new HierarchyProperty(HierarchyType.Assets); if (parent != null) { HierarchyProperty.Find(parent.instanceID, null); } } }
ITerminationHandle ISearchLens <GameObject> .SetSearchData(ISelectionPosition selectionPosition, IConsumer <GameObject> consumer, string search) { if (_searchString == null) { _objects = new CachedEnumerable <GameObject>(SceneWalker.SceneObjectsDFS(ShouldExploreObject)); } _searchString = search; if (search.Length > 0) { var matcher = SoftStringMatcher.New(search); consumer.Consume(_objects.Where(g => matcher.IsMatch(g.name))); } return(null); }
public ComparisonResult CompareTo(SoftStringMatcher other) { int otherCount = other._normalizedString.Count; int thisCount = _normalizedString.Count; if (otherCount == thisCount) { for (int i = 0; i < thisCount; i++) { if (_normalizedString[i] != other._normalizedString[i]) { return(ComparisonResult.Incomparable); } } return(ComparisonResult.Equal); } if (thisCount < otherCount) { return(IsMatch(other._normalizedString) ? ComparisonResult.Less : ComparisonResult.Incomparable); } return(other.IsMatch(_normalizedString) ? ComparisonResult.Greater : ComparisonResult.Incomparable); }
public void ApplyData(string searchTerm, AssetDataDisplay element, IReadOnlyList <AssetData> data, int idx) { var matcher = SoftStringMatcher.New(searchTerm); element.Apply(matcher, data[idx]); }
public bool IsLessSpecificThan(SoftStringMatcher other) { return(CompareTo(other) == ComparisonResult.Less); }