TableColumn.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #if UNITY_2019_4_OR_NEWER
  2. using System;
  3. using System.Collections.Generic;
  4. using UnityEditor;
  5. using UnityEngine;
  6. using UnityEditor.UIElements;
  7. using UnityEngine.UIElements;
  8. namespace YooAsset.Editor
  9. {
  10. public class TableColumn
  11. {
  12. /// <summary>
  13. /// 单元列索引值
  14. /// </summary>
  15. internal int ColumnIndex;
  16. /// <summary>
  17. /// 单元元素集合
  18. /// </summary>
  19. internal List<VisualElement> CellElements = new List<VisualElement>(1000);
  20. /// <summary>
  21. /// UI元素名称
  22. /// </summary>
  23. public string ElementName { private set; get; }
  24. /// <summary>
  25. /// 标题名称
  26. /// </summary>
  27. public string HeaderTitle { private set; get; }
  28. /// <summary>
  29. /// 单元列样式
  30. /// </summary>
  31. public ColumnStyle ColumnStyle { private set; get; }
  32. /// <summary>
  33. /// 制作单元格元素
  34. /// </summary>
  35. public Func<VisualElement> MakeCell;
  36. /// <summary>
  37. /// 绑定数据到单元格
  38. /// </summary>
  39. public Action<VisualElement, ITableData, ITableCell> BindCell;
  40. public TableColumn(string elementName, string headerTitle, ColumnStyle columnStyle)
  41. {
  42. this.ElementName = elementName;
  43. this.HeaderTitle = headerTitle;
  44. this.ColumnStyle = columnStyle;
  45. }
  46. }
  47. }
  48. #endif