DragonBones.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. using System.Collections.Generic;
  2. using System.Diagnostics;
  3. namespace DragonBones
  4. {
  5. /**
  6. * @private
  7. */
  8. public enum ArmatureType
  9. {
  10. None = -1,
  11. Armature = 0,
  12. MovieClip = 1,
  13. Stage = 2
  14. }
  15. /**
  16. * @private
  17. */
  18. public enum DisplayType
  19. {
  20. None = -1,
  21. Image = 0,
  22. Armature = 1,
  23. Mesh = 2,
  24. BoundingBox = 3
  25. }
  26. /**
  27. * @language zh_CN
  28. * 包围盒类型。
  29. * @version DragonBones 5.0
  30. */
  31. public enum BoundingBoxType
  32. {
  33. None = -1,
  34. Rectangle = 0,
  35. Ellipse = 1,
  36. Polygon = 2
  37. }
  38. /**
  39. * @private
  40. */
  41. public enum EventType
  42. {
  43. None = -1,
  44. Frame = 10,
  45. Sound = 11
  46. }
  47. /**
  48. * @private
  49. */
  50. public enum ActionType
  51. {
  52. None = -1,
  53. Play = 0
  54. }
  55. /**
  56. * @private
  57. */
  58. public enum BlendMode
  59. {
  60. None = -1,
  61. Normal = 0,
  62. Add = 1,
  63. Alpha = 2,
  64. Darken = 3,
  65. Difference = 4,
  66. Erase = 5,
  67. HardLight = 6,
  68. Invert = 7,
  69. Layer = 8,
  70. Lighten = 9,
  71. Multiply = 10,
  72. Overlay = 11,
  73. Screen = 12,
  74. Subtract = 13
  75. }
  76. /**
  77. * @language zh_CN
  78. * 动画混合的淡出方式。
  79. * @version DragonBones 4.5
  80. */
  81. public enum AnimationFadeOutMode
  82. {
  83. /**
  84. * @language zh_CN
  85. * 不淡出动画。
  86. * @version DragonBones 4.5
  87. */
  88. None = 0,
  89. /**
  90. * @language zh_CN
  91. * 淡出同层的动画。
  92. * @version DragonBones 4.5
  93. */
  94. SameLayer = 1,
  95. /**
  96. * @language zh_CN
  97. * 淡出同组的动画。
  98. * @version DragonBones 4.5
  99. */
  100. SameGroup = 2,
  101. /**
  102. * @language zh_CN
  103. * 淡出同层并且同组的动画。
  104. * @version DragonBones 4.5
  105. */
  106. SameLayerAndGroup = 3,
  107. /**
  108. * @language zh_CN
  109. * 淡出所有动画。
  110. * @version DragonBones 4.5
  111. */
  112. All = 4
  113. }
  114. public class DragonBones
  115. {
  116. /**
  117. * @private
  118. */
  119. public const float PI = 3.14159265358979323846f;
  120. /**
  121. * @private
  122. */
  123. public const float PI_D = PI * 2.0f;
  124. /**
  125. * @private
  126. */
  127. public const float PI_H = PI / 2.0f;
  128. /**
  129. * @private
  130. */
  131. public const float PI_Q = PI / 4.0f;
  132. /**
  133. * @private
  134. */
  135. public const float ANGLE_TO_RADIAN = PI / 180.0f;
  136. /**
  137. * @private
  138. */
  139. public const float RADIAN_TO_ANGLE = 180.0f / PI;
  140. /**
  141. * @private
  142. */
  143. public const float SECOND_TO_MILLISECOND = 1000.0f;
  144. /**
  145. * @private
  146. */
  147. public const float NO_TWEEN = 100.0f;
  148. public const string VSESION = "5.0.0";
  149. /**
  150. * @private
  151. */
  152. public const string ARGUMENT_ERROR = "Argument error.";
  153. /**
  154. * @private
  155. */
  156. public static void Assert(bool condition, string message)
  157. {
  158. Debug.Assert(condition, message);
  159. }
  160. /**
  161. * @private
  162. */
  163. public static void ResizeList<T>(List<T> list, int count, T value)
  164. {
  165. if (list.Count == count)
  166. {
  167. return;
  168. }
  169. if (list.Count > count)
  170. {
  171. list.RemoveRange(count, list.Count - count);
  172. }
  173. else
  174. {
  175. list.Capacity = count;
  176. for (int i = list.Count, l = count; i < l; ++i)
  177. {
  178. list.Add(value);
  179. }
  180. }
  181. }
  182. }
  183. }