TestButtonClickSpan.cs 755 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEngine;
  2. using System.Collections;
  3. public class TestButtonClickSpan : MonoBehaviour {
  4. float spanTime = 0;
  5. bool isStart = false;
  6. /// <summary>
  7. ///
  8. /// </summary>
  9. public GameObject mBtn = null;
  10. // Use this for initialization
  11. void Start () {
  12. EventTriggerListener.Get(this.mBtn).onClick = OnHandle;
  13. }
  14. int i = 0;
  15. /// <summary>
  16. /// 释放
  17. /// </summary>
  18. /// <param name="obj"></param>
  19. private void OnHandle(GameObject obj)
  20. {
  21. if (spanTime > 5)
  22. { return; }
  23. isStart = true;
  24. LogHelper.LogError(i++);
  25. }
  26. // Update is called once per frame
  27. void Update () {
  28. if (spanTime > 5)
  29. { return; }
  30. spanTime += Time.deltaTime;
  31. }
  32. }