public static void DispatchLongPressEvent(string UIName, string ComponentName, string parm, InputUIEventType type) { //只有允许输入时才派发事件 if (IsActive) { InputUILongPressEvent e = GetUIEvent <InputUILongPressEvent>(UIName, ComponentName, parm); e.m_LongPressType = type; e.EventKey = InputUILongPressEvent.GetEventKey(UIName, ComponentName, parm); InputManager.Dispatch("InputUILongPressEvent", e); } }
public static InputEventRegisterInfo <InputUILongPressEvent> GetLongPressListener(LongPressAcceptor acceptor, string UIName, string ComponentName, string parm, InputEventHandle <InputUILongPressEvent> callback) { InputlongPressRegisterInfo info = HeapObjectPool <InputlongPressRegisterInfo> .GetObject(); info.eventKey = InputUILongPressEvent.GetEventKey(UIName, ComponentName, parm); info.callBack = callback; info.m_acceptor = acceptor; info.m_OnLongPress = (type) => { DispatchLongPressEvent(UIName, ComponentName, parm, type); }; return(info); }
public InputEventRegisterInfo <InputUILongPressEvent> GetLongPressRegisterInfo(string compName, InputEventHandle <InputUILongPressEvent> callback, string parm) { string eventKey = InputUILongPressEvent.GetEventKey(UIName, compName, parm); for (int i = 0; i < m_LongPressEvents.Count; i++) { InputEventRegisterInfo <InputUILongPressEvent> info = (InputEventRegisterInfo <InputUILongPressEvent>)m_LongPressEvents[i]; if (info.eventKey == eventKey && info.callBack == callback) { return(info); } } throw new Exception("GetLongPressRegisterInfo Exception not find RegisterInfo by " + compName + " parm " + parm); }
static int GetEventKey(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); string arg0 = ToLua.CheckString(L, 1); string arg1 = ToLua.CheckString(L, 2); string arg2 = ToLua.CheckString(L, 3); string o = InputUILongPressEvent.GetEventKey(arg0, arg1, arg2); LuaDLL.lua_pushstring(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }