예제 #1
0
        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);
        }
예제 #2
0
        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());
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }