public override void ProcessMemberProperties(List <InspectorPropertyInfo> memberInfos) { var attr = this.GetClassDefinedTypeInfoBox(this.Property); var p = InspectorPropertyInfo.CreateForMember(InjectedMemberInfo, false, SerializationBackend.None, new Attribute[] { new OnInspectorGUIAttribute(), new InfoBoxAttribute(attr.Message), new PropertyOrderAttribute(-100000) }); memberInfos.Insert(0, p); }
protected override InspectorPropertyInfo[] GetPropertyInfos() { this.targetType = this.ValueEntry.TypeOfValue; var members = targetType.GetAllMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); var infos = new List <InspectorPropertyInfo>(); this.allowObsoleteMembers = this.Property.Context.GetGlobal("ALLOW_OBSOLETE_STATIC_MEMBERS", false); foreach (var member in members.Where(Filter).OrderBy(Order)) { var attributes = new List <Attribute>(); InspectorPropertyInfoUtility.ProcessAttributes(this.Property, member, attributes); if (member is MethodInfo && !attributes.HasAttribute <ButtonAttribute>() && !attributes.HasAttribute <OnInspectorGUIAttribute>()) { attributes.Add(new ButtonAttribute(ButtonSizes.Medium)); } var info = InspectorPropertyInfo.CreateForMember(member, true, SerializationBackend.None, attributes); InspectorPropertyInfo previousPropertyWithName = null; int previousPropertyIndex = -1; for (int j = 0; j < infos.Count; j++) { if (infos[j].PropertyName == info.PropertyName) { previousPropertyIndex = j; previousPropertyWithName = infos[j]; break; } } if (previousPropertyWithName != null) { bool createAlias = true; if (member.SignaturesAreEqual(previousPropertyWithName.GetMemberInfo())) { createAlias = false; infos.RemoveAt(previousPropertyIndex); } if (createAlias) { var alias = InspectorPropertyInfoUtility.GetPrivateMemberAlias(previousPropertyWithName.GetMemberInfo(), previousPropertyWithName.TypeOfOwner.GetNiceName(), " -> "); infos[previousPropertyIndex] = InspectorPropertyInfo.CreateForMember(alias, true, SerializationBackend.None, attributes); } } infos.Add(info); } return(InspectorPropertyInfoUtility.BuildPropertyGroupsAndFinalize(this.Property, targetType, infos, false)); }
public static void AddProcessedMember(this IList <InspectorPropertyInfo> infos, InspectorProperty parentProperty, MemberInfo member, bool allowEditable = true, SerializationBackend backend = SerializationBackend.None, params Attribute[] attributes) { var list = new List <Attribute>(); if (attributes != null) { list.AddRange(attributes); } InspectorPropertyInfoUtility.ProcessAttributes(parentProperty, member, list); infos.Add(InspectorPropertyInfo.CreateForMember(member, allowEditable, backend, list)); }
public override InspectorPropertyInfo GetChildInfo(int childIndex) { if (childIndex == 0) { var member = typeof(Rect).GetProperty("position"); List <Attribute> attributes = new List <Attribute>(); return(InspectorPropertyInfo.CreateForMember(this.Property, member, true, attributes)); } else if (childIndex == 1) { var member = typeof(Rect).GetProperty("size"); List <Attribute> attributes = new List <Attribute>(); return(InspectorPropertyInfo.CreateForMember(this.Property, member, true, attributes)); } else { throw new NotImplementedException(); } }
public static void AddProcessedMember(this IList <InspectorPropertyInfo> infos, InspectorProperty parentProperty, string name, bool allowEditable = true, SerializationBackend backend = SerializationBackend.None, params Attribute[] attributes) { var type = ProcessingOwnerType; type = (parentProperty.ValueEntry != null) ? parentProperty.ValueEntry.TypeOfValue : ProcessingOwnerType; var members = type.GetMember(name, MemberTypes.Field | MemberTypes.Method | MemberTypes.Property, Flags.AllMembers); if (members.Length == 0 || members.Length > 1) { throw new ArgumentException("Could not find precisely 1 member on type '" + type.GetNiceName() + "' with name '" + name + "'; found " + members.Length + " members."); } var list = new List <Attribute>(); if (attributes != null) { list.AddRange(attributes); } InspectorPropertyInfoUtility.ProcessAttributes(parentProperty, members[0], list); infos.Add(InspectorPropertyInfo.CreateForMember(members[0], allowEditable, backend, list)); }
public static void AddMember(this IList <InspectorPropertyInfo> infos, MemberInfo member, bool allowEditable = true, SerializationBackend backend = SerializationBackend.None, params Attribute[] attributes) { infos.Add(InspectorPropertyInfo.CreateForMember(member, allowEditable, backend, attributes ?? new Attribute[0])); }