public void AddCallback(DragDropEventTriggerType type, Action <DragDropEventData> function) { if (csCallbacks.ContainsKey(type)) { csCallbacks[type] += function; } csCallbacks[type] = function; }
public void AddCallback(DragDropEventTriggerType type, DragDropEvent function) { if (callbacks.ContainsKey(type)) { callbacks[type] += function; } callbacks[type] = function; }
public void RemoveCallback(DragDropEventTriggerType type, Action <DragDropEventData> function) { if (csCallbacks.ContainsKey(type)) { csCallbacks[type] -= function; if (csCallbacks[type].GetInvocationList().Length == 0) { csCallbacks.Remove(type); } } }
public void RemoveCallback(DragDropEventTriggerType type, UnityAction <DragDropEventData> function) { var evt = GetEvent(type); if (evt != null) { evt.RemoveListener(function); } else { Debug.LogErrorFormat("Cant find event for type {0}", type); } }
protected bool HandleEventForType(DragDropEventTriggerType type, DragDropEventData eventData) { //Debug.LogError(string.Format("name={0} event={1}",name,type)); bool handleEvent = false; if (callbacks.ContainsKey(type)) { callbacks[type](eventData); handleEvent = true; } return(handleEvent); }
public void SetLuaCallback(DragDropEventTriggerType type, LuaFunction function) { if (luaCallbacks.ContainsKey(type)) { luaCallbacks[type].Dispose(); if (null == function) { luaCallbacks.Remove(type); } } if (null != function) { luaCallbacks[type] = function; } }
protected override DragDropEvent GetEvent(DragDropEventTriggerType type) { switch (type) { case DragDropEventTriggerType.ItemSetFree: return(m_OnItemSetFree); case DragDropEventTriggerType.ItemClick: return(m_OnItemClick); case DragDropEventTriggerType.ItemDrag: return(m_OnItemDrag); default: return(base.GetEvent(type)); } }
protected bool HandleEventForType(DragDropEventTriggerType type, DragDropEventData eventData) { //Debug.LogError(string.Format("name={0} event={1}",name,type)); if (eventData.dummy) { return(false); } var evt = GetEvent(type); if (evt != null) { evt.Invoke(eventData); return(true); } return(false); }
protected bool HandleEventForType(DragDropEventTriggerType type, DragDropEventData eventData) { //Debug.LogError(string.Format("name={0} event={1}",name,type)); bool handleEvent = false; if (csCallbacks.ContainsKey(type)) { csCallbacks[type](eventData); handleEvent = true; } #if USE_LUA_FRAMEWORK if (luaCallbacks.ContainsKey(type)) { luaCallbacks[type].Call(eventData); handleEvent = true; } #endif return(handleEvent); }
protected virtual DragDropEvent GetEvent(DragDropEventTriggerType type) { switch (type) { case DragDropEventTriggerType.ItemExit: return(m_OnItemExit); case DragDropEventTriggerType.ItemEnter: return(m_OnItemEnter); case DragDropEventTriggerType.ItemDetach: return(m_OnItemDetach); case DragDropEventTriggerType.ItemAttach: return(m_OnItemAttach); default: return(null); } }