Exemplo n.º 1
0
 public void AddCallback(DragDropEventTriggerType type, Action <DragDropEventData> function)
 {
     if (csCallbacks.ContainsKey(type))
     {
         csCallbacks[type] += function;
     }
     csCallbacks[type] = function;
 }
Exemplo n.º 2
0
 public void AddCallback(DragDropEventTriggerType type, DragDropEvent function)
 {
     if (callbacks.ContainsKey(type))
     {
         callbacks[type] += function;
     }
     callbacks[type] = function;
 }
Exemplo n.º 3
0
 public void RemoveCallback(DragDropEventTriggerType type, Action <DragDropEventData> function)
 {
     if (csCallbacks.ContainsKey(type))
     {
         csCallbacks[type] -= function;
         if (csCallbacks[type].GetInvocationList().Length == 0)
         {
             csCallbacks.Remove(type);
         }
     }
 }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 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));
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
            }
        }