Version: 2022.3

SearchExpressionEvaluatorSignatureOverloadAttribute

class in UnityEditor.Search

切换到手册

描述

Allows user to add more function signature overload to a SearchExpressionEvaluatorAttribute.

Here is an evaluator with 2 functional signatures:

[Description("Convert arguments to a string allowing you to format the result.")]
[SearchExpressionEvaluator(SearchExpressionType.Selector | SearchExpressionType.Text, SearchExpressionType.Iterable | SearchExpressionType.Literal | SearchExpressionType.Variadic)]
[SearchExpressionEvaluatorSignatureOverload(SearchExpressionType.Iterable | SearchExpressionType.Literal | SearchExpressionType.Variadic)]
public static IEnumerable<SearchItem> FormatItems(SearchExpressionContext c)
{
    var skipCount = 0;
    if (SearchExpression.GetFormatString(c.args[0], out var formatStr))
        skipCount++;
    var items = c.args.Skip(skipCount).SelectMany(e => e.Execute(c));
    var dataSet = SearchExpression.ProcessValues(items, null, item => SearchExpression.FormatItem(c.search, item, formatStr));
    return dataSet;
}

构造函数

SearchExpressionEvaluatorSignatureOverloadAttributeAdd an overload signature to an existing SearchExpressionEvaluator.