Esempio n. 1
0
 // Token: 0x060011B7 RID: 4535 RVA: 0x00072F91 File Offset: 0x00071391
 protected virtual void handleListChanged(IInspectableList list)
 {
     this.refresh();
 }
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 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;
                        }
                    }
                }
            }
        }
Esempio n. 4
0
 protected virtual void handleSecondarySkinsInspectorChanged(IInspectableList list)
 {
     this.triggerChanged();
 }
Esempio n. 5
0
        protected virtual void handleSecondarySkinsInspectorRemoved(IInspectableList list, object instance)
        {
            SecondarySkinInfo secondarySkinInfo = instance as SecondarySkinInfo;

            secondarySkinInfo.changed -= this.handleSkinInfoChanged;
        }
Esempio n. 6
0
 protected virtual void handleMaterialsInspectorChanged(IInspectableList list)
 {
     this.updatePrototypes();
 }