Beispiel #1
0
        public override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
        {
            Vector2 vector;

            if (this.letterBoxCamera == null)
            {
                vector = new Vector2(eventData.get_position().x / ((float)Screen.get_width()), eventData.get_position().y / ((float)Screen.get_height()));
            }
            else
            {
                vector = this.letterBoxCamera.CachedCamera.ScreenToViewportPoint(eventData.get_position());
            }
            if (((vector.x >= 0f) && (vector.x <= 1f)) && ((vector.y >= 0f) && (vector.y <= 1f)))
            {
                int num = 0;
                foreach (GameObject obj2 in this.targetObjectList)
                {
                    RaycastResult item = new RaycastResult {
                        distance = float.MaxValue
                    };
                    item.set_gameObject(obj2);
                    item.index  = num++;
                    item.module = this;
                    resultAppendList.Add(item);
                }
            }
        }
 private void AppendResultList(ref Ray ray, float hitDistance, List <RaycastResult> resultAppendList, List <Graphic> raycastResults)
 {
     for (int i = 0; i < raycastResults.get_Count(); i++)
     {
         GameObject gameObject = raycastResults.get_Item(i).gameObject;
         bool       flag       = true;
         if (base.get_ignoreReversedGraphics())
         {
             if (this.get_eventCamera() == null)
             {
                 Vector3 rhs = gameObject.transform.rotation * Vector3.forward;
                 flag = (Vector3.Dot(Vector3.forward, rhs) > 0f);
             }
             else
             {
                 Vector3 lhs  = this.get_eventCamera().transform.rotation *Vector3.forward;
                 Vector3 rhs2 = gameObject.transform.rotation * Vector3.forward;
                 flag = (Vector3.Dot(lhs, rhs2) > 0f);
             }
         }
         if (flag)
         {
             float num;
             if (this.get_eventCamera() == null || this.canvas.renderMode == RenderMode.ScreenSpaceOverlay)
             {
                 num = 0f;
             }
             else
             {
                 num = Vector3.Dot(gameObject.transform.forward, gameObject.transform.position - ray.origin) / Vector3.Dot(gameObject.transform.forward, ray.direction);
                 if (num < 0f)
                 {
                     goto IL_1A7;
                 }
             }
             if (num < hitDistance)
             {
                 RaycastResult raycastResult = default(RaycastResult);
                 raycastResult.set_gameObject(gameObject);
                 raycastResult.module       = this;
                 raycastResult.distance     = num;
                 raycastResult.index        = (float)resultAppendList.get_Count();
                 raycastResult.depth        = raycastResults.get_Item(i).get_depth();
                 raycastResult.sortingLayer = this.canvas.sortingLayerID;
                 raycastResult.sortingOrder = this.canvas.sortingOrder;
                 RaycastResult raycastResult2 = raycastResult;
                 resultAppendList.Add(raycastResult2);
             }
         }
         IL_1A7 :;
     }
 }
        public unsafe override void Raycast(PointerEventData eventData, List <RaycastResult> resultAppendList)
        {
            //IL_0034: Unknown result type (might be due to invalid IL or missing references)
            //IL_005a: Unknown result type (might be due to invalid IL or missing references)
            //IL_005f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0064: Unknown result type (might be due to invalid IL or missing references)
            //IL_0069: Unknown result type (might be due to invalid IL or missing references)
            //IL_006a: Unknown result type (might be due to invalid IL or missing references)
            //IL_006b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0077: Unknown result type (might be due to invalid IL or missing references)
            //IL_0083: Unknown result type (might be due to invalid IL or missing references)
            //IL_0088: Unknown result type (might be due to invalid IL or missing references)
            //IL_008d: Unknown result type (might be due to invalid IL or missing references)
            //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
            //IL_00de: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ef: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
            //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
            //IL_00fa: Unknown result type (might be due to invalid IL or missing references)
            //IL_00fc: Unknown result type (might be due to invalid IL or missing references)
            //IL_010a: Unknown result type (might be due to invalid IL or missing references)
            //IL_0118: Unknown result type (might be due to invalid IL or missing references)
            //IL_0126: Unknown result type (might be due to invalid IL or missing references)
            //IL_013e: Unknown result type (might be due to invalid IL or missing references)
            //IL_014e: Unknown result type (might be due to invalid IL or missing references)
            //IL_014f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0154: Unknown result type (might be due to invalid IL or missing references)
            //IL_0168: Unknown result type (might be due to invalid IL or missing references)
            //IL_0169: Unknown result type (might be due to invalid IL or missing references)
            //IL_01bf: Unknown result type (might be due to invalid IL or missing references)
            //IL_01da: Unknown result type (might be due to invalid IL or missing references)
            //IL_01df: Unknown result type (might be due to invalid IL or missing references)
            //IL_01e1: Unknown result type (might be due to invalid IL or missing references)
            //IL_01e5: Unknown result type (might be due to invalid IL or missing references)
            //IL_01f0: Unknown result type (might be due to invalid IL or missing references)
            //IL_01f5: Unknown result type (might be due to invalid IL or missing references)
            //IL_01ff: Unknown result type (might be due to invalid IL or missing references)
            //IL_0203: Unknown result type (might be due to invalid IL or missing references)
            //IL_0227: Unknown result type (might be due to invalid IL or missing references)
            //IL_0249: Unknown result type (might be due to invalid IL or missing references)
            //IL_024a: Unknown result type (might be due to invalid IL or missing references)
            //IL_024f: Unknown result type (might be due to invalid IL or missing references)
            //IL_029f: Unknown result type (might be due to invalid IL or missing references)
            //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
            //IL_02a4: Unknown result type (might be due to invalid IL or missing references)
            if (canvas == null)
            {
                return;
            }
            IList <Graphic> graphicsForCanvas = GraphicRegistry.GetGraphicsForCanvas(canvas);

            if (graphicsForCanvas == null || graphicsForCanvas.Count == 0)
            {
                return;
            }
            Camera  eventCamera = this.get_eventCamera();
            int     num         = ((int)canvas.get_renderMode() != 0 && !(eventCamera == null)) ? eventCamera.get_targetDisplay() : canvas.get_targetDisplay();
            Vector3 val         = Display.RelativeMouseAt(Vector2.op_Implicit(eventData.get_position()));

            if (val != Vector3.get_zero())
            {
                if ((int)((IntPtr)(void *)val).z != num)
                {
                    return;
                }
            }
            else
            {
                val = Vector2.op_Implicit(eventData.get_position());
            }
            Vector2 val2 = default(Vector2);

            if (eventCamera == null)
            {
                float num2 = Screen.get_width();
                float num3 = Screen.get_height();
                if (num > 0 && num < Display.displays.Length)
                {
                    num2 = Display.displays[num].get_systemWidth();
                    num3 = Display.displays[num].get_systemHeight();
                }
                val2._002Ector(((IntPtr)(void *)val).x / num2, ((IntPtr)(void *)val).y / num3);
            }
            else
            {
                val2 = Vector2.op_Implicit(eventCamera.ScreenToViewportPoint(val));
            }
            if (((IntPtr)(void *)val2).x < 0f || ((IntPtr)(void *)val2).x > 1f || ((IntPtr)(void *)val2).y < 0f || ((IntPtr)(void *)val2).y > 1f)
            {
                return;
            }
            float num4 = float.MaxValue;
            Ray   val3 = default(Ray);

            if (eventCamera != null)
            {
                val3 = eventCamera.ScreenPointToRay(val);
            }
            m_RaycastResults.Clear();
            Raycast(canvas, eventCamera, Vector2.op_Implicit(val), graphicsForCanvas, m_RaycastResults);
            int count = m_RaycastResults.Count;

            for (int i = 0; i < count; i++)
            {
                GameObject gameObject = m_RaycastResults[i].get_gameObject();
                if (1 == 0)
                {
                    continue;
                }
                float num5 = 0f;
                if (eventCamera == null || (int)canvas.get_renderMode() == 0)
                {
                    num5 = 0f;
                }
                else
                {
                    Transform transform = gameObject.get_transform();
                    Vector3   forward   = transform.get_forward();
                    num5 = Vector3.Dot(forward, transform.get_position() - eventCamera.get_transform().get_position()) / Vector3.Dot(forward, val3.get_direction());
                    if (num5 < 0f)
                    {
                        continue;
                    }
                }
                if (!(num5 >= num4))
                {
                    RaycastResult val4 = default(RaycastResult);
                    val4.set_gameObject(gameObject);
                    val4.module         = this;
                    val4.distance       = num5;
                    val4.screenPosition = Vector2.op_Implicit(val);
                    val4.index          = resultAppendList.Count;
                    val4.depth          = m_RaycastResults[i].get_depth();
                    val4.sortingLayer   = canvas.get_sortingLayerID();
                    val4.sortingOrder   = canvas.get_sortingOrder();
                    RaycastResult item = val4;
                    resultAppendList.Add(item);
                }
            }
        }