public static InputDispatcher <T> LoadDispatcher <T>() where T : IInputEventBase { string DispatcherName = typeof(T).ToString(); if (s_dispatcher.ContainsKey(DispatcherName)) { //throw new Exception(DispatcherName + " Dispatcher has exist!"); return((InputDispatcher <T>)s_dispatcher[DispatcherName]); } InputDispatcher <T> Dispatcher = new InputDispatcher <T>(); Dispatcher.m_OnAllEventDispatch = s_OnEventDispatch; s_dispatcher.Add(DispatcherName, (IInputDispatcher)Dispatcher); return(Dispatcher); }
public static void RemoveListener <T>(InputEventHandle <T> callback) where T : IInputEventBase { InputDispatcher <T> dispatcher = GetDispatcher <T>(); dispatcher.RemoveListener(typeof(T).Name, callback); }
public static void RemoveAllEventListener <T>(InputEventHandle <T> callback) where T : IInputEventBase { InputDispatcher <T> dispatcher = GetDispatcher <T>(); dispatcher.OnEventDispatch -= callback; }
public static void RemoveListener <T>(string eventKey, InputEventHandle <T> callback) where T : IInputEventBase { InputDispatcher <T> dispatcher = GetDispatcher <T>(); dispatcher.RemoveListener(eventKey, callback); }
public static void Dispatch <T>(T inputEvent) where T : IInputEventBase { InputDispatcher <T> dispatcher = GetDispatcher <T>(); dispatcher.Dispatch(inputEvent); }