private static SetHorizontalAlignment ( SerializedProperty alignment, HorizontalTextAligment horizontalAlignment ) : void | ||
alignment | SerializedProperty | |
horizontalAlignment | HorizontalTextAligment | |
리턴 | void |
private static void DoHorizontalAligmentControl(Rect position, SerializedProperty alignment) { TextAnchor intValue = (TextAnchor)alignment.intValue; FontDataDrawer.HorizontalTextAligment horizontalAlignment = FontDataDrawer.GetHorizontalAlignment(intValue); bool flag = horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Left; bool flag2 = horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Center; bool flag3 = horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Right; 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; horizontalAlignment = FontDataDrawer.GetHorizontalAlignment(text.alignment); flag = (flag || horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Left); flag2 = (flag2 || horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Center); flag3 = (flag3 || horizontalAlignment == FontDataDrawer.HorizontalTextAligment.Right); } } position.width = 20f; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag, (!flag) ? FontDataDrawer.Styles.m_LeftAlignText : FontDataDrawer.Styles.m_LeftAlignTextActive, FontDataDrawer.Styles.alignmentButtonLeft); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Left); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag2, (!flag2) ? FontDataDrawer.Styles.m_CenterAlignText : FontDataDrawer.Styles.m_CenterAlignTextActive, FontDataDrawer.Styles.alignmentButtonMid); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Center); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag3, (!flag3) ? FontDataDrawer.Styles.m_RightAlignText : FontDataDrawer.Styles.m_RightAlignTextActive, FontDataDrawer.Styles.alignmentButtonRight); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Right); } }
private static void DoHorizontalAligmentControl(Rect position, SerializedProperty alignment) { FontDataDrawer.HorizontalTextAligment horizontalAlignment1 = FontDataDrawer.GetHorizontalAlignment((TextAnchor)alignment.intValue); bool flag1 = horizontalAlignment1 == FontDataDrawer.HorizontalTextAligment.Left; bool flag2 = horizontalAlignment1 == FontDataDrawer.HorizontalTextAligment.Center; bool flag3 = horizontalAlignment1 == FontDataDrawer.HorizontalTextAligment.Right; if (alignment.hasMultipleDifferentValues) { foreach (Object targetObject in alignment.serializedObject.targetObjects) { FontDataDrawer.HorizontalTextAligment horizontalAlignment2 = FontDataDrawer.GetHorizontalAlignment((targetObject as Text).alignment); flag1 = flag1 || horizontalAlignment2 == FontDataDrawer.HorizontalTextAligment.Left; flag2 = flag2 || horizontalAlignment2 == FontDataDrawer.HorizontalTextAligment.Center; flag3 = flag3 || horizontalAlignment2 == FontDataDrawer.HorizontalTextAligment.Right; } } position.width = 20f; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag1, !flag1 ? FontDataDrawer.Styles.m_LeftAlignText : FontDataDrawer.Styles.m_LeftAlignTextActive, FontDataDrawer.Styles.alignmentButtonLeft); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Left); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag2, !flag2 ? FontDataDrawer.Styles.m_CenterAlignText : FontDataDrawer.Styles.m_CenterAlignTextActive, FontDataDrawer.Styles.alignmentButtonMid); if (EditorGUI.EndChangeCheck()) { FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Center); } position.x += position.width; EditorGUI.BeginChangeCheck(); FontDataDrawer.EditorToggle(position, flag3, !flag3 ? FontDataDrawer.Styles.m_RightAlignText : FontDataDrawer.Styles.m_RightAlignTextActive, FontDataDrawer.Styles.alignmentButtonRight); if (!EditorGUI.EndChangeCheck()) { return; } FontDataDrawer.SetHorizontalAlignment(alignment, FontDataDrawer.HorizontalTextAligment.Right); }