public EventDelegate SetEvent(string name, UIEventType ev, EventDelegate.Callback callback, float interval = 0f) { GUILink.UILink uILink = this.GetUILink(name); EventDelegate result; if (uILink == null) { Debug.Log(string.Format("[GUILink] AddEvent object {0} is not exist", name)); result = null; } else { UIEventTrigger uIEventTrigger = uILink.Get <UIEventTrigger>(); if (null == uIEventTrigger) { uIEventTrigger = uILink.Add <UIEventTrigger>(); } List <EventDelegate> delegateList = GUILink.GetDelegateList(uIEventTrigger, ev); if (delegateList != null) { result = EventDelegate.Set(delegateList, callback, interval); } else { result = null; } } return(result); }
public bool RemoveEvent(string name, UIEventType ev, EventDelegate.Callback callback) { GUILink.UILink uILink = this.GetUILink(name); bool result; if (uILink == null) { Debug.Log(string.Format("[GUILink] AddEvent object {0} is not exist", name)); result = false; } else { UIEventTrigger uIEventTrigger = uILink.Get <UIEventTrigger>(); if (uIEventTrigger == null) { result = false; } else { List <EventDelegate> delegateList = GUILink.GetDelegateList(uIEventTrigger, ev); result = (delegateList != null && EventDelegate.Remove(delegateList, callback)); } } return(result); }
public T Get <T>(string name) where T : Component { this.DoInitIfDont(); GUILink.UILink uILink = null; this.all_objs.TryGetValue(name, out uILink); T result; if (uILink == null) { Debug.Log(string.Format("[GUILink] Get<T> object {0} is not exist", name)); result = default(T); } else { result = uILink.Get <T>(); } return(result); }