RaycastAll() public method

public RaycastAll ( PointerEventData eventData, List raycastResults ) : void
eventData PointerEventData
raycastResults List
return void
コード例 #1
2
ファイル: ETCBase.cs プロジェクト: YanivP/FriendBubbles
	protected GameObject GetFirstUIElement( Vector2 position){
		
		uiEventSystem = EventSystem.current;
		if (uiEventSystem != null){
			
			uiPointerEventData = new PointerEventData( uiEventSystem);
			uiPointerEventData.position = position;
			
			uiEventSystem.RaycastAll( uiPointerEventData, uiRaycastResultCache);
			if (uiRaycastResultCache.Count>0){
				return uiRaycastResultCache[0].gameObject;
			}
			else{
				return null;
			}
		}
		else{
			return null;
		}
	}
コード例 #2
0
 static public int RaycastAll(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.EventSystems.EventSystem      self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.RaycastAll(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #3
0
 private void GetMouseHoverInfo(out bool is_hovering_screen, out bool is_hovering_button)
 {
     UnityEngine.EventSystems.EventSystem current = UnityEngine.EventSystems.EventSystem.current;
     if ((UnityEngine.Object)current == (UnityEngine.Object)null)
     {
         is_hovering_button = false;
         is_hovering_screen = false;
     }
     else
     {
         List <RaycastResult> list             = new List <RaycastResult>();
         PointerEventData     pointerEventData = new PointerEventData(current);
         pointerEventData.position = KInputManager.GetMousePos();
         current.RaycastAll(pointerEventData, list);
         bool flag  = false;
         bool flag2 = false;
         foreach (RaycastResult item in list)
         {
             if ((UnityEngine.Object)item.gameObject.GetComponent <OptionSelector>() != (UnityEngine.Object)null || ((UnityEngine.Object)item.gameObject.transform.parent != (UnityEngine.Object)null && (UnityEngine.Object)item.gameObject.transform.parent.GetComponent <OptionSelector>() != (UnityEngine.Object)null))
             {
                 flag  = true;
                 flag2 = true;
                 break;
             }
             if (HasParent(item.gameObject, base.gameObject))
             {
                 flag2 = true;
             }
         }
         is_hovering_screen = flag2;
         is_hovering_button = flag;
     }
 }
コード例 #4
0
    static int RaycastAll(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        UnityEngine.EventSystems.EventSystem          obj  = (UnityEngine.EventSystems.EventSystem)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.EventSystems.EventSystem");
        UnityEngine.EventSystems.PointerEventData     arg0 = (UnityEngine.EventSystems.PointerEventData)LuaScriptMgr.GetNetObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData));
        List <UnityEngine.EventSystems.RaycastResult> arg1 = (List <UnityEngine.EventSystems.RaycastResult>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <UnityEngine.EventSystems.RaycastResult>));

        obj.RaycastAll(arg0, arg1);
        return(0);
    }
コード例 #5
0
    //方法二 通过UI事件发射射线
    //是 2D UI 的位置,非 3D 位置
    public static bool IsPointerOverUIObjectTwo(UnityEngine.EventSystems.EventSystem cacheEventSystem, Vector2 screenPosition)
    {
        //实例化点击事件
        UnityEngine.EventSystems.PointerEventData eventDataCurrentPosition = new UnityEngine.EventSystems.PointerEventData(cacheEventSystem);
        //将点击位置的屏幕坐标赋值给点击事件
        eventDataCurrentPosition.position = new Vector2(screenPosition.x, screenPosition.y);
        List <UnityEngine.EventSystems.RaycastResult> results = new List <UnityEngine.EventSystems.RaycastResult>();

        //向点击处发射射线
        cacheEventSystem.RaycastAll(eventDataCurrentPosition, results);
        return(results.Count > 0);
    }
コード例 #6
0
 static public int RaycastAll(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.EventSystem      self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.RaycastAll(a1, a2);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static int RaycastAll(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.EventSystems.EventSystem      obj  = (UnityEngine.EventSystems.EventSystem)ToLua.CheckObject <UnityEngine.EventSystems.EventSystem>(L, 1);
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> arg1 = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>));
         obj.RaycastAll(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #8
0
 static public int RaycastAll(IntPtr l)
 {
     try{
         UnityEngine.EventSystems.EventSystem      self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.RaycastAll(a1, a2);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #9
0
    public virtual bool ShowHoverUI()
    {
        bool result = false;

        UnityEngine.EventSystems.EventSystem current = UnityEngine.EventSystems.EventSystem.current;
        if ((UnityEngine.Object)current != (UnityEngine.Object)null)
        {
            Vector3          mousePos         = KInputManager.GetMousePos();
            float            x                = mousePos.x;
            Vector3          mousePos2        = KInputManager.GetMousePos();
            Vector3          v                = new Vector3(x, mousePos2.y, 0f);
            PointerEventData pointerEventData = new PointerEventData(current);
            pointerEventData.position = v;
            current.RaycastAll(pointerEventData, castResults);
            result = (castResults.Count == 0);
        }
        return(result);
    }
コード例 #10
0
    private void RaycastToScrollGroup()
    {
        currentUIItem        = null;
        pointerData.position = Input.mousePosition;

        results = new List <RaycastResult>();

        current.RaycastAll(pointerData, results);

        if (results.Count > 0)
        {
            foreach (RaycastResult r in results)
            {
                currentUIItem = r.gameObject.GetComponent <PLEUIItem>();

                if (currentUIItem)
                {
                    break;
                }
            }
        }
    }
コード例 #11
0
ファイル: EasyTouch.cs プロジェクト: krooq/catotype
	private bool IsScreenPositionOverUI( Vector2 position){

		uiEventSystem = EventSystem.current;
		if (uiEventSystem != null){

			uiPointerEventData = new PointerEventData( uiEventSystem);
			uiPointerEventData.position = position;

			uiEventSystem.RaycastAll( uiPointerEventData, uiRaycastResultCache);
			if (uiRaycastResultCache.Count>0){
				return true;
			}
			else{
				return false;
			}
		}
		else{
			return false;
		}
	}