public void RegisterForEvent(eEvents p_eEvent, IEventHandler p_iObject) { switch (p_eEvent) { case eEvents.e_MouseButtonDown: m_lMouseButtonDownObjectsList.Add(p_iObject); break; case eEvents.e_MouseButtonUp: m_lMouseButtonUpObjectsList.Add(p_iObject); break; case eEvents.e_MouseMove: m_lMouseMoveObjectsList.Add(p_iObject); break; case eEvents.e_MouseWheel: m_lMouseWheelObjectsList.Add(p_iObject); break; case eEvents.e_KeyUp: m_lKeyUpObjectsList.Add(p_iObject); break; case eEvents.e_KeyDown: m_lKeyDownObjectsList.Add(p_iObject); break; default: throw new Exception("Unsupported event type"); } }
public void DeRegisterEvent(eEvents @event, EventDelegate _delListener) { if (!_dicEventRegistry.ContainsKey(@event)) return; _dicEventRegistry[@event] -= _delListener; }
public void RemoveEvent(eEvents type, GameEventHandler handler) { List <GameEventHandler> handlerList = m_event_dic.ContainsKey(type) ? m_event_dic[type] : null; if (handlerList != null && handlerList.Contains(handler)) { handlerList.Remove(handler); } }
public void RegisterEvent(eEvents @event, EventDelegate delListener) { if (!_dicEventRegistry.ContainsKey(@event)) { _dicEventRegistry.Add(@event, delListener); return; } _dicEventRegistry[@event] += delListener; }
public void OnEvent(eEvents type, params object[] args) { List <GameEventHandler> handlerList = m_event_dic.ContainsKey(type) ? m_event_dic[type] : null; if (handlerList != null) { for (short i = 0; i < handlerList.Count; i++) { handlerList[i](args); } } }
public void AddEvent(eEvents type, GameEventHandler handler) { List <GameEventHandler> handlerList = m_event_dic.ContainsKey(type) ? m_event_dic[type] : null; if (handlerList == null) { m_event_dic[type] = new List <GameEventHandler>(); } if (m_event_dic[type].Contains(handler)) { return; } m_event_dic[type].Add(handler); }
public void TriggerEvent(eEvents @event, params object[] args) { string strEventKey = @event.ToString(); EventDelegate d; if (!_dicEventRegistry.TryGetValue(@event, out d)) return; if (d != null) d(args); else Debug.LogError("Could not trigger event: " + strEventKey); }
public static void RemoveEvent(eEvents _event, GameEventHandler _handler) { EventSystem.Instance.RemoveEvent(_event, _handler); }