Exemplo n.º 1
0
        private UnitOptionTree GetNewUnitOptions(UnitOptionFilter filter)
        {
            var options = new UnitOptionTree(new GUIContent("Unit"));

            options.filter    = filter;
            options.reference = reference;

            if (filter.CompatibleOutputType == typeof(object))
            {
                options.surfaceCommonTypeLiterals = true;
            }

            return(options);
        }
Exemplo n.º 2
0
        public static IEnumerable <IUnitOption> Subset(UnitOptionFilter filter, GraphReference reference)
        {
            lock (@lock)
            {
                if (options == null)
                {
                    Load();
                }

                var dynamicOptions    = UnityAPI.Await(() => GetDynamicOptions().ToHashSet());
                var contextualOptions = UnityAPI.Await(() => GetContextualOptions(reference).ToHashSet());

                return(LinqUtility.Concat <IUnitOption>(options, dynamicOptions, contextualOptions)
                       .Where((filter ?? UnitOptionFilter.Any).ValidateOption)
                       .ToArray());
            }
        }