コード例 #1
0
        protected override void RefreshDrawers()
        {
            itemDrawers.Clear();
            if (Target != null && Target is IList list)
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    Type itemType        = list[i].GetType();
                    bool isTypeSupported = DrawerUtility.IsTypeSupported(itemType);

                    if (!isTypeSupported)
                    {
                        itemDrawers.Add(new UnsupportedTypeDrawer()
                        {
                            Label      = "" + i,
                            TargetType = itemType
                        });
                    }
                    else
                    {
                        ItemDrawer itemDrawer = new ItemDrawer(Target, i);
                        itemDrawer.ParentDrawer = this;

                        itemDrawers.Add(itemDrawer);
                    }
                }
            }
        }
コード例 #2
0
        protected override void RefreshDrawers()
        {
            itemDrawers.Clear();
            if (Target == null)
            {
                return;
            }

            Type[] allTypes = DrawerUtility.GetAllBaseTypes(Target.GetType());
            if (allTypes != null && allTypes.Length > 0)
            {
                if (!IsShowInherit)
                {
                    itemDrawers.Add(new HeaderDrawer()
                    {
                        Header = allTypes[allTypes.Length - 1].Name,
                    });
                }
                foreach (var type in allTypes)
                {
                    if (IsShowInherit)
                    {
                        itemDrawers.Add(new HeaderDrawer()
                        {
                            Header = type.Name,
                        });
                    }

                    FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
                    foreach (var field in fields)
                    {
                        if (DrawerUtility.IsTypeSupported(field.FieldType))
                        {
                            ItemDrawer fieldDrawer = new ItemDrawer(Target, field);
                            fieldDrawer.ParentDrawer = this;

                            itemDrawers.Add(fieldDrawer);
                        }
                        else
                        {
                            itemDrawers.Add(new UnsupportedTypeDrawer()
                            {
                                Label      = field.Name,
                                TargetType = field.FieldType,
                            });
                        }
                    }
                    if (IsShowInherit)
                    {
                        itemDrawers.Add(new HorizontalLineDrawer());
                    }
                }
            }
        }
コード例 #3
0
 public ArrayDrawer(ItemDrawer itemDrawer) : this(itemDrawer.Value)
 {
 }