using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class EventManager
{
public static void addEventListener(GameObject go,EventTriggerType type,UnityAction<BaseEventData>callback)
{
EventTrigger et=go.GetComponent<EventTrigger>();
if(et==null)
{
et=go.AddComponent<EventTrigger>();
}
List<EventTrigger.Entry>entrys=et.triggers;
if(entrys==null)
{
entrys=new List<EventTrigger.Entry>();
et.triggers=entrys;
}
EventTrigger.TriggerEvent te=new EventTrigger.TriggerEnent();
te.AddListener(callback);
EventTrigger.Entry entry=new EvnetTrigger.Entry();
entry.eventID=type;
entry.callback=te;
entrys.Add(entry);
}
}