public NoInactiveBehaviours( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both, List <Type> excludedTypes = null) : base(level, scope) { this.excludedTypes = excludedTypes ?? new List <Type>(); }
private Rule ConstructRule(Type ruleClass, ViolationLevel level, ViolationScope scope, List <Type> excludedTypes) { if (excludedTypes == null || excludedTypes.Count == 0) { ConstructorInfo ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope) }); return((Rule)ctor.Invoke(new object[] { level, scope })); } else { ConstructorInfo ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope), typeof(List <Type>) }); if (ctor == null) { Log.Debug("Could not find constructor for " + ruleClass + " that takes list of excluded types. Using default constructor."); ctor = ruleClass.GetConstructor(new[] { typeof(ViolationLevel), typeof(ViolationScope) }); return((Rule)ctor.Invoke(new object[] { level, scope })); } return((Rule)ctor.Invoke(new object[] { level, scope, excludedTypes })); } }
public Dictionary <Rule, List <IViolation> > Analyze(ViolationScope scope, GameObject root) { var violations = new Dictionary <Rule, List <IViolation> >(); if (root == null) { return(violations); } for (var j = 0; j < this.gameObjectRules.Count; j++) { var rule = this.gameObjectRules[j]; if (!rule.ValidForScope(scope)) { continue; } violations[rule] = rule.Handle(root); } foreach (var componentRuleSet in this.componentRules) { var rules = componentRuleSet.Value; for (var j = 0; j < rules.Count; j++) { var rule = rules[j]; if (!rule.ValidForScope(scope)) { continue; } var components = root.GetComponents(componentRuleSet.Key); violations[rule] = new List <IViolation>(); for (var i = 0; i < components.Length; i++) { var component = components[i]; violations[rule].AddRange(rule.Handle(component)); } } } foreach (Transform child in root.transform) { var moreViolations = this.Analyze(scope, child.gameObject); violations = MergeRuleViolationDictionary(violations, moreViolations); } return(violations); }
public NoDuplicateComponents( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
public NoMissingComponents( ViolationLevel level = ViolationLevel.Error, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
protected Rule(ViolationLevel level, ViolationScope scope) { this.Level = level; this.Scope = scope; }
public bool ValidForScope(ViolationScope scope) { return(this.Scope == ViolationScope.Both || this.Scope == scope); }
public NoMissingObjectReferences( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }
public NoImageWithMissingSprite( ViolationLevel level = ViolationLevel.Warning, ViolationScope scope = ViolationScope.Both) : base(level, scope) { }