private void OpenContents(Rect position, Rect container) { if ((bool)isOpenMeta.value) { var typeHeight = LudiqGUI.GetInspectorHeight(typeMeta.Inspector(), typeMeta["type"], position.width, GUIContent.none); var valueHeight = LudiqGUI.GetInspectorHeight(typeMeta.Inspector(), typeMeta["value"], position.width, GUIContent.none); var typeLabel = new Rect(container.x + 5, container.y + y + 10, 60, 16); var typeRect = new Rect(container.x + 50, container.y + typeLabel.height + 16, container.width - 60, typeHeight); var defaultRect = new Rect(container.x + 50, typeRect.y + typeRect.height + 4, container.width - 60, typeHeight); var valueRect = new Rect(container.x + 10, typeRect.y + typeRect.height + defaultRect.height + 8, container.width - 20, valueHeight + 8); EditorGUI.LabelField(typeLabel, new GUIContent("Type")); LudiqGUI.Inspector(typeMeta["type"], typeRect, GUIContent.none); var addedHeight = 0; if (!((System.Type)typeMeta["type"].value).InheritsType(typeof(UnityEngine.Object))) { addedHeight += 16; LudiqGUI.Inspector(typeMeta["hasDefault"], defaultRect, new GUIContent("Default")); if ((bool)typeMeta["hasDefault"].value) { UtilityGUI.Container(valueRect, Color.black, 0.7f.Grey(), 1, 4, (valueContainer) => { if (typeMeta["value"].value != null || ((System.Type)typeMeta["type"].value).InheritsType(typeof(UnityEngine.Object))) { LudiqGUI.Inspector(typeMeta["value"], valueContainer, GUIContent.none); if ((System.Type)typeMeta["type"].value == typeof(bool)) { var boolLabel = valueContainer; boolLabel.x += 18; GUI.Label(boolLabel, (nameMeta.value as string).Prettify()); } } }); addedHeight += (int)valueRect.height + 10; } } var optionsRect = Options(typeLabel, typeRect, addedHeight + defaultRect.height); var propertiesRect = optionsRect; propertiesRect.width = typeLabel.width + typeRect.width; propertiesRect.x -= 20; propertiesRect.y += 86; propertiesRect.height = 56; var propertyHeight = propertyMeta.Inspector().GetCachedHeight(lastPosition.width, GUIContent.none, accessor.Inspector()) + addedHeight; var prop = ((Property)propertyMeta.value); var propName = string.Empty; UAliveGUI.NestedSection(propertiesRect, e, "Property", UAliveResources.properties, addedHeight, (propertiesContainer) => { LudiqGUI.Inspector(propertyMeta, new Rect(propertiesContainer.x, propertiesContainer.y, propertiesContainer.width - 40, propertyHeight)); }, isPropertyMeta); addedHeight += 30; y += typeHeight + defaultRect.height + optionsRect.height + propertiesRect.height + addedHeight + 4; } }
protected override void OnGUIBlock(Rect position, GUIContent label) { base.OnGUIBlock(position, label); UAliveResources.CacheTextures(); // Methods and Fields are anonymous within a Dictionary. // In order for them to be aware they are owned by this class, // this class must assign them a reference to itself OnMethodCountChanged(); OnVariableCountChanged(); // We must clear the variable. // This inherits from OnGUIBlock. // Set the height to the Y at the end. // Get Height auto returns that variable. y = 0f; var accessibilityRect = Accessibility(lastPosition); var baseRect = BaseType(position, accessibilityRect); var interfacesRect = UAliveGUI.DrawSection ( baseRect, accessor["interfaces"], accessor, e, "Interfaces", UAliveResources.contract, 52, true, interfaces.Count, accessor["interfacesOpen"] ); var variablesRect = UAliveGUI.DrawSection ( interfacesRect, accessor["variables"], accessor, e, "Variables", UAliveResources.variable, 52, true, variables.Count, accessor["variablesOpen"], isEditor: false, new List <Rect>() { new Rect(interfacesRect.x + interfacesRect.width - 120, interfacesRect.y + interfacesRect.height + 14, 80, 16) } ); VariableOverrideButton(new Rect(variablesRect.x + variablesRect.width - 120, variablesRect.y + 14, 80, 16)); lastPosition.y += variablesRect.height; y += variablesRect.height; ForceAllPrivate(); var methodsOpen = (bool)accessor["methodsOpen"].value; var methodsHeight = methodsOpen ? (int)accessor["methods"].Inspector <MethodsInspector>().GetCachedHeight(position.width, GUIContent.none, accessor.Editor <ObjectMacroInspector>()) : 52; if (methodsOpen && (int)accessor["methods"].Count == 0) { methodsHeight = 35; } var methodsRect = UAliveGUI.DrawSection ( variablesRect, accessor["methods"], accessor, e, "Methods", UAliveResources.method, methodsHeight, true, methods.Count, accessor["methodsOpen"], isEditor: true ); height += variablesRect.height + methodsRect.height + interfacesRect.height + baseRect.height + accessibilityRect.height; }