UILayoutData.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using UnityEngine;
  3. namespace AdaptUI
  4. {
  5. [Serializable]
  6. public class UILayoutData
  7. {
  8. public int paddingLeft;
  9. public int paddingRight;
  10. public int paddingTop;
  11. public int paddingBottom;
  12. public float spacing;
  13. public TextAnchor childAlignment;
  14. public bool reverseArrangement;
  15. public bool controlChildWidth;
  16. public bool controlChildHeight;
  17. public bool useChildScaleWidth;
  18. public bool useChildScaleHeight;
  19. public bool childForceExpandWidth;
  20. public bool childForceExpandHeight;
  21. // ✅ 默认构造函数(必须)
  22. public UILayoutData() { }
  23. // ✅ 解决编译错误,添加拷贝构造函数
  24. public UILayoutData(UILayoutData layout)
  25. {
  26. this.paddingLeft = layout.paddingLeft;
  27. this.paddingRight = layout.paddingRight;
  28. this.paddingTop = layout.paddingTop;
  29. this.paddingBottom = layout.paddingBottom;
  30. this.spacing = layout.spacing;
  31. this.childAlignment = layout.childAlignment;
  32. this.reverseArrangement = layout.reverseArrangement;
  33. this.controlChildWidth = layout.controlChildWidth;
  34. this.controlChildHeight = layout.controlChildHeight;
  35. this.useChildScaleWidth = layout.useChildScaleWidth;
  36. this.useChildScaleHeight = layout.useChildScaleHeight;
  37. this.childForceExpandWidth = layout.childForceExpandWidth;
  38. this.childForceExpandHeight = layout.childForceExpandHeight;
  39. }
  40. }
  41. }