/// <summary> /// Displays the vertical aligment control. /// </summary> /// <param name="position">Position.</param> /// <param name="property">Property.</param> private void DisplayVerticalAligmentControl(Rect position, SerializedProperty property) { TextAnchor intValue = (TextAnchor)property.intValue; VerticalTextAligment verticalAlignment = intValue.GetVerticalAlignment(); bool flag = verticalAlignment == VerticalTextAligment.Top; bool flag2 = verticalAlignment == VerticalTextAligment.Middle; bool flag3 = verticalAlignment == VerticalTextAligment.Bottom; if (property.hasMultipleDifferentValues) { Object[] targetObjects = property.serializedObject.targetObjects; for (int i = 0; i < targetObjects.Length; i++) { Object obj = targetObjects [i]; TextAnchor alignment2 = (TextAnchor) new SerializedObject(obj).FindProperty(property.propertyPath).enumValueIndex; verticalAlignment = alignment2.GetVerticalAlignment(); flag = flag || verticalAlignment == VerticalTextAligment.Top; flag2 = flag2 || verticalAlignment == VerticalTextAligment.Middle; flag3 = flag3 || verticalAlignment == VerticalTextAligment.Bottom; } } position.width = 20f; EditorGUI.BeginChangeCheck(); EditorToggle( position, !flag ? s_Styles.GetStaticFieldValue <GUIContent>("m_TopAlignText") : s_Styles.GetStaticFieldValue <GUIContent>("m_TopAlignTextActive"), flag, s_Styles.GetStaticFieldValue <GUIStyle>("alignmentButtonLeft") ); if (EditorGUI.EndChangeCheck()) { this.SetVerticalAlignment(property, VerticalTextAligment.Top); } position.x += position.width; EditorGUI.BeginChangeCheck(); EditorToggle( position, !flag2 ? s_Styles.GetStaticFieldValue <GUIContent>("m_MiddleAlignText") : s_Styles.GetStaticFieldValue <GUIContent>("m_MiddleAlignTextActive"), flag2, s_Styles.GetStaticFieldValue <GUIStyle>("alignmentButtonMid") ); if (EditorGUI.EndChangeCheck()) { SetVerticalAlignment(property, VerticalTextAligment.Middle); } position.x += position.width; EditorGUI.BeginChangeCheck(); EditorToggle( position, !flag3 ? s_Styles.GetStaticFieldValue <GUIContent>("m_BottomAlignText") : s_Styles.GetStaticFieldValue <GUIContent>("m_BottomAlignTextActive"), flag3, s_Styles.GetStaticFieldValue <GUIStyle>("alignmentButtonRight") ); if (EditorGUI.EndChangeCheck()) { SetVerticalAlignment(property, VerticalTextAligment.Bottom); } }