System.Predicate.Invoke(TechMapping)

Here are the examples of the csharp api System.Predicate.Invoke(TechMapping) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : TechTracker.cs
with MIT License
from jptrrs

public static IEnumerable<TechMapping> FindTechs<T>(T query) where T : clreplaced
        {
            if (typeof(T) == typeof(Predicate<TechMapping>))
            {
                Predicate<TechMapping> lookup = query as Predicate<TechMapping>;
                return Techs.Where(x => lookup(x));
            }
            if (typeof(T) == typeof(SkillDef))
            {
                return Techs.Where(x => x.Skills.Any(y => y == query));
            }
            if (typeof(T) == typeof(ThingDef))
            {
                if (query is ThingDef t && t.IsWithinCategory(TechDefOf.Knowledge))
                {
                    return Techs.Where(x => x.Stuff == query);
                }
                return Techs.Where(x => x.Weapons.Any(y => y == query));
            }
            if (typeof(T) == typeof(ResearchProjectDef))
            {
                return Techs.Where(x => x.Tech == query);
            }
            Log.Error($"[HumanResources] Can't find a tech by {query.GetType()}!");
            return null;
        }