private static string AssetTypeSuffix(ReUniterItemInfo x) { return(""); //currently disabled functionality showing type of assets in the search results // if (x.AssetType == null) // return ""; // return " <color=#777777>(" + x.AssetType + ")</color>"; }
private string Highlight(ReUniterItemInfo itemInfo, string searchTerms) { string item = itemInfo.Name; bool[] lettersToHighlight = new bool[item.Length]; foreach (var term in searchTerms.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)) { HighlightWord(item, term, lettersToHighlight); } if (itemInfo.StripExtension) { var lastDot = item.LastIndexOf('.'); if (lastDot != -1) { for (var i = lastDot; i < lettersToHighlight.Length; i++) { lettersToHighlight[i] = false; } } } var sb = new StringBuilder(); var chars = item.ToCharArray(); for (int index = 0; index < chars.Length; index++) { bool previousHighlighted = index != 0 && lettersToHighlight[index - 1]; bool currentHighlighted = lettersToHighlight[index]; if (!previousHighlighted && currentHighlighted) { sb.Append(ColorizePrefix()); } if (previousHighlighted && !currentHighlighted) { sb.Append(COLORIZE_SUFFIX); } sb.Append(chars[index]); if (index == chars.Length - 1 && currentHighlighted) { sb.Append(COLORIZE_SUFFIX); } } return(sb.ToString()); }
private static int ComputePenalty(ReUniterItemInfo item, List <string> searchTerms) { var fileName = item.NameWithoutExtension; var penalty = 0; var splitFileName = fileName.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (var searchTerm in searchTerms) { if (searchTerm.StartsWith(":")) { continue; } var penaltyFor = PenaltyFor(splitFileName, searchTerm); if (penaltyFor == Int32.MaxValue) { return(Int32.MaxValue); } penalty += penaltyFor; } return(penalty); }
private static Object[] LoadUnityObjects(ReUniterItemInfo itemInfo) { return(itemInfo.UnityObjects); }
private static Object[] LoadAsset(ReUniterItemInfo itemInfo) { var parentPath = itemInfo.ParentPath.Length == 0 ? "" : itemInfo.ParentPath + "/"; return(new[] { AssetDatabase.LoadAssetAtPath("Assets/" + parentPath + itemInfo.Name, typeof(Object)) }); }
private static Object[] LoadAsset(ReUniterItemInfo itemInfo) { return(new [] { AssetDatabase.LoadAssetAtPath("Assets/" + itemInfo.ParentPath + "/" + itemInfo.Name, typeof(Object)) }); }