// Token: 0x06001155 RID: 4437 RVA: 0x00071279 File Offset: 0x0006F679
 public ObjectInspectableInfo(ObjectInspectableInfo newParent, IDirtyable newDirtyable, object newInstance, Type newType, TranslationReference newName, TranslationReference newTooltip)
 {
     this.parent    = newParent;
     this.dirtyable = newDirtyable;
     this.instance  = newInstance;
     this.type      = newType;
     this.name      = newName;
     this.tooltip   = newTooltip;
 }
Esempio n. 2
0
        // Token: 0x060011A5 RID: 4517 RVA: 0x00072A2C File Offset: 0x00070E2C
        public Sleek2InspectorList(Sleek2Inspector newRootInspector, ObjectInspectableInfo newParentInfo, IList newList, Type newListType, IInspectableList newInspectable)
        {
            this.rootInspector             = newRootInspector;
            this.parentInfo                = newParentInfo;
            this.list                      = newList;
            this.listType                  = newListType;
            this.inspectable               = newInspectable;
            base.name                      = "List";
            this.collapseFoldoutsByDefault = this.rootInspector.collapseFoldoutsByDefault;
            this.panel                     = new Sleek2Element();
            this.panel.transform.reset();
            this.addElement(this.panel);
            VerticalLayoutGroup verticalLayoutGroup = base.gameObject.AddComponent <VerticalLayoutGroup>();

            verticalLayoutGroup.spacing = 5f;
            verticalLayoutGroup.childForceExpandWidth  = true;
            verticalLayoutGroup.childForceExpandHeight = false;
            VerticalLayoutGroup verticalLayoutGroup2 = this.panel.gameObject.AddComponent <VerticalLayoutGroup>();

            verticalLayoutGroup2.spacing = 5f;
            verticalLayoutGroup2.childForceExpandWidth  = true;
            verticalLayoutGroup2.childForceExpandHeight = false;
            if (this.inspectable == null || this.inspectable.canInspectorAdd)
            {
                this.addButton = new Sleek2ImageLabelButton();
                this.addButton.transform.anchorMin      = new Vector2(0f, 0f);
                this.addButton.transform.anchorMax      = new Vector2(0f, 0f);
                this.addButton.transform.sizeDelta      = new Vector2(200f, 0f);
                this.addButton.clicked                 += this.handleAddButtonClicked;
                this.addButton.label.textComponent.text = "+";
                this.addElement(this.addButton);
                LayoutElement layoutElement = this.addButton.gameObject.AddComponent <LayoutElement>();
                layoutElement.minHeight = (float)Sleek2Config.bodyHeight;
            }
            if (this.inspectable != null)
            {
                this.inspectable.inspectorChanged += this.handleListChanged;
            }
            this.refresh();
        }
Esempio n. 3
0
        public Sleek2InspectorArray(Sleek2Inspector newRootInspector, ObjectInspectableInfo newParentInfo, Array newArray, Type newArrayType)
        {
            this.rootInspector = newRootInspector;
            this.parentInfo    = newParentInfo;
            this.array         = newArray;
            this.arrayType     = newArrayType;
            base.name          = "Array";
            this.panel         = new Sleek2Element();
            this.panel.transform.reset();
            this.addElement(this.panel);
            VerticalLayoutGroup verticalLayoutGroup = base.gameObject.AddComponent <VerticalLayoutGroup>();

            verticalLayoutGroup.spacing = 5f;
            verticalLayoutGroup.childForceExpandWidth  = true;
            verticalLayoutGroup.childForceExpandHeight = false;
            VerticalLayoutGroup verticalLayoutGroup2 = this.panel.gameObject.AddComponent <VerticalLayoutGroup>();

            verticalLayoutGroup2.spacing = 5f;
            verticalLayoutGroup2.childForceExpandWidth  = true;
            verticalLayoutGroup2.childForceExpandHeight = false;
            this.refresh();
        }
Esempio n. 4
0
 // Token: 0x06001172 RID: 4466 RVA: 0x000716A6 File Offset: 0x0006FAA6
 public ObjectInspectableProperty(ObjectInspectableInfo newParent, PropertyInfo newProperty, IDirtyable newDirtyable, object newInstance, TranslationReference newName, TranslationReference newTooltip) : base(newParent, newDirtyable, newInstance, newProperty.PropertyType, newName, newTooltip)
 {
     this.property = newProperty;
 }
Esempio n. 5
0
 public abstract void inspect(ObjectInspectableInfo newInspectable);
Esempio n. 6
0
        public void reflect(ObjectInspectableInfo parent, object instance, Sleek2Element panel)
        {
            if (instance == null)
            {
                panel.addElement(new Sleek2Label
                {
                    transform =
                    {
                        anchorMin = new Vector2(0f, 1f),
                        anchorMax = new Vector2(1f, 1f),
                        pivot     = new Vector2(0f, 1f),
                        sizeDelta = new Vector2(0f, 30f)
                    },
                    textComponent =
                    {
                        text = "null"
                    }
                });
                return;
            }
            Type type = instance.GetType();

            if (type.IsArray)
            {
                Array newArray               = instance as Array;
                Type  elementType            = type.GetElementType();
                Sleek2InspectorArray element = new Sleek2InspectorArray(this, parent, newArray, elementType);
                panel.addElement(element);
            }
            else if (type.IsGenericType && typeof(IList).IsAssignableFrom(type))
            {
                IList               newList        = instance as IList;
                Type                newListType    = type.GetGenericArguments()[0];
                IInspectableList    newInspectable = instance as IInspectableList;
                Sleek2InspectorList element2       = new Sleek2InspectorList(this, parent, newList, newListType, newInspectable);
                panel.addElement(element2);
            }
            foreach (FieldInfo fieldInfo in type.GetFields(BindingFlags.Instance | BindingFlags.Public))
            {
                object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(InspectableAttribute), false);
                if (customAttributes.Length > 0)
                {
                    InspectableAttribute inspectableAttribute = customAttributes[0] as InspectableAttribute;
                    Sleek2TypeInspector  sleek2TypeInspector  = TypeInspectorRegistry.inspect(fieldInfo.FieldType);
                    if (sleek2TypeInspector != null)
                    {
                        sleek2TypeInspector.inspect(new ObjectInspectableField(parent, fieldInfo, this.instance as IDirtyable, instance, inspectableAttribute.name, inspectableAttribute.tooltip));
                        panel.addElement(sleek2TypeInspector);
                    }
                    else
                    {
                        Sleek2InspectorFoldout sleek2InspectorFoldout = new Sleek2InspectorFoldout();
                        sleek2InspectorFoldout.transform.anchorMin = new Vector2(0f, 1f);
                        sleek2InspectorFoldout.transform.anchorMax = new Vector2(1f, 1f);
                        sleek2InspectorFoldout.transform.pivot     = new Vector2(0.5f, 1f);
                        sleek2InspectorFoldout.transform.sizeDelta = new Vector2(0f, (float)Sleek2Config.bodyHeight);
                        sleek2InspectorFoldout.label.translation   = new TranslatedText(inspectableAttribute.name);
                        sleek2InspectorFoldout.label.translation.format();
                        sleek2InspectorFoldout.label.tooltip = new TranslatedText(inspectableAttribute.tooltip);
                        sleek2InspectorFoldout.label.tooltip.format();
                        panel.addElement(sleek2InspectorFoldout);
                        this.reflect(new ObjectInspectableField(parent, fieldInfo, this.instance as IDirtyable, instance, TranslationReference.invalid, TranslationReference.invalid), fieldInfo.GetValue(instance), sleek2InspectorFoldout.contents);
                        if (this.collapseFoldoutsByDefault)
                        {
                            sleek2InspectorFoldout.isOpen = false;
                        }
                    }
                }
            }
            foreach (PropertyInfo propertyInfo in type.GetProperties(BindingFlags.Instance | BindingFlags.Public))
            {
                object[] customAttributes2 = propertyInfo.GetCustomAttributes(typeof(InspectableAttribute), false);
                if (customAttributes2.Length > 0)
                {
                    InspectableAttribute inspectableAttribute2 = customAttributes2[0] as InspectableAttribute;
                    Sleek2TypeInspector  sleek2TypeInspector2  = TypeInspectorRegistry.inspect(propertyInfo.PropertyType);
                    if (sleek2TypeInspector2 != null)
                    {
                        sleek2TypeInspector2.inspect(new ObjectInspectableProperty(parent, propertyInfo, this.instance as IDirtyable, instance, inspectableAttribute2.name, inspectableAttribute2.tooltip));
                        panel.addElement(sleek2TypeInspector2);
                    }
                    else
                    {
                        Sleek2InspectorFoldout sleek2InspectorFoldout2 = new Sleek2InspectorFoldout();
                        sleek2InspectorFoldout2.transform.anchorMin = new Vector2(0f, 1f);
                        sleek2InspectorFoldout2.transform.anchorMax = new Vector2(1f, 1f);
                        sleek2InspectorFoldout2.transform.pivot     = new Vector2(0.5f, 1f);
                        sleek2InspectorFoldout2.transform.sizeDelta = new Vector2(0f, (float)Sleek2Config.bodyHeight);
                        sleek2InspectorFoldout2.label.translation   = new TranslatedText(inspectableAttribute2.name);
                        sleek2InspectorFoldout2.label.translation.format();
                        sleek2InspectorFoldout2.label.tooltip = new TranslatedText(inspectableAttribute2.tooltip);
                        sleek2InspectorFoldout2.label.tooltip.format();
                        panel.addElement(sleek2InspectorFoldout2);
                        this.reflect(new ObjectInspectableProperty(parent, propertyInfo, this.instance as IDirtyable, instance, TranslationReference.invalid, TranslationReference.invalid), propertyInfo.GetValue(instance, null), sleek2InspectorFoldout2.contents);
                        if (this.collapseFoldoutsByDefault)
                        {
                            sleek2InspectorFoldout2.isOpen = false;
                        }
                    }
                }
            }
        }
 public ObjectInspectableList(ObjectInspectableInfo newParent, IDirtyable newDirtyable, IList newList, Type newType, int newIndex, TranslationReference newName, TranslationReference newTooltip) : base(newParent, newDirtyable, newList, newType, newName, newTooltip)
 {
     this.list  = newList;
     this.index = newIndex;
 }
Esempio n. 8
0
 public ObjectInspectableField(ObjectInspectableInfo newParent, FieldInfo newField, IDirtyable newDirtyable, object newInstance, TranslationReference newName, TranslationReference newTooltip) : base(newParent, newDirtyable, newInstance, newField.FieldType, newName, newTooltip)
 {
     this.field = newField;
 }
 public ObjectInspectableArray(ObjectInspectableInfo newParent, IDirtyable newDirtyable, Array newArray, Type newType, int newIndex, TranslationReference newName, TranslationReference newTooltip) : base(newParent, newDirtyable, newArray, newType, newName, newTooltip)
 {
     this.array = newArray;
     this.index = newIndex;
 }