暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

WindowEvents.cs 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. using UnityEngine.U2D.Animation;
  6. namespace UnityEditor.U2D.Animation.SpriteLibraryEditor
  7. {
  8. /// <summary>
  9. /// Events triggerred from the controller class to notify different UI elements about changes.
  10. /// </summary>
  11. internal class ControllerEvents
  12. {
  13. /// <summary>
  14. /// Category list changed. Boolean is true when the provided list is filtered.
  15. /// </summary>
  16. public UnityEvent<List<CategoryData>, bool> onModifiedCategories { get; } = new();
  17. /// <summary>
  18. /// Label list changed. Boolean is true when the provided list is filtered.
  19. /// </summary>
  20. public UnityEvent<List<LabelData>, bool> onModifiedLabels { get; } = new();
  21. /// <summary>
  22. /// New Sprite Library Asset has been selected in the Project folder.
  23. /// </summary>
  24. public UnityEvent<SpriteLibraryAsset> onSelectedLibrary { get; } = new();
  25. /// <summary>
  26. /// List of selected category names.
  27. /// </summary>
  28. public UnityEvent<List<string>> onSelectedCategories { get; } = new();
  29. /// <summary>
  30. /// List of selected label names.
  31. /// </summary>
  32. public UnityEvent<List<string>> onSelectedLabels { get; } = new();
  33. /// <summary>
  34. /// View parameters have changed.
  35. /// </summary>
  36. public UnityEvent<ViewData> onViewChanged { get; } = new();
  37. /// <summary>
  38. /// Main Library is set.
  39. /// </summary>
  40. public UnityEvent<SpriteLibraryAsset> onMainLibraryChanged { get; } = new();
  41. /// <summary>
  42. /// Library data has been modified.
  43. /// </summary>
  44. public UnityEvent<bool> onLibraryDataChanged { get; } = new();
  45. }
  46. /// <summary>
  47. /// Events that notify controller of changes in the UI.
  48. /// </summary>
  49. internal class ViewEvents
  50. {
  51. /// <summary>
  52. /// Triggerred to create a new Sprite Library Asset at given location.
  53. /// </summary>
  54. public UnityEvent<string> onCreateNewSpriteLibraryAsset { get; } = new();
  55. /// <summary>
  56. /// Main UI Split Pane View size changed.
  57. /// </summary>
  58. public UnityEvent<float> onMainUISplitPaneSizeChanged { get; } = new();
  59. /// <summary>
  60. /// On triggerred Save action.
  61. /// </summary>
  62. public UnityEvent onSave { get; } = new();
  63. /// <summary>
  64. /// On triggerred Revert action.
  65. /// </summary>
  66. public UnityEvent onRevert { get; } = new();
  67. /// <summary>
  68. /// Auto-save has changed.
  69. /// </summary>
  70. public UnityEvent<bool> onToggleAutoSave { get; } = new();
  71. /// <summary>
  72. /// View size slider value changed.
  73. /// </summary>
  74. public UnityEvent<float> onViewSizeUpdate { get; } = new();
  75. /// <summary>
  76. /// View type changed.
  77. /// </summary>
  78. public UnityEvent<ViewType> onViewTypeUpdate { get; } = new();
  79. /// <summary>
  80. /// Triggerred on filter string changed.
  81. /// </summary>
  82. public UnityEvent<string> onSelectedFilter { get; } = new();
  83. /// <summary>
  84. /// Triggerred on selected filter type.
  85. /// </summary>
  86. public UnityEvent<SearchType> onSelectedFilterType { get; } = new();
  87. /// <summary>
  88. /// Triggerred when Main Library Asset is set.
  89. /// </summary>
  90. public UnityEvent<SpriteLibraryAsset> onSetMainAsset { get; } = new();
  91. /// <summary>
  92. /// Triggerred on new Categories selected.
  93. /// </summary>
  94. public UnityEvent<IList<string>> onSelectCategories { get; } = new();
  95. /// <summary>
  96. /// Triggerred on new Labels selected.
  97. /// </summary>
  98. public UnityEvent<IList<string>> onSelectLabels { get; } = new();
  99. /// <summary>
  100. /// Create new Category.
  101. /// </summary>
  102. public UnityEvent<string, IList<Sprite>> onCreateNewCategory { get; } = new();
  103. /// <summary>
  104. /// Rename selected Category.
  105. /// </summary>
  106. public UnityEvent<string> onRenameCategory { get; } = new();
  107. /// <summary>
  108. /// Triggerred when Categories are reordered in the list.
  109. /// </summary>
  110. public UnityEvent<IList<string>> onReorderCategories { get; } = new();
  111. /// <summary>
  112. /// Triggerred when selected categories are to be deleted.
  113. /// </summary>
  114. public UnityEvent onDeleteCategories { get; } = new();
  115. /// <summary>
  116. /// Create a new Label.
  117. /// </summary>
  118. public UnityEvent<string> onCreateNewLabel { get; } = new();
  119. /// <summary>
  120. /// Rename selected Label.
  121. /// </summary>
  122. public UnityEvent<string> onRenameLabel { get; } = new();
  123. /// <summary>
  124. /// Triggerred when Labels are reordered in the list.
  125. /// </summary>
  126. public UnityEvent<IList<string>> onReorderLabels { get; } = new();
  127. /// <summary>
  128. /// Delete selected Labels.
  129. /// </summary>
  130. public UnityEvent onDeleteLabels { get; } = new();
  131. /// <summary>
  132. /// Set Label's Sprite.
  133. /// </summary>
  134. public UnityEvent<string, Sprite> onSetLabelSprite { get; } = new();
  135. /// <summary>
  136. /// Add data to Categories. Triggerred when data is dragged and dropped into Categories.
  137. /// </summary>
  138. public UnityEvent<IList<DragAndDropData>, bool, string> onAddDataToCategories { get; } = new();
  139. /// <summary>
  140. /// Add data to Labels. Triggerred when data is dragged and dropped into labels.
  141. /// </summary>
  142. public UnityEvent<IList<DragAndDropData>, bool, string> onAddDataToLabels { get; } = new();
  143. /// <summary>
  144. /// Revert Labels in the collection.
  145. /// </summary>
  146. public UnityEvent<IList<string>> onRevertOverridenLabels { get; } = new();
  147. /// <summary>
  148. /// Selection lock value changed.
  149. /// </summary>
  150. public UnityEvent<bool> onToggleSelectionLock = new();
  151. }
  152. }