Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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);
         }
     }
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        public void ApplyData(string searchTerm, AssetDataDisplay element, IReadOnlyList <AssetData> data, int idx)
        {
            var matcher = SoftStringMatcher.New(searchTerm);

            element.Apply(matcher, data[idx]);
        }
Ejemplo n.º 7
0
 public bool IsLessSpecificThan(SoftStringMatcher other)
 {
     return(CompareTo(other) == ComparisonResult.Less);
 }