AMPropertyKey.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. [Serializable]
  6. public class AMPropertyKey : AMKey
  7. {
  8. public bool setValueMegaMorph(List<float> morph)
  9. {
  10. bool flag = false;
  11. if (this.morph == null || this.morph.Count != morph.Count)
  12. {
  13. flag = true;
  14. }
  15. else
  16. {
  17. for (int i = 0; i < morph.Count; i++)
  18. {
  19. if (this.morph[i] != morph[i])
  20. {
  21. flag = true;
  22. break;
  23. }
  24. }
  25. }
  26. if (flag)
  27. {
  28. this.morph = new List<float>(morph);
  29. return true;
  30. }
  31. return false;
  32. }
  33. public bool setValue(float val)
  34. {
  35. if (this.val != (double)val)
  36. {
  37. this.val = (double)val;
  38. return true;
  39. }
  40. return false;
  41. }
  42. public bool setValue(Vector3 vect3)
  43. {
  44. if (this.vect3 != vect3)
  45. {
  46. this.vect3 = vect3;
  47. return true;
  48. }
  49. return false;
  50. }
  51. public bool setValue(Color color)
  52. {
  53. if (this.color != color)
  54. {
  55. this.color = color;
  56. return true;
  57. }
  58. return false;
  59. }
  60. public bool setValue(Rect rect)
  61. {
  62. if (this.rect != rect)
  63. {
  64. this.rect = rect;
  65. return true;
  66. }
  67. return false;
  68. }
  69. public bool setValue(Vector2 vect2)
  70. {
  71. if (this.vect2 != vect2)
  72. {
  73. this.vect2 = vect2;
  74. return true;
  75. }
  76. return false;
  77. }
  78. public bool setValue(double val)
  79. {
  80. if (this.val != val)
  81. {
  82. this.val = val;
  83. return true;
  84. }
  85. return false;
  86. }
  87. public bool setValue(int val)
  88. {
  89. if (this.val != (double)val)
  90. {
  91. this.val = (double)val;
  92. return true;
  93. }
  94. return false;
  95. }
  96. public bool setValue(long val)
  97. {
  98. if (this.val != (double)val)
  99. {
  100. this.val = (double)val;
  101. return true;
  102. }
  103. return false;
  104. }
  105. public override AMKey CreateClone()
  106. {
  107. AMPropertyKey ampropertyKey = ScriptableObject.CreateInstance<AMPropertyKey>();
  108. ampropertyKey.frame = this.frame;
  109. ampropertyKey.val = this.val;
  110. ampropertyKey.vect2 = this.vect2;
  111. ampropertyKey.vect3 = this.vect3;
  112. ampropertyKey.color = this.color;
  113. ampropertyKey.rect = this.rect;
  114. if (this.morph != null)
  115. {
  116. ampropertyKey.morph = new List<float>(this.morph);
  117. }
  118. ampropertyKey.easeType = this.easeType;
  119. ampropertyKey.customEase = new List<float>(this.customEase);
  120. return ampropertyKey;
  121. }
  122. public override void CreateFromStringData(string data_text)
  123. {
  124. string[] array = data_text.Split(new char[]
  125. {
  126. ':'
  127. });
  128. if (array.Length == 0 || array[0] != "Property")
  129. {
  130. return;
  131. }
  132. int num = 1;
  133. this.frame = int.Parse(array[num++]);
  134. this.val = double.Parse(array[num++]);
  135. this.vect2 = Parse.Vector2(array[num++]);
  136. this.vect3 = Parse.Vector3(array[num++]);
  137. this.color = Parse.Color(array[num++]);
  138. this.rect.x = float.Parse(array[num++]);
  139. this.rect.y = float.Parse(array[num++]);
  140. this.rect.width = float.Parse(array[num++]);
  141. this.rect.height = float.Parse(array[num++]);
  142. this.morph = null;
  143. int num2 = int.Parse(array[num++]);
  144. if (0 <= num2)
  145. {
  146. this.morph = new List<float>();
  147. for (int i = 0; i < num2; i++)
  148. {
  149. this.morph.Add(float.Parse(array[num++]));
  150. }
  151. }
  152. this.easeType = int.Parse(array[num++]);
  153. int num3 = int.Parse(array[num++]);
  154. this.customEase = new List<float>();
  155. for (int j = 0; j < num3; j++)
  156. {
  157. this.customEase.Add(float.Parse(array[num++]));
  158. }
  159. }
  160. public override string ToStringData()
  161. {
  162. List<string> list = new List<string>();
  163. list.Add("Property");
  164. list.Add(this.frame.ToString());
  165. list.Add(this.val.ToString());
  166. list.Add(this.vect2.ToString("G"));
  167. list.Add(this.vect3.ToString("G"));
  168. list.Add(this.color.ToString("G"));
  169. list.Add(this.rect.x.ToString());
  170. list.Add(this.rect.y.ToString());
  171. list.Add(this.rect.width.ToString());
  172. list.Add(this.rect.height.ToString());
  173. list.Add(((this.morph != null) ? this.morph.Count : -1).ToString());
  174. if (this.morph != null)
  175. {
  176. foreach (float num in this.morph)
  177. {
  178. list.Add(num.ToString());
  179. }
  180. }
  181. list.Add(this.easeType.ToString());
  182. list.Add(this.customEase.Count.ToString());
  183. foreach (float num2 in this.customEase)
  184. {
  185. list.Add(num2.ToString());
  186. }
  187. string text = list[0];
  188. for (int i = 1; i < list.Count; i++)
  189. {
  190. text = text + ":" + list[i];
  191. }
  192. return text;
  193. }
  194. public double val;
  195. public Vector2 vect2;
  196. public Vector3 vect3;
  197. public Color color;
  198. public Rect rect;
  199. public List<float> morph;
  200. }