LayoutGroup3D.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace AutoLayout3D
  5. {
  6. [System.Serializable]
  7. public struct Padding
  8. {
  9. public Vector3 lower;
  10. public Vector3 upper;
  11. }
  12. public enum Direction
  13. {
  14. LowerToUpper, UpperToLower
  15. }
  16. public enum AxisOrder
  17. {
  18. XYZ, XZY, YXZ, YZX, ZXY, ZYX
  19. }
  20. public enum AxisAlignment
  21. {
  22. Upper, Middle, Lower
  23. }
  24. [System.Serializable]
  25. public struct Bool3
  26. {
  27. public bool x, y, z;
  28. }
  29. public struct Int3
  30. {
  31. public int x, y, z;
  32. }
  33. public enum ConstraintType
  34. {
  35. Flexible, FixedCellCount
  36. }
  37. [System.Serializable]
  38. public class Constraint
  39. {
  40. public ConstraintType constraintType = ConstraintType.Flexible;
  41. public int constraintCount = 1;
  42. }
  43. public abstract class LayoutGroup3D : LayoutElement3D
  44. {
  45. [Header(" ")] public Padding padding;
  46. protected List<LayoutElement3D> elementList = new List<LayoutElement3D>();
  47. public abstract void UpdateLayout();
  48. #if UNITY_EDITOR
  49. //update layout every frame only in editor
  50. private void Update()
  51. {
  52. //if (!Application.isPlaying) //update layout every frame only in edit mode
  53. UpdateLayout();
  54. }
  55. #endif
  56. }
  57. }