private static SetVerticalAlignment ( SerializedProperty alignment, VerticalTextAligment verticalAlignment ) : void | ||
alignment | SerializedProperty | |
verticalAlignment | VerticalTextAligment | |
Résultat | void |
private static void DoVerticalAligmentControl(Rect position, SerializedProperty alignment) { TextAnchor intValue = (TextAnchor)alignment.intValue; FontDataDrawer.VerticalTextAligment verticalAlignment = FontDataDrawer.GetVerticalAlignment(intValue); bool flag = verticalAlignment == FontDataDrawer.VerticalTextAligment.Top; bool flag2 = verticalAlignment == FontDataDrawer.VerticalTextAligment.Middle; bool flag3 = verticalAlignment == FontDataDrawer.VerticalTextAligment.Bottom; if (alignment.hasMultipleDifferentValues) { UnityEngine.Object[] targetObjects = alignment.serializedObject.targetObjects; for (int i = 0; i < targetObjects.Length; i++) { UnityEngine.Object @object = targetObjects[i]; Text text = @object as Text; TextAnchor alignment2 = text.alignment; verticalAlignment = FontDataDrawer.GetVerticalAlignment(alignment2); flag = (flag || verticalAlignment == FontDataDrawer.VerticalTextAligment.Top); flag2 = (flag2 || verticalAlignment == FontDataDrawer.VerticalTextAligment.Middle); flag3 = (flag3 || verticalAlignment == FontDataDrawer.VerticalTextAligment.Bottom); } } position.width = 20f; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag, (!flag) ? FontDataDrawer.Styles.m_TopAlignText : FontDataDrawer.Styles.m_TopAlignTextActive, FontDataDrawer.Styles.alignmentButtonLeft); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Top); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag2, (!flag2) ? FontDataDrawer.Styles.m_MiddleAlignText : FontDataDrawer.Styles.m_MiddleAlignTextActive, FontDataDrawer.Styles.alignmentButtonMid); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Middle); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag3, (!flag3) ? FontDataDrawer.Styles.m_BottomAlignText : FontDataDrawer.Styles.m_BottomAlignTextActive, FontDataDrawer.Styles.alignmentButtonRight); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Bottom); } }
private static void DoVerticalAligmentControl(Rect position, SerializedProperty alignment) { FontDataDrawer.VerticalTextAligment verticalAlignment1 = FontDataDrawer.GetVerticalAlignment((TextAnchor)alignment.intValue); bool flag1 = verticalAlignment1 == FontDataDrawer.VerticalTextAligment.Top; bool flag2 = verticalAlignment1 == FontDataDrawer.VerticalTextAligment.Middle; bool flag3 = verticalAlignment1 == FontDataDrawer.VerticalTextAligment.Bottom; if (alignment.hasMultipleDifferentValues) { foreach (Object targetObject in alignment.serializedObject.targetObjects) { FontDataDrawer.VerticalTextAligment verticalAlignment2 = FontDataDrawer.GetVerticalAlignment((targetObject as Text).alignment); flag1 = flag1 || verticalAlignment2 == FontDataDrawer.VerticalTextAligment.Top; flag2 = flag2 || verticalAlignment2 == FontDataDrawer.VerticalTextAligment.Middle; flag3 = flag3 || verticalAlignment2 == FontDataDrawer.VerticalTextAligment.Bottom; } } position.width = 20f; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag1, !flag1 ? FontDataDrawer.Styles.m_TopAlignText : FontDataDrawer.Styles.m_TopAlignTextActive, FontDataDrawer.Styles.alignmentButtonLeft); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Top); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag2, !flag2 ? FontDataDrawer.Styles.m_MiddleAlignText : FontDataDrawer.Styles.m_MiddleAlignTextActive, FontDataDrawer.Styles.alignmentButtonMid); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Middle); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag3, !flag3 ? FontDataDrawer.Styles.m_BottomAlignText : FontDataDrawer.Styles.m_BottomAlignTextActive, FontDataDrawer.Styles.alignmentButtonRight); if (!EditorGUI.EndChangeCheck()) { return; } FontDataDrawer.SetVerticalAlignment(alignment, FontDataDrawer.VerticalTextAligment.Bottom); }