예제 #1
0
        public void PushResourcePrioritizedCacheLoadPriority(RealStatePtr L, ResourcePrioritizedCache.LoadPriority val)
        {
            if (ResourcePrioritizedCacheLoadPriority_TypeID == -1)
            {
                bool is_first;
                ResourcePrioritizedCacheLoadPriority_TypeID = getTypeId(L, typeof(ResourcePrioritizedCache.LoadPriority), out is_first);

                if (ResourcePrioritizedCacheLoadPriority_EnumRef == -1)
                {
                    Utils.LoadCSTable(L, typeof(ResourcePrioritizedCache.LoadPriority));
                    ResourcePrioritizedCacheLoadPriority_EnumRef = LuaAPI.luaL_ref(L, LuaIndexes.LUA_REGISTRYINDEX);
                }
            }

            if (LuaAPI.xlua_tryget_cachedud(L, (int)val, ResourcePrioritizedCacheLoadPriority_EnumRef) == 1)
            {
                return;
            }

            IntPtr buff = LuaAPI.xlua_pushstruct(L, 4, ResourcePrioritizedCacheLoadPriority_TypeID);

            if (!CopyByValue.Pack(buff, 0, (int)val))
            {
                throw new Exception("pack fail fail for ResourcePrioritizedCache.LoadPriority ,value=" + val);
            }

            LuaAPI.lua_getref(L, ResourcePrioritizedCacheLoadPriority_EnumRef);
            LuaAPI.lua_pushvalue(L, -2);
            LuaAPI.xlua_rawseti(L, -2, (int)val);
            LuaAPI.lua_pop(L, 1);
        }
예제 #2
0
        public void Get(RealStatePtr L, int index, out ResourcePrioritizedCache.LoadPriority val)
        {
            LuaTypes type = LuaAPI.lua_type(L, index);

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

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                int    e;
                if (!CopyByValue.UnPack(buff, 0, out e))
                {
                    throw new Exception("unpack fail for ResourcePrioritizedCache.LoadPriority");
                }
                val = (ResourcePrioritizedCache.LoadPriority)e;
            }
            else
            {
                val = (ResourcePrioritizedCache.LoadPriority)objectCasters.GetCaster(typeof(ResourcePrioritizedCache.LoadPriority))(L, index, null);
            }
        }
예제 #3
0
        public void UpdateResourcePrioritizedCacheLoadPriority(RealStatePtr L, int index, ResourcePrioritizedCache.LoadPriority val)
        {
            if (LuaAPI.lua_type(L, index) == LuaTypes.LUA_TUSERDATA)
            {
                if (LuaAPI.xlua_gettypeid(L, index) != ResourcePrioritizedCacheLoadPriority_TypeID)
                {
                    throw new Exception("invalid userdata for ResourcePrioritizedCache.LoadPriority");
                }

                IntPtr buff = LuaAPI.lua_touserdata(L, index);
                if (!CopyByValue.Pack(buff, 0, (int)val))
                {
                    throw new Exception("pack fail for ResourcePrioritizedCache.LoadPriority ,value=" + val);
                }
            }

            else
            {
                throw new Exception("try to update a data with lua type:" + LuaAPI.lua_type(L, index));
            }
        }