263 lines
8.6 KiB
C#
263 lines
8.6 KiB
C#
#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 BFAssetObjectBaseWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.AssetObjectBase);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 3, 6, 1);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Tick", _m_Tick);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Unload", _m_Unload);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnloadCountdown", _m_UnloadCountdown);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Id", _g_get_Id);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "AssetPath", _g_get_AssetPath);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "AssetType", _g_get_AssetType);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "RefCount", _g_get_RefCount);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "LoadStatus", _g_get_LoadStatus);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Asset", _g_get_Asset);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "LoadStatus", _s_set_LoadStatus);
|
|
|
|
|
|
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)
|
|
{
|
|
return LuaAPI.luaL_error(L, "BF.AssetObjectBase does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Tick(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = gen_to_be_invoked.Tick( );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Unload(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
bool _immediately = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
var gen_ret = gen_to_be_invoked.Unload( _immediately );
|
|
LuaAPI.lua_pushboolean(L, gen_ret);
|
|
|
|
|
|
|
|
return 1;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_UnloadCountdown(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
bool _immediately = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
gen_to_be_invoked.UnloadCountdown( _immediately );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Id(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushuint(L, gen_to_be_invoked.Id);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_AssetPath(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.AssetPath);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_AssetType(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.AssetType);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_RefCount(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushuint(L, gen_to_be_invoked.RefCount);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_LoadStatus(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.LoadStatus);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Asset(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Asset);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_LoadStatus(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetObjectBase gen_to_be_invoked = (BF.AssetObjectBase)translator.FastGetCSObj(L, 1);
|
|
BF.EAssetLoadStatus gen_value;translator.Get(L, 2, out gen_value);
|
|
gen_to_be_invoked.LoadStatus = gen_value;
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|