Example #1
0
        protected void ProcessPressUp(ColliderButtonEventData eventData, ButtonHandlers handlers)
        {
            IndexedSet <GameObject> tmp;

            eventData.isPressed = false;

            tmp = eventData.lastPressedRawObjects;
            eventData.lastPressedRawObjects = eventData.pressedRawObjects;
            eventData.pressedRawObjects     = tmp;

            // press up
            handlers.pressUpHandlers.AddRange(eventData.pressedHandlers);

            tmp = eventData.lastPressedHandlers;
            eventData.lastPressedHandlers = eventData.pressedHandlers;
            eventData.pressedHandlers     = tmp;

            // drag end
            handlers.dragEndHandlers.AddRange(eventData.draggingHandlers);
            // drop
            if (eventData.isDragging)
            {
                GetEventHandlersFromHoveredColliders <IColliderEventDropHandler>(handlers.dropHandlers);
            }

            // click end (execute only if pressDown handler and pressUp handler are the same)
            GetMatchedEventHandlersFromHoveredColliders <IColliderEventClickHandler>(h => eventData.clickingHandlers.Remove(h), handlers.clickHandlers);

            eventData.pressedRawObjects.Clear();
            eventData.pressedHandlers.Clear();
            eventData.clickingHandlers.Clear();
            eventData.draggingHandlers.Clear();
        }
Example #2
0
 protected void ProcessPressing(ColliderButtonEventData eventData, ButtonHandlers handlers)
 {
     // dragging
     for (int i = eventData.draggingHandlers.Count - 1; i >= 0; --i)
     {
         handlers.dragUpdateHandlers.Add(eventData.draggingHandlers[i]);
     }
 }
 protected void ProcessPressing(ColliderButtonEventData eventData)
 {
     // dragging
     for (int j = eventData.draggingHandlers.Count - 1; j >= 0; --j)
     {
         ExecuteEvents.Execute(eventData.draggingHandlers[j], eventData, ExecuteColliderEvents.DragUpdateHandler);
     }
 }
Example #4
0
        protected void ProcessPressDown(ColliderButtonEventData eventData)
        {
            eventData.isPressed     = true;
            eventData.pressPosition = transform.position;
            eventData.pressRotation = transform.rotation;

            // click start
            for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventClickHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                eventData.clickingHandlers.AddUnique(handler);
            }
            // press down
            for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventPressDownHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                if (!s_gos.Add(handler.GetInstanceID()))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.PressDownHandler);
            }
            s_gos.Clear();
            // drag start
            for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventDragStartHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                if (!eventData.draggingHandlers.AddUnique(handler))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.DragStartHandler);
            }
        }
        protected void ProcessPressDown(ColliderButtonEventData eventData)
        {
            // press down
            for (int j = hoveredColliders.Count - 1; j >= 0; --j)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventPressDownHandler>(hoveredColliders[j].gameObject);

                if (handler == null)
                {
                    continue;
                }

                if (!s_gos.Add(handler.GetInstanceID()))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.PressDownHandler);
            }
            s_gos.Clear();
            // drag start
            for (int j = hoveredColliders.Count - 1; j >= 0; --j)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventDragStartHandler>(hoveredColliders[j].gameObject);

                if (handler == null)
                {
                    continue;
                }

                if (!eventData.draggingHandlers.AddUnique(handler))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.DragStartHandler);

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.DragUpdateHandler);
            }
            // click start
            for (int j = hoveredColliders.Count - 1; j >= 0; --j)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventClickHandler>(hoveredColliders[j].gameObject);

                if (handler == null)
                {
                    continue;
                }

                eventData.clickingHandlers.AddUnique(handler);
            }
        }
Example #6
0
        protected void ProcessPressDown(ColliderButtonEventData eventData, ButtonHandlers handlers)
        {
            eventData.isPressed     = true;
            eventData.pressPosition = transform.position;
            eventData.pressRotation = transform.rotation;

            // click start
            GetEventHandlersFromHoveredColliders <IColliderEventClickHandler>(eventData.clickingHandlers);
            // press down
            GetEventHandlersFromHoveredColliders <IColliderEventPressDownHandler>(handlers.pressDownHandlers);
            // drag start
            GetEventHandlersFromHoveredColliders <IColliderEventDragStartHandler>(eventData.draggingHandlers, handlers.dragStartHandlers);
        }
Example #7
0
        protected void ProcessPressUp(ColliderButtonEventData eventData, ButtonHandlers handlers)
        {
            eventData.isPressed = false;

            // press up
            GetEventHandlersFromHoveredColliders <IColliderEventPressUpHandler>(handlers.pressUpHandlers);
            // drag end
            for (int i = eventData.draggingHandlers.Count - 1; i >= 0; --i)
            {
                handlers.dragEndHandlers.Add(eventData.draggingHandlers[i]);
            }
            // drop
            if (eventData.draggingHandlers.Count > 0)
            {
                GetEventHandlersFromHoveredColliders <IColliderEventDropHandler>(handlers.dropHandlers);
            }
            // click end (execute only if pressDown handler and pressUp handler are the same)

            for (int i = stayingColliders.Count - 1; i >= 0; --i)
            {
                var collider = stayingColliders[i];

                if (collider == null)
                {
                    continue;
                }

                var handler = ExecuteEvents.GetEventHandler <IColliderEventClickHandler>(collider.gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                if (!eventData.clickingHandlers.Remove(handler))
                {
                    continue;
                }

                handlers.clickHandlers.Add(handler);
            }

            eventData.clickingHandlers.Clear();
            eventData.draggingHandlers.Clear();
        }
Example #8
0
        protected void ProcessPressDown(ColliderButtonEventData eventData, ButtonHandlers handlers)
        {
            eventData.isPressed     = true;
            eventData.pressPosition = transform.position;
            eventData.pressRotation = transform.rotation;

            for (int i = stayingColliders.Count - 1; i >= 0; --i)
            {
                if (stayingColliders[i] != null)
                {
                    eventData.pressedRawObjects.AddUnique(stayingColliders[i].gameObject);
                }
            }

            // press down
            GetEventHandlersFromHoveredColliders <IColliderEventPressDownHandler>(eventData.pressedHandlers, handlers.pressDownHandlers);
            // click start
            GetEventHandlersFromHoveredColliders <IColliderEventClickHandler>(eventData.clickingHandlers);
            // drag start
            GetEventHandlersFromHoveredColliders <IColliderEventDragStartHandler>(eventData.draggingHandlers, handlers.dragStartHandlers);
        }
Example #9
0
 protected void ProcessPressing(ColliderButtonEventData eventData, ButtonHandlers handlers)
 {
     // dragging
     handlers.dragUpdateHandlers.AddRange(eventData.draggingHandlers);
 }
        protected void ProcessPressUp(ColliderButtonEventData eventData)
        {
            // press up
            for (int j = hoveredColliders.Count - 1; j >= 0; --j)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventPressUpHandler>(hoveredColliders[j].gameObject);

                if (handler == null)
                {
                    continue;
                }

                if (!s_gos.Add(handler.GetInstanceID()))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.PressUpHandler);
            }
            s_gos.Clear();
            // drag end
            for (int j = eventData.draggingHandlers.Count - 1; j >= 0; --j)
            {
                ExecuteEvents.Execute(eventData.draggingHandlers[j], eventData, ExecuteColliderEvents.DragEndHandler);
            }
            // drop (execute if only there are dragging handlers)
            if (eventData.draggingHandlers.Count > 0 && hoveredColliders.Count > 0)
            {
                for (int j = hoveredColliders.Count - 1; j >= 0; --j)
                {
                    var handler = ExecuteEvents.GetEventHandler <IColliderEventDropHandler>(hoveredColliders[j].gameObject);

                    if (handler == null)
                    {
                        continue;
                    }

                    if (!s_gos.Add(handler.GetInstanceID()))
                    {
                        continue;
                    }

                    ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.DropHandler);
                }
            }
            s_gos.Clear();
            // click end (execute only if pressDown handler and pressUp handler are the same)
            for (int j = hoveredColliders.Count - 1; j >= 0; --j)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventClickHandler>(hoveredColliders[j].gameObject);

                if (handler == null)
                {
                    continue;
                }

                if (eventData.clickingHandlers.Remove(handler))
                {
                    ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.ClickHandler);
                }
            }

            eventData.clickingHandlers.Clear();
            eventData.draggingHandlers.Clear();
        }
Example #11
0
 public void OnColliderEventClick(ColliderButtonEventData eventData)
 {
     Execute(ColliderEventTriggerType.Click, eventData);
 }
Example #12
0
 public void OnColliderEventPressExit(ColliderButtonEventData eventData)
 {
     Execute(ColliderEventTriggerType.PressExit, eventData);
 }
Example #13
0
 public void OnColliderEventDrop(ColliderButtonEventData eventData)
 {
     Execute(ColliderEventTriggerType.Drop, eventData);
 }
Example #14
0
        protected void ProcessPressUp(ColliderButtonEventData eventData)
        {
            eventData.isPressed = false;

            // press up
            for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventPressUpHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                if (!s_gos.Add(handler.GetInstanceID()))
                {
                    continue;
                }

                ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.PressUpHandler);
            }
            s_gos.Clear();
            // drag end
            for (int i = eventData.draggingHandlers.Count - 1; i >= 0; --i)
            {
                ExecuteEvents.Execute(eventData.draggingHandlers[i], eventData, ExecuteColliderEvents.DragEndHandler);
            }
            // drop
            if (eventData.draggingHandlers.Count > 0)
            {
                for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
                {
                    var handler = ExecuteEvents.GetEventHandler <IColliderEventDropHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                    if (ReferenceEquals(handler, null))
                    {
                        continue;
                    }

                    if (!s_gos.Add(handler.GetInstanceID()))
                    {
                        continue;
                    }

                    ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.DropHandler);
                }
            }
            s_gos.Clear();
            // click end (execute only if pressDown handler and pressUp handler are the same)
            for (int i = hoveredColliderCount.Count - 1; i >= 0; --i)
            {
                var handler = ExecuteEvents.GetEventHandler <IColliderEventClickHandler>(hoveredColliderCount.GetKeyByIndex(i).gameObject);

                if (ReferenceEquals(handler, null))
                {
                    continue;
                }

                if (eventData.clickingHandlers.Remove(handler))
                {
                    ExecuteEvents.Execute(handler, eventData, ExecuteColliderEvents.ClickHandler);
                }
            }

            eventData.clickingHandlers.Clear();
            eventData.draggingHandlers.Clear();
        }