282 lines
9.0 KiB
C#
282 lines
9.0 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 BFBFLogWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.BFLog);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 6, 2, 2);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LogDebug", _m_LogDebug_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Log", _m_Log_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LogWarning", _m_LogWarning_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LogError", _m_LogError_xlua_st_);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LogAssert", _m_LogAssert_xlua_st_);
|
|
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "DEBUG_RESMGR", _g_get_DEBUG_RESMGR);
|
|
Utils.RegisterFunc(L, Utils.CLS_GETTER_IDX, "DEBUG_GAME_LAUNCH", _g_get_DEBUG_GAME_LAUNCH);
|
|
|
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "DEBUG_RESMGR", _s_set_DEBUG_RESMGR);
|
|
Utils.RegisterFunc(L, Utils.CLS_SETTER_IDX, "DEBUG_GAME_LAUNCH", _s_set_DEBUG_GAME_LAUNCH);
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
return LuaAPI.luaL_error(L, "BF.BFLog does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LogDebug_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count >= 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaTypes.LUA_TNONE == LuaAPI.lua_type(L, 3) || translator.Assignable<object>(L, 3)))
|
|
{
|
|
string _color = LuaAPI.lua_tostring(L, 1);
|
|
string _text = LuaAPI.lua_tostring(L, 2);
|
|
object[] _par = translator.GetParams<object>(L, 3);
|
|
|
|
BF.BFLog.LogDebug( _color, _text, _par );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count >= 3&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 1)&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING)&& (LuaTypes.LUA_TNONE == LuaAPI.lua_type(L, 4) || translator.Assignable<object>(L, 4)))
|
|
{
|
|
bool _condition = LuaAPI.lua_toboolean(L, 1);
|
|
string _color = LuaAPI.lua_tostring(L, 2);
|
|
string _text = LuaAPI.lua_tostring(L, 3);
|
|
object[] _par = translator.GetParams<object>(L, 4);
|
|
|
|
BF.BFLog.LogDebug( _condition, _color, _text, _par );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to BF.BFLog.LogDebug!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Log_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _text = LuaAPI.lua_tostring(L, 1);
|
|
object[] _par = translator.GetParams<object>(L, 2);
|
|
|
|
BF.BFLog.Log( _text, _par );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LogWarning_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _text = LuaAPI.lua_tostring(L, 1);
|
|
object[] _par = translator.GetParams<object>(L, 2);
|
|
|
|
BF.BFLog.LogWarning( _text, _par );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LogError_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
string _text = LuaAPI.lua_tostring(L, 1);
|
|
object[] _par = translator.GetParams<object>(L, 2);
|
|
|
|
BF.BFLog.LogError( _text, _par );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LogAssert_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
bool _val = LuaAPI.lua_toboolean(L, 1);
|
|
string _text = LuaAPI.lua_tostring(L, 2);
|
|
object[] _par = translator.GetParams<object>(L, 3);
|
|
|
|
var gen_ret = BF.BFLog.LogAssert( _val, _text, _par );
|
|
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 _g_get_DEBUG_RESMGR(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
LuaAPI.lua_pushboolean(L, BF.BFLog.DEBUG_RESMGR);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_DEBUG_GAME_LAUNCH(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
LuaAPI.lua_pushboolean(L, BF.BFLog.DEBUG_GAME_LAUNCH);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_DEBUG_RESMGR(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
BF.BFLog.DEBUG_RESMGR = LuaAPI.lua_toboolean(L, 1);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_DEBUG_GAME_LAUNCH(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
BF.BFLog.DEBUG_GAME_LAUNCH = LuaAPI.lua_toboolean(L, 1);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|