static IQueryEngineFilter AddOrUpdatePropositionData(this IQueryEngineFilter filter, SearchProposition proposition) { var propositionDescription = SearchPropositionDescription.FromSearchProposition(proposition); var propositionKey = GetPropositionKey(proposition.label); filter.AddOrUpdateMetaInfo(propositionKey, EditorJsonUtility.ToJson(propositionDescription)); return(filter); }
public static SearchProposition GetPropositionFromKey(this IQueryEngineFilter filter, string propositionKey) { if (!filter.metaInfo.TryGetValue(propositionKey, out var propositionDescriptionStr)) { return(SearchProposition.invalid); } var propositionDescription = new SearchPropositionDescription(); EditorJsonUtility.FromJsonOverwrite(propositionDescriptionStr, propositionDescription); return(propositionDescription.ToSearchProposition()); }
public static IQueryEngineFilter AddPropositionsFromFilterType(this IQueryEngineFilter filter, string category = null, string help = null, string data = null, int priority = 0, Texture2D icon = null, System.Type type = null, Color color = default, TextCursorPlacement moveCursor = TextCursorPlacement.MoveAutoComplete) { var typePropositions = GetPropositionsFromType(filter, filter.type, category, type, priority, icon, color); var propositionOverride = new SearchProposition(category: category, label: string.Empty, help: help, data: data, priority: priority, icon: icon, type: type, color: color, moveCursor: moveCursor); var propositions = MergePropositions(typePropositions, propositionOverride); foreach (var proposition in propositions) { var propositionDescription = SearchPropositionDescription.FromSearchProposition(proposition); var propositionKey = GetPropositionKey(propositionDescription.label); filter.AddOrUpdateMetaInfo(propositionKey, EditorJsonUtility.ToJson(propositionDescription)); } return(filter); }
public static IQueryEngineFilter SetGlobalPropositionData(this IQueryEngineFilter filter, string category = null, string help = null, string data = null, int priority = 0, Texture2D icon = null, System.Type type = null, Color color = default, TextCursorPlacement moveCursor = TextCursorPlacement.MoveAutoComplete) { var propositionDescription = new SearchPropositionDescription() { category = category, help = help, data = data, priority = priority, icon = icon, type = type?.FullName, moveCursor = moveCursor, color = color }; var propositionKey = GetGlobalPropositionKey(); filter.AddOrUpdateMetaInfo(propositionKey, EditorJsonUtility.ToJson(propositionDescription)); return(filter); }