#if USE_UNI_LUA using LuaAPI = UniLua.Lua; using RealStatePtr = UniLua.ILuaState; using LuaCSFunction = UniLua.CSharpFunctionDelegate; #else using LuaAPI = XLua.LuaDLL.Lua; using RealStatePtr = System.IntPtr; using LuaCSFunction = XLua.LuaDLL.lua_CSFunction; #endif using XLua; using System.Collections.Generic; namespace XLua.CSObjectWrap { using Utils = XLua.Utils; public class PetBackpackWrap { public static void __Register(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(PetBackpack); Utils.BeginObjectRegister(type, L, translator, 0, 0, 5, 5); Utils.RegisterFunc(L, Utils.GETTER_IDX, "PetClass", _g_get_PetClass); Utils.RegisterFunc(L, Utils.GETTER_IDX, "PetStatus", _g_get_PetStatus); Utils.RegisterFunc(L, Utils.GETTER_IDX, "ItemPlace", _g_get_ItemPlace); Utils.RegisterFunc(L, Utils.GETTER_IDX, "PetSkill", _g_get_PetSkill); Utils.RegisterFunc(L, Utils.GETTER_IDX, "petExp", _g_get_petExp); Utils.RegisterFunc(L, Utils.SETTER_IDX, "PetClass", _s_set_PetClass); Utils.RegisterFunc(L, Utils.SETTER_IDX, "PetStatus", _s_set_PetStatus); Utils.RegisterFunc(L, Utils.SETTER_IDX, "ItemPlace", _s_set_ItemPlace); Utils.RegisterFunc(L, Utils.SETTER_IDX, "PetSkill", _s_set_PetSkill); Utils.RegisterFunc(L, Utils.SETTER_IDX, "petExp", _s_set_petExp); Utils.EndObjectRegister(type, L, translator, null, null, null, null, null); Utils.BeginClassRegister(type, L, __CreateInstance, 1, 0, 0); Utils.EndClassRegister(type, L, translator); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if(LuaAPI.lua_gettop(L) == 1) { PetBackpack gen_ret = new PetBackpack(); translator.Push(L, gen_ret); return 1; } } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return LuaAPI.luaL_error(L, "invalid arguments to PetBackpack constructor!"); } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_PetClass(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.PetClass); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_PetStatus(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.PetStatus); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_ItemPlace(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.ItemPlace); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_PetSkill(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.PetSkill); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _g_get_petExp(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.petExp); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 1; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_PetClass(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); gen_to_be_invoked.PetClass = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_PetStatus(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); gen_to_be_invoked.PetStatus = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_ItemPlace(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); gen_to_be_invoked.ItemPlace = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_PetSkill(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); gen_to_be_invoked.PetSkill = (int[])translator.GetObject(L, 2, typeof(int[])); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] static int _s_set_petExp(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); PetBackpack gen_to_be_invoked = (PetBackpack)translator.FastGetCSObj(L, 1); gen_to_be_invoked.petExp = LuaAPI.xlua_tointeger(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } return 0; } } }