static StackObject *SetMinMax_25(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Vector2Int @maxPosition = (UnityEngine.Vector2Int) typeof(UnityEngine.Vector2Int).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector2Int @minPosition = (UnityEngine.Vector2Int) typeof(UnityEngine.Vector2Int).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.RectInt instance_of_this_method = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.SetMinMax(@minPosition, @maxPosition);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(__ret);
        }
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @height = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 @width = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @yMin = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            System.Int32 @xMin = ptr_of_this_method->Value;


            var result_of_this_method = new UnityEngine.RectInt(@xMin, @yMin, @width, @height);

            if (!isNewObj)
            {
                __ret--;
                WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
                return(__ret);
            }

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 3
0
 public static bool Contains(this Rectangle lhs, Rectangle value)
 {
     return((lhs.x <= value.x) &&
            ((value.x + value.width) <= (lhs.x + lhs.width)) &&
            (lhs.x <= value.y) &&
            ((value.y + value.height) <= (lhs.y + lhs.height)));
 }
        static StackObject *Ctor_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Vector2Int @size = (UnityEngine.Vector2Int) typeof(UnityEngine.Vector2Int).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Vector2Int @position = (UnityEngine.Vector2Int) typeof(UnityEngine.Vector2Int).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);


            var result_of_this_method = new UnityEngine.RectInt(@position, @size);

            if (!isNewObj)
            {
                __ret--;
                WriteBackInstance(__domain, __ret, __mStack, ref result_of_this_method);
                return(__ret);
            }

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get the objects in this tree that intersect with the specified rectangle.
        /// </summary>
        /// <param name="searchRect">The rectangle to find objects in.</param>
        internal List <T> getObjects(Rectangle searchRect)
        {
            var results = new List <T>();

            getObjects(searchRect, ref results);
            return(results);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get the objects in this tree that intersect with the specified rectangle.
        /// </summary>
        /// <param name="searchRect">The rectangle to find objects in.</param>
        /// <param name="results">A reference to a list that will be populated with the results.</param>
        internal void getObjects(Rectangle searchRect, ref List <T> results)
        {
            // We can't do anything if the results list doesn't exist
            if (results != null)
            {
                if (searchRect.Contains(this._rect))
                {
                    // If the search area completely contains this quad, just get every object this quad and all it's children have
                    getAllObjects(ref results);
                }
                else if (searchRect.Intersects(this._rect))
                {
                    // Otherwise, if the quad isn't fully contained, only add objects that intersect with the search rectangle
                    if (_objects != null)
                    {
                        for (int i = 0; i < _objects.Count; i++)
                        {
                            if (searchRect.Intersects(_objects[i].data.bounds))
                            {
                                results.Add(_objects[i].data);
                            }
                        }
                    }

                    // Get the objects for the search rectangle from the children
                    if (_childTL != null)
                    {
                        _childTL.getObjects(searchRect, ref results);
                        _childTR.getObjects(searchRect, ref results);
                        _childBL.getObjects(searchRect, ref results);
                        _childBR.getObjects(searchRect, ref results);
                    }
                }
            }
        }
        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new UnityEngine.RectInt();

            ins = (UnityEngine.RectInt)o;
            return(ins);
        }
Exemplo n.º 8
0
 public static bool Intersects(this Rectangle lhs, Rectangle value)
 {
     return(value.Left() < lhs.Right() &&
            lhs.Left() < value.Right() &&
            value.Top() < lhs.Bottom() &&
            lhs.Top() < value.Bottom());
 }
Exemplo n.º 9
0
 public static void DrawOcclusionMesh(CommandBuffer cmd, Camera camera, bool stereoEnabled = true) // Optional stereoEnabled is for SRP-specific stereo logic
 {
     if ((!XRGraphics.enabled) || (!camera.stereoEnabled) || (!stereoEnabled))
     {
         return;
     }
     UnityEngine.RectInt normalizedCamViewport = new UnityEngine.RectInt(0, 0, camera.pixelWidth, camera.pixelHeight);
     cmd.DrawOcclusionMesh(normalizedCamViewport);
 }
Exemplo n.º 10
0
        public static void DrawOcclusionMesh(CommandBuffer cmd, Camera camera, bool stereoEnabled = true) // Optional stereoEnabled is for SRP-specific stereo logic
        {                                                                                                 // This method expects XRGraphicsConfig.SetConfig() to have been called prior to it.
            // Then, engine code will check if occlusion mesh rendering is enabled, and apply occlusion mesh scale.
#if UNITY_2019_1_OR_NEWER
            if ((!XRGraphicsConfig.enabled) || (!camera.stereoEnabled) || (!stereoEnabled))
            {
                return;
            }
            UnityEngine.RectInt normalizedCamViewport = new UnityEngine.RectInt(0, 0, camera.pixelWidth, camera.pixelHeight);
            cmd.DrawOcclusionMesh(normalizedCamViewport);
#endif
        }
        static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.RectInt instance_of_this_method)
        {
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            switch (ptr_of_this_method->ObjectType)
            {
            case ObjectTypes.Object:
            {
                __mStack[ptr_of_this_method->Value] = instance_of_this_method;
            }
            break;

            case ObjectTypes.FieldReference:
            {
                var ___obj = __mStack[ptr_of_this_method->Value];
                if (___obj is ILTypeInstance)
                {
                    ((ILTypeInstance)___obj)[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    var t = __domain.GetType(___obj.GetType()) as CLRType;
                    t.SetFieldValue(ptr_of_this_method->ValueLow, ref ___obj, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.StaticFieldReference:
            {
                var t = __domain.GetType(ptr_of_this_method->Value);
                if (t is ILType)
                {
                    ((ILType)t).StaticInstance[ptr_of_this_method->ValueLow] = instance_of_this_method;
                }
                else
                {
                    ((CLRType)t).SetStaticFieldValue(ptr_of_this_method->ValueLow, instance_of_this_method);
                }
            }
            break;

            case ObjectTypes.ArrayReference:
            {
                var instance_of_arrayReference = __mStack[ptr_of_this_method->Value] as UnityEngine.RectInt[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
Exemplo n.º 12
0
        static private void Serialize_RectInt(ref SerializedType ioData, Serializer ioSerializer)
        {
            int x = ioData.x, y = ioData.y, width = ioData.width, height = ioData.height;

            ioSerializer.Serialize("x", ref x, FieldOptions.PreferAttribute);
            ioSerializer.Serialize("y", ref y, FieldOptions.PreferAttribute);
            ioSerializer.Serialize("w", ref width, FieldOptions.PreferAttribute);
            ioSerializer.Serialize("h", ref height, FieldOptions.PreferAttribute);

            if (ioSerializer.IsReading)
            {
                ioData.x      = x;
                ioData.y      = y;
                ioData.width  = width;
                ioData.height = height;
            }
        }
        static StackObject *get_allPositionsWithin_30(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.RectInt instance_of_this_method = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.allPositionsWithin;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
        static StackObject *get_yMax_19(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.RectInt instance_of_this_method = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.yMax;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method;
            return(__ret + 1);
        }
Exemplo n.º 15
0
        static StackObject *ClampToBounds_26(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.RectInt @bounds = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.RectInt instance_of_this_method;
            instance_of_this_method = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.ClampToBounds(@bounds);

            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            return(__ret);
        }
        static StackObject *set_yMax_20(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @value = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            UnityEngine.RectInt instance_of_this_method = (UnityEngine.RectInt) typeof(UnityEngine.RectInt).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.yMax = value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            return(__ret);
        }
Exemplo n.º 17
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 5 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
                {
                    int _xMin   = LuaAPI.xlua_tointeger(L, 2);
                    int _yMin   = LuaAPI.xlua_tointeger(L, 3);
                    int _width  = LuaAPI.xlua_tointeger(L, 4);
                    int _height = LuaAPI.xlua_tointeger(L, 5);

                    UnityEngine.RectInt gen_ret = new UnityEngine.RectInt(_xMin, _yMin, _width, _height);
                    translator.Push(L, gen_ret);

                    return(1);
                }
                if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <UnityEngine.Vector2Int>(L, 2) && translator.Assignable <UnityEngine.Vector2Int>(L, 3))
                {
                    UnityEngine.Vector2Int _position; translator.Get(L, 2, out _position);
                    UnityEngine.Vector2Int _size; translator.Get(L, 3, out _size);

                    UnityEngine.RectInt gen_ret = new UnityEngine.RectInt(_position, _size);
                    translator.Push(L, gen_ret);

                    return(1);
                }

                if (LuaAPI.lua_gettop(L) == 1)
                {
                    translator.Push(L, default(UnityEngine.RectInt));
                    return(1);
                }
            }
            catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.RectInt constructor!"));
        }
Exemplo n.º 18
0
 public static int Bottom(this Rectangle r)
 {
     return(r.y + r.height);
 }
Exemplo n.º 19
0
 public static int Top(this Rectangle r)
 {
     return(r.y);
 }
Exemplo n.º 20
0
 public static int Right(this Rectangle r)
 {
     return(r.x + r.width);
 }
Exemplo n.º 21
0
 public static int Left(this Rectangle r)
 {
     return(r.x);
 }
Exemplo n.º 22
0
 QuadTreeNode(QuadTreeNode <T> parent, Rectangle rect) : this( rect )
 {
     _parent = parent;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Creates a QuadTree for the specified area.
 /// </summary>
 /// <param name="x">The top-left position of the area rectangle.</param>
 /// <param name="y">The top-right position of the area rectangle.</param>
 /// <param name="width">The width of the area rectangle.</param>
 /// <param name="height">The height of the area rectangle.</param>
 public QuadTreeNode(int x, int y, int width, int height)
 {
     _rect = new Rectangle(x, y, width, height);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Creates a QuadTree for the specified area.
 /// </summary>
 /// <param name="rect">The area this QuadTree object will encompass.</param>
 public QuadTreeNode(Rectangle rect)
 {
     _rect = rect;
 }
Exemplo n.º 25
0
 public void Serialize(string inKey, ref UnityEngine.RectInt ioData, FieldOptions inOptions = FieldOptions.None)
 {
     DoStruct <UnityEngine.RectInt>(inKey, ref ioData, inOptions,
                                    Serialize_RectInt_Cached ?? (Serialize_RectInt_Cached = Serialize_RectInt));
 }
Exemplo n.º 26
0
 public void Serialize(string inKey, ref SerializedType ioData, SerializedType inDefault, FieldOptions inOptions = FieldOptions.None)
 {
     DoStruct <SerializedType>(inKey, ref ioData, inDefault, inOptions, Serialize_RectInt);
 }
Exemplo n.º 27
0
 public override UnityEngine.RectInt Fill(UnityEngine.RectInt area, float difficulty)
 {
     return(_obstacles[_random.Next(0, _obstacles.Length)].Fill(area, difficulty));
 }