548 lines
19 KiB
C#
548 lines
19 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 BFBFHWPaySDKManagerWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.BFHWPaySDKManager);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 11, 5, 4);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CheckStoreValid", _m_CheckStoreValid);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CheckStoreValidComplete", _m_CheckStoreValidComplete);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "QueryProductInfo", _m_QueryProductInfo);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "QueryProductComplete", _m_QueryProductComplete);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Pay", _m_Pay);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "PayComplete", _m_PayComplete);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ConsumePurchase", _m_ConsumePurchase);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ConsumeComplete", _m_ConsumeComplete);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "QueryUncompleteOrder", _m_QueryUncompleteOrder);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "QueryUncompleteOrderFinish", _m_QueryUncompleteOrderFinish);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "StoreValid", _g_get_StoreValid);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaPayCallback", _g_get_luaPayCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaQueryProductCallback", _g_get_luaQueryProductCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaQueryUncompleteOrderCallback", _g_get_luaQueryUncompleteOrderCallback);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "luaConsumeCallback", _g_get_luaConsumeCallback);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaPayCallback", _s_set_luaPayCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaQueryProductCallback", _s_set_luaQueryProductCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaQueryUncompleteOrderCallback", _s_set_luaQueryUncompleteOrderCallback);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "luaConsumeCallback", _s_set_luaConsumeCallback);
|
|
|
|
|
|
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.BFHWPaySDKManager();
|
|
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.BFHWPaySDKManager constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Init(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)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_CheckStoreValid(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
|
|
gen_to_be_invoked.CheckStoreValid( );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_CheckStoreValidComplete(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
bool _success = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
gen_to_be_invoked.CheckStoreValidComplete( _success );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_QueryProductInfo(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _productJson = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<int, string> _callback = translator.GetDelegate<System.Action<int, string>>(L, 3);
|
|
|
|
gen_to_be_invoked.QueryProductInfo( _productJson, _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_QueryProductComplete(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
bool _succ = LuaAPI.lua_toboolean(L, 2);
|
|
string _result = LuaAPI.lua_tostring(L, 3);
|
|
|
|
gen_to_be_invoked.QueryProductComplete( _succ, _result );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Pay(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _payType = LuaAPI.lua_tostring(L, 2);
|
|
string _productId = LuaAPI.lua_tostring(L, 3);
|
|
string _customMsg = LuaAPI.lua_tostring(L, 4);
|
|
System.Action<int, string> _callback = translator.GetDelegate<System.Action<int, string>>(L, 5);
|
|
|
|
gen_to_be_invoked.Pay( _payType, _productId, _customMsg, _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_PayComplete(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _code = LuaAPI.xlua_tointeger(L, 2);
|
|
string _result = LuaAPI.lua_tostring(L, 3);
|
|
|
|
gen_to_be_invoked.PayComplete( _code, _result );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ConsumePurchase(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _token = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<int> _callback = translator.GetDelegate<System.Action<int>>(L, 3);
|
|
|
|
gen_to_be_invoked.ConsumePurchase( _token, _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_ConsumeComplete(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
int _code = LuaAPI.xlua_tointeger(L, 2);
|
|
|
|
gen_to_be_invoked.ConsumeComplete( _code );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_QueryUncompleteOrder(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
System.Action<int, string> _callback = translator.GetDelegate<System.Action<int, string>>(L, 2);
|
|
|
|
gen_to_be_invoked.QueryUncompleteOrder( _callback );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_QueryUncompleteOrderFinish(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _result = LuaAPI.lua_tostring(L, 2);
|
|
|
|
gen_to_be_invoked.QueryUncompleteOrderFinish( _result );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_StoreValid(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.StoreValid);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaPayCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaPayCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaQueryProductCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaQueryProductCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaQueryUncompleteOrderCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaQueryUncompleteOrderCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_luaConsumeCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.luaConsumeCallback);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_luaPayCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaPayCallback = 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_luaQueryProductCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaQueryProductCallback = 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_luaQueryUncompleteOrderCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaQueryUncompleteOrderCallback = 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_luaConsumeCallback(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.BFHWPaySDKManager gen_to_be_invoked = (BF.BFHWPaySDKManager)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.luaConsumeCallback = translator.GetDelegate<System.Action<int>>(L, 2);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|