499 lines
17 KiB
C#
499 lines
17 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 BFBFHWAdSDKManagerWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.BFHWAdSDKManager);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 9, 5, 5);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ShowFullScreenAds", _m_ShowFullScreenAds);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "TryLoadRewardedAd", _m_TryLoadRewardedAd);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetAdShowCallback", _m_SetAdShowCallback);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetAdLoadedCallback", _m_SetAdLoadedCallback);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetAdEarnedRewardCallback", _m_SetAdEarnedRewardCallback);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ShowFullScreenAdFinish", _m_ShowFullScreenAdFinish);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "AdLoadedFinish", _m_AdLoadedFinish);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "EarnedRewardFinish", _m_EarnedRewardFinish);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaShowCallback", _g_get_luaShowCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaLoadedCallback", _g_get_luaLoadedCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaEarnedRewardCallback", _g_get_luaEarnedRewardCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "AdLoaded", _g_get_AdLoaded);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "AdInitialized", _g_get_AdInitialized);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaShowCallback", _s_set_luaShowCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaLoadedCallback", _s_set_luaLoadedCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaEarnedRewardCallback", _s_set_luaEarnedRewardCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "AdLoaded", _s_set_AdLoaded);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "AdInitialized", _s_set_AdInitialized);
|
|
|
|
|
|
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)
|
|
{
|
|
|
|
var gen_ret = new BF.BFHWAdSDKManager();
|
|
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 BF.BFHWAdSDKManager constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Init(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.Init( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ShowFullScreenAds(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.ShowFullScreenAds( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_TryLoadRewardedAd(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.TryLoadRewardedAd( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetAdShowCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
System.Action<int> _callback = translator.GetDelegate<System.Action<int>>(L, 2);
|
|
|
|
gen_to_be_invoked.SetAdShowCallback( _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetAdLoadedCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
System.Action<int> _callback = translator.GetDelegate<System.Action<int>>(L, 2);
|
|
|
|
gen_to_be_invoked.SetAdLoadedCallback( _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_SetAdEarnedRewardCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
System.Action<int, string> _callback = translator.GetDelegate<System.Action<int, string>>(L, 2);
|
|
|
|
gen_to_be_invoked.SetAdEarnedRewardCallback( _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ShowFullScreenAdFinish(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _code = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
gen_to_be_invoked.ShowFullScreenAdFinish( _code );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_AdLoadedFinish(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _code = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
gen_to_be_invoked.AdLoadedFinish( _code );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_EarnedRewardFinish(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _code = LuaAPI.xlua_tointeger(L, 2);
|
|
string _result = LuaAPI.lua_tostring(L, 3);
|
|
|
|
gen_to_be_invoked.EarnedRewardFinish( _code, _result );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaShowCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaShowCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaLoadedCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaLoadedCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaEarnedRewardCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaEarnedRewardCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_AdLoaded(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.AdLoaded);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_AdInitialized(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.AdInitialized);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_luaShowCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaShowCallback = translator.GetDelegate<System.Action<int>>(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_luaLoadedCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaLoadedCallback = translator.GetDelegate<System.Action<int>>(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_luaEarnedRewardCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaEarnedRewardCallback = translator.GetDelegate<System.Action<int, string>>(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_AdLoaded(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.AdLoaded = LuaAPI.lua_toboolean(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_AdInitialized(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWAdSDKManager gen_to_be_invoked = (BF.BFHWAdSDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.AdInitialized = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|