TestItween.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using UnityEngine;
  2. using System.Collections;
  3. public class TestItween : MonoBehaviour
  4. {
  5. /// <summary>
  6. /// Use this for initialization
  7. /// </summary>
  8. void Start()
  9. {
  10. }
  11. /// <summary>
  12. ///
  13. /// </summary>
  14. private void TestItweenMove()
  15. {
  16. Hashtable ht = new Hashtable();
  17. ht.Add("y", 270);
  18. ht.Add("islocal", true);
  19. ht.Add("time", 1.0f);
  20. ht.Add("oncomplete", "OnDownAtkIcon");
  21. ht.Add("oncompletetarget", this.gameObject);
  22. ht.Add("oncompleteparams", this.gameObject.name);
  23. iTween.MoveTo(gameObject, ht);
  24. }
  25. /// <summary>
  26. /// 隐藏战斗图片
  27. /// </summary>
  28. private void OnDownAtkIcon(string parm)
  29. {
  30. Hashtable ht = new Hashtable();
  31. ht.Add("y", -50);
  32. ht.Add("islocal", true);
  33. ht.Add("time", 1.0f);
  34. ht.Add("oncomplete", "OnNormalAtkIcon");
  35. ht.Add("oncompletetarget", this.gameObject);
  36. ht.Add("oncompleteparams", this.gameObject.name);
  37. ht.Add("easetype", iTween.EaseType.linear);
  38. iTween.MoveTo(gameObject, ht);
  39. }
  40. /// <summary>
  41. /// 初始装提
  42. /// </summary>
  43. private void OnNormalAtkIcon(string parm)
  44. {
  45. LogHelper.LogError("over");
  46. //isAtkMove = false;
  47. }
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. void OnGUI()
  52. {
  53. if (GUI.Button(new Rect(50, 250, 200, 30), "Button1"))
  54. {
  55. TestItweenMove();
  56. }
  57. }
  58. }