No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SpriteShapeEditorGUI.cs 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEditor;
  2. using UnityEngine;
  3. using UnityEditor.Sprites;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. namespace UnityEditor.U2D
  7. {
  8. internal class SpriteShapeEditorGUI
  9. {
  10. private const float kSpacingSubLabel = 2.0f;
  11. private const float kMiniLabelW = 13;
  12. private const int kVerticalSpacingMultiField = 0;
  13. private const float kIndentPerLevel = 15;
  14. public static int s_FoldoutHash = "Foldout".GetHashCode();
  15. public static void MultiDelayedIntField(Rect position, GUIContent[] subLabels, int[] values, float labelWidth)
  16. {
  17. int eCount = values.Length;
  18. float w = (position.width - (eCount - 1) * kSpacingSubLabel) / eCount;
  19. Rect nr = new Rect(position);
  20. nr.width = w;
  21. float t = EditorGUIUtility.labelWidth;
  22. int l = EditorGUI.indentLevel;
  23. EditorGUIUtility.labelWidth = labelWidth;
  24. EditorGUI.indentLevel = 0;
  25. for (int i = 0; i < values.Length; i++)
  26. {
  27. values[i] = EditorGUI.DelayedIntField(nr, subLabels[i], values[i]);
  28. nr.x += w + kSpacingSubLabel;
  29. }
  30. EditorGUIUtility.labelWidth = t;
  31. EditorGUI.indentLevel = l;
  32. }
  33. }
  34. }