/// <summary> /// Raises the GUI event. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> /// <param name="label">Label.</param> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Initialize(property); SerializedProperty inputText = property.FindPropertyRelative("m_InputText"); SerializedProperty styles = property.FindPropertyRelative("m_Styles"); SerializedProperty supportRichText = property.FindPropertyRelative("m_IsRichTextDesired"); Rect entirePosition = position; position.height = (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f; EditorGUI.PropertyField(position, inputText); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = EditorGUIUtility.singleLineHeight; EditorGUIX.DisplayScriptableObjectPropertyFieldWithButton <HyperTextStyles>(position, styles); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; HyperTextEditor.DisplayOverridableProperty( position, property.FindPropertyRelative("m_ReferenceFontSize"), property.FindPropertyRelative("m_ShouldOverrideStylesFontSize"), styles ); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; EditorGUIX.DisplayPropertyFieldWithStatus( position, supportRichText, ValidationStatus.Info, new GUIContent("Output Rich Text"), true, "Disable if the destination does not support rendering rich text." ); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; ++EditorGUI.indentLevel; EditorGUIX.DisplayPropertyFieldWithStatus( position, property.FindPropertyRelative("m_IsDynamicFontDesired"), supportRichText.boolValue ? ValidationStatus.Info : ValidationStatus.Warning, new GUIContent("<size> Tags"), true, string.Format( "Disable if the destination uses a non-dynamic font.{0}", supportRichText.boolValue ? "" : "\n\nYou must enable rich text to output <size> tags." ) ); --EditorGUI.indentLevel; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = m_LinkCollections[property.propertyPath].GetHeight(); m_LinkCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_TagCollections[property.propertyPath].GetHeight(); m_TagCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_QuadCollections[property.propertyPath].GetHeight(); m_QuadCollections[property.propertyPath].DoList(position); }
/// <summary> /// Displays a property field with an override property checkbox and status icon if a parent style is found. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property to display.</param> /// <param name="overrideProperty"> /// Property specifying whether the other property is overriding an inherited one. Object reference properties /// are assumed to override if they have a value assigned. /// </param> private void DisplayOverridableProperty( Rect position, SerializedProperty property, SerializedProperty overrideProperty ) { HyperTextEditor.DisplayOverridableProperty( position: position, property: property, overrideProperty: overrideProperty, displayCheckbox: m_ParentStyle != null, inheritTooltip: m_InheritTooltip, overrideTooltip: m_OverrideTooltip ); }
/// <summary> /// Raises the GUI event. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> /// <param name="label">Label.</param> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { Initialize(property); SerializedProperty inputText = property.FindPropertyRelative("m_InputText"); SerializedProperty styles = property.FindPropertyRelative("m_Styles"); SerializedProperty supportRichText = property.FindPropertyRelative("m_IsRichTextDesired"); Rect entirePosition = position; position.height = (EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing) * 2f; EditorGUI.PropertyField(position, inputText); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = EditorGUIUtility.singleLineHeight; EditorGUIX.DisplayScriptableObjectPropertyFieldWithButton <HyperTextStyles>(position, styles); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; HyperTextEditor.DisplayOverridableProperty( position, property.FindPropertyRelative("m_ReferenceFontSize"), property.FindPropertyRelative("m_ShouldOverrideStylesFontSize"), styles ); position.x = entirePosition.x; position.width = entirePosition.width; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(position, supportRichText, s_RichTextLabel); position.y += position.height + EditorGUIUtility.standardVerticalSpacing; ++EditorGUI.indentLevel; EditorGUI.BeginDisabledGroup(!supportRichText.boolValue); { EditorGUI.PropertyField( position, property.FindPropertyRelative("m_IsDynamicFontDesired"), s_DynamicFontLabel ); } EditorGUI.EndDisabledGroup(); --EditorGUI.indentLevel; position.y += position.height + EditorGUIUtility.standardVerticalSpacing; position.height = m_LinkCollections[property.propertyPath].GetHeight(); m_LinkCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_TagCollections[property.propertyPath].GetHeight(); m_TagCollections[property.propertyPath].DoList(position); position.y += position.height; position.height = m_QuadCollections[property.propertyPath].GetHeight(); m_QuadCollections[property.propertyPath].DoList(position); }