Example #1
0
            private void InitRequirements(ComponentRequirementMap map)
            {
                this.Requirements = new List <Type>();

                IEnumerable <RequiredComponentAttribute> attribs = this.Component.GetTypeInfo().GetAttributesCached <RequiredComponentAttribute>();

                foreach (RequiredComponentAttribute a in attribs)
                {
                    Type reqType = a.RequiredComponentType;

                    // Don't require itself
                    if (reqType == this.Component)
                    {
                        continue;
                    }

                    // Ignore invalid constraints
                    if (!this.IsValidRequirement(a))
                    {
                        continue;
                    }

                    this.Requirements.AddRange(map.GetRequirements(reqType).Where(t => !this.Requirements.Contains(t)));
                    if (!this.Requirements.Contains(reqType))
                    {
                        this.Requirements.Add(reqType);
                    }
                }
            }
Example #2
0
 public static IEnumerable <Type> GetRequiredComponents(Type cmpType)
 {
     return(requireMap.GetRequirements(cmpType));
 }