AdvExecuteEvents.cs 678 B

12345678910111213141516171819202122232425262728
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. using UnityEngine.EventSystems;
  6. /// <summary>
  7. /// 配合AdvStandaloneInputModule使用
  8. /// </summary>
  9. public static class AdvExecuteEvents
  10. {
  11. public class EventFunction : UnityEvent<PointerEventData> {}
  12. private static EventFunction s_OnClick = new EventFunction();
  13. public static EventFunction onClick
  14. {
  15. get { return s_OnClick; }
  16. set { s_OnClick = value; }
  17. }
  18. public static void Execute(PointerEventData eventData, EventFunction functor)
  19. {
  20. if (functor == null) return;
  21. functor.Invoke(eventData);
  22. }
  23. }