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); //停留池添加 } }
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); //去除物体列表 } }
public void OnDrag(PointerEventData eventData)//拖拽事件 { if (!TouchRayDragLists.ContainsKey(eventData.pointerId)) { return; } //触摸事件通知:拖拽 SS_Ray.UISendEvent(TouchRayDownLists[eventData.pointerId], eventData, ExecuteEvents.dragHandler); }
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); }
public void OnEndDrag(PointerEventData eventData) { if (!TouchRayDragLists.ContainsKey(eventData.pointerId)) { return; } //触摸事件通知:拖拽结束 SS_Ray.UISendEvent(TouchRayDragLists[eventData.pointerId], eventData, ExecuteEvents.endDragHandler); if (TouchRayDragLists.ContainsKey(eventData.pointerId)) { TouchRayDragLists.Remove(eventData.pointerId); //去除物体列表 } }
public void OnPointerExit(PointerEventData eventData) { if (!TouchRayEnterLists.ContainsKey(eventData.pointerId)) { return; } if (TouchEnterPool.ContainsKey(eventData.pointerId)) { TouchEnterPool.Remove(eventData.pointerId); //停留池删除 } //触摸事件通知:离开 SS_Ray.UISendEvent(TouchRayEnterLists[eventData.pointerId], eventData, ExecuteEvents.pointerExitHandler); if (TouchRayEnterLists.ContainsKey(eventData.pointerId)) { TouchRayEnterLists.Remove(eventData.pointerId); //停留UI集合池剔除 } }
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); }
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); }
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); }