static TypeInspectorRegistry() { TypeInspectorRegistry.add(typeof(bool), typeof(Sleek2BoolInspector)); TypeInspectorRegistry.add(typeof(byte), typeof(Sleek2ByteInspector)); TypeInspectorRegistry.add(typeof(double), typeof(Sleek2DoubleInspector)); TypeInspectorRegistry.add(typeof(float), typeof(Sleek2FloatInspector)); TypeInspectorRegistry.add(typeof(Guid), typeof(Sleek2GUIDInspector)); TypeInspectorRegistry.add(typeof(int), typeof(Sleek2IntInspector)); TypeInspectorRegistry.add(typeof(long), typeof(Sleek2LongInspector)); TypeInspectorRegistry.add(typeof(sbyte), typeof(Sleek2SByteInspector)); TypeInspectorRegistry.add(typeof(short), typeof(Sleek2ShortInspector)); TypeInspectorRegistry.add(typeof(string), typeof(Sleek2StringInspector)); TypeInspectorRegistry.add(typeof(uint), typeof(Sleek2UIntInspector)); TypeInspectorRegistry.add(typeof(ulong), typeof(Sleek2ULongInspector)); TypeInspectorRegistry.add(typeof(ushort), typeof(Sleek2UShortInspector)); TypeInspectorRegistry.add(typeof(Color), typeof(Sleek2ColorInspector)); TypeInspectorRegistry.add(typeof(Quaternion), typeof(Sleek2QuaternionInspector)); TypeInspectorRegistry.add(typeof(Vector3), typeof(Sleek2Vector3Inspector)); TypeInspectorRegistry.add(typeof(Vector4), typeof(Sleek2Vector4Inspector)); TypeInspectorRegistry.add(typeof(AssetReference <>), typeof(Sleek2AssetReferenceInspector <>)); TypeInspectorRegistry.add(typeof(ContentReference <>), typeof(Sleek2ContentReferenceInspector <>)); TypeInspectorRegistry.add(typeof(InspectableFilePath), typeof(Sleek2FilePathInspector)); TypeInspectorRegistry.add(typeof(InspectableDirectoryPath), typeof(Sleek2DirectoryPathInspector)); TypeInspectorRegistry.add(typeof(TranslationReference), typeof(Sleek2TranslationReferenceInspector)); TypeInspectorRegistry.add(typeof(TypeReference <>), typeof(Sleek2TypeReferenceInspector <>)); }
protected virtual void refresh() { this.panel.clearElements(); for (int i = 0; i < this.array.Length; i++) { Type type = this.array.GetValue(i).GetType(); Sleek2TypeInspector sleek2TypeInspector = TypeInspectorRegistry.inspect(type); if (sleek2TypeInspector != null) { sleek2TypeInspector.inspect(new ObjectInspectableArray(this.parentInfo, this.rootInspector.instance as IDirtyable, this.array, this.arrayType, i, new TranslationReference("#SDG::Array_" + i), TranslationReference.invalid)); this.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 TranslatedTextFallback('[' + i.ToString() + ']'); sleek2InspectorFoldout.label.translation.format(); this.panel.addElement(sleek2InspectorFoldout); this.rootInspector.reflect(new ObjectInspectableArray(this.parentInfo, this.rootInspector.instance as IDirtyable, this.array, this.arrayType, i, new TranslationReference("#SDG::Array_" + i), TranslationReference.invalid), this.array.GetValue(i), sleek2InspectorFoldout.contents); } } }
// Token: 0x060011B4 RID: 4532 RVA: 0x00072C74 File Offset: 0x00071074 protected virtual void refresh() { this.panel.clearElements(); for (int i = 0; i < this.list.Count; i++) { Type type = this.list[i].GetType(); Sleek2TypeInspector sleek2TypeInspector = TypeInspectorRegistry.inspect(type); if (sleek2TypeInspector != null) { sleek2TypeInspector.inspect(new ObjectInspectableList(this.parentInfo, this.rootInspector.instance as IDirtyable, this.list, this.listType, i, new TranslationReference("#SDG::List_" + i), TranslationReference.invalid)); this.panel.addElement(sleek2TypeInspector); } else { object obj = this.list[i]; Sleek2InspectorFoldoutList sleek2InspectorFoldoutList = new Sleek2InspectorFoldoutList(i); sleek2InspectorFoldoutList.transform.anchorMin = new Vector2(0f, 1f); sleek2InspectorFoldoutList.transform.anchorMax = new Vector2(1f, 1f); sleek2InspectorFoldoutList.transform.pivot = new Vector2(0.5f, 1f); sleek2InspectorFoldoutList.transform.sizeDelta = new Vector2(0f, (float)Sleek2Config.bodyHeight); if (obj is IInspectableListElement) { sleek2InspectorFoldoutList.name = ((IInspectableListElement)obj).inspectableListIndexInternalName; sleek2InspectorFoldoutList.label.translation = new TranslatedText(((IInspectableListElement)obj).inspectableListIndexDisplayName); } else { sleek2InspectorFoldoutList.label.translation = new TranslatedTextFallback('[' + i.ToString() + ']'); } sleek2InspectorFoldoutList.label.translation.format(); sleek2InspectorFoldoutList.removeButton.clicked += this.handleRemoveButtonClicked; this.panel.addElement(sleek2InspectorFoldoutList); this.rootInspector.reflect(new ObjectInspectableList(this.parentInfo, this.rootInspector.instance as IDirtyable, this.list, this.listType, i, new TranslationReference("#SDG::List_" + i), TranslationReference.invalid), obj, sleek2InspectorFoldoutList.contents); if (this.collapseFoldoutsByDefault) { sleek2InspectorFoldoutList.isOpen = false; } } } }
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; } } } } }