Beispiel #1
0
 public bool As(out UIConvexHotSpot cast)
 {
     if (this.kind == Kind.Convex)
     {
         cast = (UIConvexHotSpot)this;
         return(true);
     }
     cast = null;
     return(false);
 }
Beispiel #2
0
        private static Bounds?DoStep()
        {
            bool      flag;
            bool      flag2;
            Transform transform;
            bool      flag4;
            Bounds    bounds   = new Bounds();
            bool      flag3    = true;
            int       allCount = UIHotSpot.Global.allCount;

            if (Circle.any)
            {
                for (int i = 0; i < Circle.count; i++)
                {
                    UICircleHotSpot spot = Circle.array[i];
                    transform      = spot.transform;
                    spot.lastWorld = spot.toWorld;
                    spot.toWorld   = transform.localToWorldMatrix;
                    spot.lastLocal = spot.toLocal;
                    spot.toLocal   = transform.worldToLocalMatrix;
                    flag2          = !(flag4 = !spot.justAdded) || !(flag4 = MatrixEquals(ref spot.toWorld, ref spot.lastWorld));
                    flag           = spot.justAdded || (!spot.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot.toLocal, ref spot.lastLocal));
                    Bounds?nullable = spot.Internal_CalculateBounds(flag);
                    spot.SetBounds(flag2, !nullable.HasValue ? spot._bounds : nullable.Value, flag4);
                    spot.justAdded = false;
                    if (spot._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot._bounds));
                            }
                            flag3  = false;
                            bounds = spot._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            if (Rect.any)
            {
                for (int j = 0; j < Rect.count; j++)
                {
                    UIRectHotSpot spot2 = Rect.array[j];
                    transform       = spot2.transform;
                    spot2.lastWorld = spot2.toWorld;
                    spot2.toWorld   = transform.localToWorldMatrix;
                    spot2.lastLocal = spot2.toLocal;
                    spot2.toLocal   = transform.worldToLocalMatrix;
                    flag2           = !(flag4 = !spot2.justAdded) || !(flag4 = MatrixEquals(ref spot2.toWorld, ref spot2.lastWorld));
                    flag            = spot2.justAdded || (!spot2.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot2.toLocal, ref spot2.lastLocal));
                    Bounds?nullable3 = spot2.Internal_CalculateBounds(flag);
                    spot2.SetBounds(flag2, !nullable3.HasValue ? spot2._bounds : nullable3.Value, flag4);
                    spot2.justAdded = false;
                    if (spot2._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot2._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot2._bounds));
                            }
                            flag3  = false;
                            bounds = spot2._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            if (Convex.any)
            {
                for (int k = 0; k < Convex.count; k++)
                {
                    UIConvexHotSpot spot3 = Convex.array[k];
                    transform       = spot3.transform;
                    spot3.lastWorld = spot3.toWorld;
                    spot3.toWorld   = transform.localToWorldMatrix;
                    spot3.lastLocal = spot3.toLocal;
                    spot3.toLocal   = transform.worldToLocalMatrix;
                    flag2           = !(flag4 = !spot3.justAdded) || !(flag4 = MatrixEquals(ref spot3.toWorld, ref spot3.lastWorld));
                    flag            = spot3.justAdded || (!spot3.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot3.toLocal, ref spot3.lastLocal));
                    Bounds?nullable5 = spot3.Internal_CalculateBounds(flag);
                    spot3.SetBounds(flag2, !nullable5.HasValue ? spot3._bounds : nullable5.Value, flag4);
                    spot3.justAdded = false;
                    if (spot3._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot3._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot3._bounds));
                            }
                            flag3  = false;
                            bounds = spot3._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            if (Sphere.any)
            {
                for (int m = 0; m < Sphere.count; m++)
                {
                    UISphereHotSpot spot4 = Sphere.array[m];
                    transform       = spot4.transform;
                    spot4.lastWorld = spot4.toWorld;
                    spot4.toWorld   = transform.localToWorldMatrix;
                    spot4.lastLocal = spot4.toLocal;
                    spot4.toLocal   = transform.worldToLocalMatrix;
                    flag2           = !(flag4 = !spot4.justAdded) || !(flag4 = MatrixEquals(ref spot4.toWorld, ref spot4.lastWorld));
                    flag            = spot4.justAdded || (!spot4.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot4.toLocal, ref spot4.lastLocal));
                    Bounds?nullable7 = spot4.Internal_CalculateBounds(flag);
                    spot4.SetBounds(flag2, !nullable7.HasValue ? spot4._bounds : nullable7.Value, flag4);
                    spot4.justAdded = false;
                    if (spot4._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot4._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot4._bounds));
                            }
                            flag3  = false;
                            bounds = spot4._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            if (Box.any)
            {
                for (int n = 0; n < Box.count; n++)
                {
                    UIBoxHotSpot spot5 = Box.array[n];
                    transform       = spot5.transform;
                    spot5.lastWorld = spot5.toWorld;
                    spot5.toWorld   = transform.localToWorldMatrix;
                    spot5.lastLocal = spot5.toLocal;
                    spot5.toLocal   = transform.worldToLocalMatrix;
                    flag2           = !(flag4 = !spot5.justAdded) || !(flag4 = MatrixEquals(ref spot5.toWorld, ref spot5.lastWorld));
                    flag            = spot5.justAdded || (!spot5.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot5.toLocal, ref spot5.lastLocal));
                    Bounds?nullable9 = spot5.Internal_CalculateBounds(flag);
                    spot5.SetBounds(flag2, !nullable9.HasValue ? spot5._bounds : nullable9.Value, flag4);
                    spot5.justAdded = false;
                    if (spot5._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot5._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot5._bounds));
                            }
                            flag3  = false;
                            bounds = spot5._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            if (Brush.any)
            {
                for (int num7 = 0; num7 < Brush.count; num7++)
                {
                    UIBrushHotSpot spot6 = Brush.array[num7];
                    transform       = spot6.transform;
                    spot6.lastWorld = spot6.toWorld;
                    spot6.toWorld   = transform.localToWorldMatrix;
                    spot6.lastLocal = spot6.toLocal;
                    spot6.toLocal   = transform.worldToLocalMatrix;
                    flag2           = !(flag4 = !spot6.justAdded) || !(flag4 = MatrixEquals(ref spot6.toWorld, ref spot6.lastWorld));
                    flag            = spot6.justAdded || (!spot6.configuredInLocalSpace ? flag2 : !MatrixEquals(ref spot6.toLocal, ref spot6.lastLocal));
                    Bounds?nullable11 = spot6.Internal_CalculateBounds(flag);
                    spot6.SetBounds(flag2, !nullable11.HasValue ? spot6._bounds : nullable11.Value, flag4);
                    spot6.justAdded = false;
                    if (spot6._bounds.size != Vector3.zero)
                    {
                        if (!flag3)
                        {
                            bounds.Encapsulate(spot6._bounds);
                            if (--allCount == 0)
                            {
                                return(new Bounds?(bounds));
                            }
                        }
                        else
                        {
                            if (--allCount == 0)
                            {
                                return(new Bounds?(spot6._bounds));
                            }
                            flag3  = false;
                            bounds = spot6._bounds;
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(null);
                    }
                }
            }
            throw new InvalidOperationException("Something is messed up. this line should never execute.");
        }
Beispiel #3
0
        private static bool DoRaycast(Ray ray, out UIHotSpot.Hit hit, float dist)
        {
            float num;

            hit = UIHotSpot.Hit.invalid;
            UIHotSpot.Hit invalid  = UIHotSpot.Hit.invalid;
            bool          flag     = true;
            Vector3       origin   = ray.origin;
            int           allCount = UIHotSpot.Global.allCount;

            if (Circle.any)
            {
                for (int i = 0; i < Circle.count; i++)
                {
                    UICircleHotSpot spot = Circle.array[i];
                    if ((spot._bounds.Contains(origin) || (spot._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot.panel.InsideClippingRect(ray, lastStepFrame) && spot.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            if (Rect.any)
            {
                for (int j = 0; j < Rect.count; j++)
                {
                    UIRectHotSpot spot2 = Rect.array[j];
                    if ((spot2._bounds.Contains(origin) || (spot2._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot2.panel.InsideClippingRect(ray, lastStepFrame) && spot2.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            if (Convex.any)
            {
                for (int k = 0; k < Convex.count; k++)
                {
                    UIConvexHotSpot spot3 = Convex.array[k];
                    if ((spot3._bounds.Contains(origin) || (spot3._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot3.panel.InsideClippingRect(ray, lastStepFrame) && spot3.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            if (Sphere.any)
            {
                for (int m = 0; m < Sphere.count; m++)
                {
                    UISphereHotSpot spot4 = Sphere.array[m];
                    if ((spot4._bounds.Contains(origin) || (spot4._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot4.panel.InsideClippingRect(ray, lastStepFrame) && spot4.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            if (Box.any)
            {
                for (int n = 0; n < Box.count; n++)
                {
                    UIBoxHotSpot spot5 = Box.array[n];
                    if ((spot5._bounds.Contains(origin) || (spot5._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot5.panel.InsideClippingRect(ray, lastStepFrame) && spot5.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            if (Brush.any)
            {
                for (int num8 = 0; num8 < Brush.count; num8++)
                {
                    UIBrushHotSpot spot6 = Brush.array[num8];
                    if ((spot6._bounds.Contains(origin) || (spot6._bounds.IntersectRay(ray, out num) && (num < dist))) && ((spot6.panel.InsideClippingRect(ray, lastStepFrame) && spot6.RaycastRef(ray, ref invalid)) && (invalid.distance < dist)))
                    {
                        if (flag)
                        {
                            flag = false;
                        }
                        dist = invalid.distance;
                        hit  = invalid;
                        if (--allCount == 0)
                        {
                            return(true);
                        }
                    }
                    else if (--allCount == 0)
                    {
                        return(!flag);
                    }
                }
            }
            throw new InvalidOperationException("Something is messed up. this line should never execute.");
        }