public Result BuildQuery(string input) { if (string.IsNullOrEmpty(input)) { return(Result.ValidBecauseEmpty); } var matches = k_Regex.Matches(input); if (matches.Count == 0) { return(Result.Valid(null, input)); } using (var componentTypes = PooledHashSet <ComponentType> .Make()) { m_UnmatchedInputBuilder.Clear(); var pos = 0; for (var i = 0; i < matches.Count; i++) { var match = matches[i]; var matchGroup = match.Groups["componentType"]; var length = match.Index - pos; if (length > 0) { m_UnmatchedInputBuilder.Append(input.Substring(pos, length)); } pos = match.Index + match.Length; if (matchGroup.Value.Length == 0) { continue; } var results = ComponentTypeCache.GetExactMatchingTypes(matchGroup.Value); var resultFound = false; foreach (var result in results) { resultFound = true; componentTypes.Set.Add(result); } if (!resultFound) { return(Result.Invalid(matchGroup.Value)); } } if (input.Length - pos > 0) { m_UnmatchedInputBuilder.Append(input.Substring(pos)); } return(Result.Valid(new EntityQueryDesc { Any = componentTypes.Set.ToArray(), Options = EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabled }, m_UnmatchedInputBuilder.ToString())); } }
static string CheckComponentTypeExistence(IEnumerable <string> componentTypes) { foreach (var componentType in componentTypes) { if (!ComponentTypeCache.GetFuzzyMatchingTypes(componentType).Any()) { return(componentType); } } return(string.Empty); }