/// <summary> /// Gets all drawers for a given property. /// </summary> public static OdinDrawer[] GetDrawersForProperty(InspectorProperty property) { if (property == null) { throw new ArgumentNullException("property"); } MemberInfo memberInfo = property.Info.MemberInfo; if (property.Info.PropertyType == PropertyType.Method) { return(GetDrawersForInstanceMethod(property.Info.MemberInfo)); } else if (property.Info.PropertyType == PropertyType.Group) { PropertyGroupAttribute attr = property.Info.GetAttribute <PropertyGroupAttribute>(); if (attr != null) { Type attrType = attr.GetType(); return(GetPropertyGroupDrawers(attrType)); } else { throw new InvalidOperationException("Property group property had no property group attribute!"); } } else { bool isListElement = property.ParentValueProperty != null && property.ParentValueProperty.Info == property.Info; return(DrawerLocator.GetDrawersForMemberInfo(memberInfo, property.ValueEntry.TypeOfValue, isListElement)); } }
// This method is called for all attributes with the same path, and this is where we will handle merging the colour values as mentioned earlier. protected override void CombineValuesWith(PropertyGroupAttribute other) { var otherAttr = (ColoredFoldoutGroupAttribute)other; this.r = Math.Max(otherAttr.r, this.r); this.g = Math.Max(otherAttr.g, this.g); this.b = Math.Max(otherAttr.b, this.b); this.a = Math.Max(otherAttr.a, this.a); }
protected override void CombineValuesWith(PropertyGroupAttribute other) { var otherAttr = (ColorFoldoutGroupAttribute)other; this.R = Math.Max(otherAttr.R, this.R); this.G = Math.Max(otherAttr.G, this.G); this.B = Math.Max(otherAttr.B, this.B); this.A = Math.Max(otherAttr.A, this.A); }
private void RaisePropertyChangedForGroup(string PrimaryGroupName, string SecondaryGroupName) { string[] QuestionBindingProps = PropertyGroupAttribute.GetPropertyNamesByGroup(this.GetType(), PrimaryGroupName, SecondaryGroupName); foreach (string Prop in QuestionBindingProps) { RaisePropertyChanged(Prop); } }
// This function is used to combine multiple group properties together. // With this it's possible to only specify some settings in just a single attribute, and // still have those settings affect the group as a whole. protected override void CombineValuesWith(PropertyGroupAttribute other) { var party = (PartyGroupAttribute)other; if (this.Speed == 0f) { this.Speed = party.Speed; } if (this.Range == 0f) { this.Range = party.Range; } }
/// <summary> /// Combines ShowIfGroup attributes. /// </summary> /// <param name="other">Another ShowIfGroup attribute.</param> protected override void CombineValuesWith(PropertyGroupAttribute other) { var attr = other as ShowIfGroupAttribute; if (string.IsNullOrEmpty(this.memberName) == false) { attr.memberName = this.memberName; } if (this.Animate == false) { attr.Animate = this.Animate; } if (this.Value != null) { attr.Value = this.Value; } }