示例#1
0
        public static void GetEx(this ObjectTranslator t, RealStatePtr L, int index, out Core.Math.Bounds val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

            if (type == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathBounds_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Bounds");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.UnPack(buff, 0, out val))
                {
                    throw new Exception("unpack fail for Core.Math.Bounds");
                }
            }
            else if (type == LuaTypes.LUA_TTABLE)
            {
                PackUnpack.UnPack(t, L, index, out val);
            }
            else
            {
                val = (Core.Math.Bounds)t.objectCasters.GetCaster(typeof(Core.Math.Bounds))(L, index, null);
            }
        }
示例#2
0
        static int __CreateInstance(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
                if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <Core.Math.Vec3>(L, 2) && translator.Assignable <Core.Math.Vec3>(L, 3))
                {
                    Core.Math.Vec3 center; translator.Get(L, 2, out center);
                    Core.Math.Vec3 size; translator.Get(L, 3, out size);

                    Core.Math.Bounds __cl_gen_ret = new Core.Math.Bounds(center, size);
                    translator.PushCoreMathBounds(L, __cl_gen_ret);

                    return(1);
                }

                if (LuaAPI.lua_gettop(L) == 1)
                {
                    translator.PushCoreMathBounds(L, default(Core.Math.Bounds));
                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to Core.Math.Bounds constructor!"));
        }
示例#3
0
        public static bool UnPack(IntPtr buff, int offset, out Core.Math.Bounds field)
        {
            field = default(Core.Math.Bounds);

            return(true);
        }
示例#4
0
 public static bool Pack(IntPtr buff, int offset, Core.Math.Bounds field)
 {
     return(true);
 }
示例#5
0
 public static void UnPack(ObjectTranslator translator, RealStatePtr L, int idx, out Core.Math.Bounds val)
 {
     val = new Core.Math.Bounds();
     int top = LuaAPI.lua_gettop(L);
 }
示例#6
0
        public static void UpdateCoreMathBounds(this ObjectTranslator t, RealStatePtr L, int index, Core.Math.Bounds val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != CoreMathBounds_TypeID)
                {
                    throw new Exception("invalid userdata for Core.Math.Bounds");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!PackUnpack.Pack(buff, 0, val))
                {
                    throw new Exception("pack fail for Core.Math.Bounds ,value=" + val);
                }
            }
            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }
示例#7
0
        public static void PushCoreMathBounds(this ObjectTranslator t, RealStatePtr L, Core.Math.Bounds val)
        {
            if (CoreMathBounds_TypeID == -1)
            {
                bool is_first;
                CoreMathBounds_TypeID = t.getTypeId(L, typeof(Core.Math.Bounds), out is_first);
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 0, CoreMathBounds_TypeID);

            if (!PackUnpack.Pack(buff, 0, val))
            {
                throw new Exception("pack fail fail for Core.Math.Bounds ,value=" + val);
            }
        }