AMTranslationKey.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. [Serializable]
  6. public class AMTranslationKey : AMKey
  7. {
  8. public bool setInterpolation(int _interp)
  9. {
  10. if (_interp != this.interp)
  11. {
  12. this.interp = _interp;
  13. return true;
  14. }
  15. return false;
  16. }
  17. public bool setPosition(Vector3 position)
  18. {
  19. if (position != this.position)
  20. {
  21. this.position = position;
  22. return true;
  23. }
  24. return false;
  25. }
  26. public override AMKey CreateClone()
  27. {
  28. AMTranslationKey amtranslationKey = ScriptableObject.CreateInstance<AMTranslationKey>();
  29. amtranslationKey.frame = this.frame;
  30. amtranslationKey.position = this.position;
  31. amtranslationKey.interp = this.interp;
  32. amtranslationKey.easeType = this.easeType;
  33. amtranslationKey.customEase = new List<float>(this.customEase);
  34. return amtranslationKey;
  35. }
  36. public override void CreateFromStringData(string data_text)
  37. {
  38. string[] array = data_text.Split(new char[]
  39. {
  40. ':'
  41. });
  42. if (array.Length == 0 || array[0] != "Translation")
  43. {
  44. return;
  45. }
  46. int num = 1;
  47. this.frame = int.Parse(array[num++]);
  48. this.position = Parse.Vector3(array[num++]);
  49. this.interp = int.Parse(array[num++]);
  50. this.easeType = int.Parse(array[num++]);
  51. int num2 = int.Parse(array[num++]);
  52. this.customEase = new List<float>();
  53. for (int i = 0; i < num2; i++)
  54. {
  55. this.customEase.Add(float.Parse(array[num++]));
  56. }
  57. }
  58. public override string ToStringData()
  59. {
  60. List<string> list = new List<string>();
  61. list.Add("Translation");
  62. list.Add(this.frame.ToString());
  63. list.Add(this.position.ToString("G"));
  64. list.Add(this.interp.ToString());
  65. list.Add(this.easeType.ToString());
  66. list.Add(this.customEase.Count.ToString());
  67. foreach (float num in this.customEase)
  68. {
  69. list.Add(num.ToString());
  70. }
  71. string text = list[0];
  72. for (int i = 1; i < list.Count; i++)
  73. {
  74. text = text + ":" + list[i];
  75. }
  76. return text;
  77. }
  78. public static string[] InterpolationNames = new string[]
  79. {
  80. "Curve",
  81. "Linear"
  82. };
  83. public Vector3 position;
  84. public int interp;
  85. public enum Interpolation
  86. {
  87. Curve,
  88. Linear
  89. }
  90. }