Exemplo n.º 1
0
        public void OnPointerEnter(PointerEventData eventData)
        {
            if (TouchRayEnterLists.ContainsKey(eventData.pointerId))
            {
                return;
            }
            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count < 1)
            {
                return;
            }
            UI_List.RemoveAt(0);//顶层为自己,剔除。

            if (!TouchRayEnterLists.ContainsKey(eventData.pointerId))
            {
                TouchRayEnterLists.Add(eventData.pointerId, UI_List);                                                      //停留UI集合池添加
            }
            //触摸事件通知:停留
            SS_Ray.UISendEvent(UI_List, eventData, ExecuteEvents.pointerEnterHandler);

            if (!TouchEnterPool.ContainsKey(eventData.pointerId))
            {
                TouchEnterPool.Add(eventData.pointerId, eventData);                                                  //停留池添加
            }
        }
Exemplo n.º 2
0
        public void OnPointerUp(PointerEventData eventData)//抬起事件
        {
            if (!TouchRayDownLists.ContainsKey(eventData.pointerId))
            {
                return;
            }
            //抬起事件

            //触摸事件通知:停止拖拽,抬起
            SS_Ray.UISendEvent(TouchRayDownLists[eventData.pointerId], eventData, ExecuteEvents.pointerUpHandler);

            //点击事件

            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count > 0)
            {
                UI_List.RemoveAt(0);                   //顶层为自己,剔除。
            }
            List <RaycastResult> Click_List = SS_GameObject.List_Intersect(TouchRayDownLists[eventData.pointerId], UI_List, (RaycastResult a, RaycastResult b) => { return(object.ReferenceEquals(a.gameObject, b.gameObject)); });

            SS_Ray.UISendEvent(Click_List, eventData, ExecuteEvents.pointerClickHandler);

            if (TouchRayDownLists.ContainsKey(eventData.pointerId))
            {
                TouchRayDownLists.Remove(eventData.pointerId);                                                      //去除物体列表
            }
        }
Exemplo n.º 3
0
        public void OnScroll(PointerEventData eventData)
        {
            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count < 1)
            {
                return;
            }
            UI_List.RemoveAt(0);//顶层为自己,剔除。

            //触摸事件通知:滚轮
            SS_Ray.UISendEvent(UI_List, eventData, ExecuteEvents.scrollHandler);
        }
Exemplo n.º 4
0
        public void OnBeginDrag(PointerEventData eventData)
        {
            if (TouchRayDragLists.ContainsKey(eventData.pointerId))
            {
                return;
            }
            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count < 1)
            {
                return;
            }
            UI_List.RemoveAt(0);//顶层为自己,剔除。
            if (!TouchRayDragLists.ContainsKey(eventData.pointerId))
            {
                TouchRayDragLists.Add(eventData.pointerId, UI_List);                                                     //添加物体列表到字典
            }
            //触摸事件通知:拖拽开始
            SS_Ray.UISendEvent(TouchRayDragLists[eventData.pointerId], eventData, ExecuteEvents.beginDragHandler);
        }
Exemplo n.º 5
0
        public void OnPointerDown(PointerEventData eventData)//按下事件
        {
            if (TouchRayDownLists.ContainsKey(eventData.pointerId))
            {
                return;
            }

            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count < 1)
            {
                return;
            }
            UI_List.RemoveAt(0);//顶层为自己,剔除。
            if (!TouchRayDownLists.ContainsKey(eventData.pointerId))
            {
                TouchRayDownLists.Add(eventData.pointerId, UI_List);                                                     //添加物体列表到字典
            }
            //触摸事件通知:按下,开始拖拽
            SS_Ray.UISendEvent(UI_List, eventData, ExecuteEvents.pointerDownHandler);
        }
Exemplo n.º 6
0
        public void OnStay(PointerEventData eventData)
        {
            List <RaycastResult> UI_List = SS_Ray.UIRayCast(canvas, eventData.position, InterceptTag, IgnoreLayer);//提取物体列表

            if (UI_List.Count < 1)
            {
                return;
            }
            UI_List.RemoveAt(0);//顶层为自己,剔除。

            List <RaycastResult> Enter_List = SS_GameObject.List_Except(UI_List, TouchRayEnterLists[eventData.pointerId], (RaycastResult a, RaycastResult b) => { return(object.ReferenceEquals(a.gameObject, b.gameObject)); });
            List <RaycastResult> Exit_List  = SS_GameObject.List_Except(TouchRayEnterLists[eventData.pointerId], UI_List, (RaycastResult a, RaycastResult b) => { return(object.ReferenceEquals(a.gameObject, b.gameObject)); });

            //触摸事件通知:停留
            SS_Ray.UISendEvent(Enter_List, eventData, ExecuteEvents.pointerEnterHandler);

            //触摸事件通知:离开
            SS_Ray.UISendEvent(Exit_List, eventData, ExecuteEvents.pointerExitHandler);

            TouchRayEnterLists[eventData.pointerId] = new List <RaycastResult>(UI_List);
        }