static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <UnityEngine.Vector2>(L, 2) && translator.Assignable <UnityEngine.Vector2>(L, 3))
                {
                    UnityEngine.Vector2 origin; translator.Get(L, 2, out origin);
                    UnityEngine.Vector2 direction; translator.Get(L, 3, out direction);

                    UnityEngine.Ray2D __cl_gen_ret = new UnityEngine.Ray2D(origin, direction);
                    translator.PushUnityEngineRay2D(L, __cl_gen_ret);

                    return(1);
                }

                if (LuaAPI.lua_gettop(L) == 1)
                {
                    translator.PushUnityEngineRay2D(L, default(UnityEngine.Ray2D));
                    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.Ray2D constructor!"));
        }
        public void Get(RealStatePtr L, int index, out UnityEngine.Ray2D val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay2D_TypeID)
                {
                    throw new Exception("invalid userdata for UnityEngine.Ray2D");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index); if (!CopyByValue.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for UnityEngine.Ray2D");
                }
            }
            else if (type == LuaTypes.LUA_TTABLE)
            {
                CopyByValue.UnPack(this, L, index, out val);
            }
            else
            {
                val = (UnityEngine.Ray2D)objectCasters.GetCaster(typeof(UnityEngine.Ray2D))(L, index, null);
            }
        }
        static object PerformMemberwiseClone(ref object o)
        {
            var ins = new UnityEngine.Ray2D();

            ins = (UnityEngine.Ray2D)o;
            return(ins);
        }
Beispiel #4
0
        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, 2);

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

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


            var result_of_this_method = new UnityEngine.Ray2D(@origin, @direction);

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

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
Beispiel #5
0
        public static bool Pack(IntPtr buff, int offset, UnityEngine.Ray2D field)
        {
            if (!Pack(buff, offset, field.origin))
            {
                return(false);
            }

            if (!Pack(buff, offset + 8, field.direction))
            {
                return(false);
            }

            return(true);
        }
        public void PushUnityEngineRay2D(RealStatePtr L, UnityEngine.Ray2D val)
        {
            if (UnityEngineRay2D_TypeID == -1)
            {
                bool is_first;
                UnityEngineRay2D_TypeID = getTypeId(L, typeof(UnityEngine.Ray2D), out is_first);
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 16, UnityEngineRay2D_TypeID);

            if (!CopyByValue.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for UnityEngine.Ray2D ,value=" + val);
            }
        }
        static void WriteBackInstance(CSHotFix.Runtime.Enviorment.AppDomain __domain, StackObject *ptr_of_this_method, IList <object> __mStack, ref UnityEngine.Ray2D 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.Ray2D[];
                instance_of_arrayReference[ptr_of_this_method->ValueLow] = instance_of_this_method;
            }
            break;
            }
        }
Beispiel #8
0
        static StackObject *ToString_5(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.Ray2D instance_of_this_method = (UnityEngine.Ray2D) typeof(UnityEngine.Ray2D).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.ToString();

            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));
        }
        public void UpdateUnityEngineRay2D(RealStatePtr L, int index, UnityEngine.Ray2D val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != UnityEngineRay2D_TypeID)
                {
                    throw new Exception("invalid userdata for UnityEngine.Ray2D");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0, val))
                {
                    throw new Exception("pack fail for UnityEngine.Ray2D ,value=" + val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
Beispiel #10
0
        public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out UnityEngine.Ray2D val)
        {
            val = new UnityEngine.Ray2D();
            int top = LuaAPI.lua_gettop(L);

            if (XUtils.LoadField(L, idx, "origin"))
            {
                var origin = val.origin;
                translator.Get(L, top + 1, out origin);
                val.origin = origin;
            }
            LuaAPI.lua_pop(L, 1);

            if (XUtils.LoadField(L, idx, "direction"))
            {
                var direction = val.direction;
                translator.Get(L, top + 1, out direction);
                val.direction = direction;
            }
            LuaAPI.lua_pop(L, 1);
        }
Beispiel #11
0
        public static bool UnPack(IntPtr buff, int offset, out UnityEngine.Ray2D field)
        {
            field = default(UnityEngine.Ray2D);

            var origin = field.origin;

            if (!UnPack(buff, offset, out origin))
            {
                return(false);
            }
            field.origin = origin;

            var direction = field.direction;

            if (!UnPack(buff, offset + 8, out direction))
            {
                return(false);
            }
            field.direction = direction;

            return(true);
        }
Beispiel #12
0
        static StackObject *set_direction_3(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.Vector2 @value = (UnityEngine.Vector2) typeof(UnityEngine.Vector2).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.Ray2D instance_of_this_method = (UnityEngine.Ray2D) typeof(UnityEngine.Ray2D).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            instance_of_this_method.direction = 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);
        }
Beispiel #13
0
        int __CreateInstanceUnityEngineRay2D(RealStatePtr L, int gen_param_count)
        {
            ObjectTranslator translator = this;

            if (gen_param_count == 3 && translator.Assignable <UnityEngine.Vector2>(L, 2) && translator.Assignable <UnityEngine.Vector2>(L, 3))
            {
                UnityEngine.Vector2 _origin; translator.Get(L, 2, out _origin);
                UnityEngine.Vector2 _direction; translator.Get(L, 3, out _direction);

                UnityEngine.Ray2D gen_ret = new UnityEngine.Ray2D(_origin, _direction);
                translator.PushUnityEngineRay2D(L, gen_ret);

                return(1);
            }

            if (gen_param_count == 1)
            {
                translator.PushUnityEngineRay2D(L, default(UnityEngine.Ray2D));
                return(1);
            }


            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Ray2D constructor!"));
        }