326 lines
12 KiB
C#
326 lines
12 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 BFBFWebRequestManagerWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.BFWebRequestManager);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 6, 0, 0);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "SetMono", _m_SetMono);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Init", _m_Init);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "CreateWebRequest", _m_CreateWebRequest);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Get", _m_Get);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Post", _m_Post);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "PostForm", _m_PostForm);
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
|
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Create", _m_Create_xlua_st_);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Utils.EndClassRegister(type, L, translator);
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int __CreateInstance(RealStatePtr L)
|
|
{
|
|
return LuaAPI.luaL_error(L, "BF.BFWebRequestManager does not have a constructor!");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Create_xlua_st_(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
var gen_ret = BF.BFWebRequestManager.Create( );
|
|
translator.Push(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_SetMono(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
UnityEngine.MonoBehaviour _mono = (UnityEngine.MonoBehaviour)translator.GetObject(L, 2, typeof(UnityEngine.MonoBehaviour));
|
|
|
|
gen_to_be_invoked.SetMono( _mono );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Init(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)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_CreateWebRequest(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
string _method = LuaAPI.lua_tostring(L, 3);
|
|
int _timeout = LuaAPI.xlua_tointeger(L, 4);
|
|
|
|
var gen_ret = gen_to_be_invoked.CreateWebRequest( _url, _method, _timeout );
|
|
translator.Push(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_Get(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 3)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 4))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 3);
|
|
int _timeout = LuaAPI.xlua_tointeger(L, 4);
|
|
|
|
gen_to_be_invoked.Get( _url, _callback, _timeout );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 3))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 3);
|
|
|
|
gen_to_be_invoked.Get( _url, _callback );
|
|
|
|
|
|
|
|
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.BFWebRequestManager.Get!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Post(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 5&& (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)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
string _fields = LuaAPI.lua_tostring(L, 3);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4);
|
|
int _timeout = LuaAPI.xlua_tointeger(L, 5);
|
|
|
|
gen_to_be_invoked.Post( _url, _fields, _callback, _timeout );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (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)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
string _fields = LuaAPI.lua_tostring(L, 3);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4);
|
|
|
|
gen_to_be_invoked.Post( _url, _fields, _callback );
|
|
|
|
|
|
|
|
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.BFWebRequestManager.Post!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_PostForm(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.BFWebRequestManager gen_to_be_invoked = (BF.BFWebRequestManager)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 5&& (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)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4)&& LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 5))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
string _fields = LuaAPI.lua_tostring(L, 3);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4);
|
|
int _timeout = LuaAPI.xlua_tointeger(L, 5);
|
|
|
|
gen_to_be_invoked.PostForm( _url, _fields, _callback, _timeout );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (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)&& translator.Assignable<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4))
|
|
{
|
|
string _url = LuaAPI.lua_tostring(L, 2);
|
|
string _fields = LuaAPI.lua_tostring(L, 3);
|
|
System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest> _callback = translator.GetDelegate<System.Action<BF.EDownloadCode, UnityEngine.Networking.UnityWebRequest>>(L, 4);
|
|
|
|
gen_to_be_invoked.PostForm( _url, _fields, _callback );
|
|
|
|
|
|
|
|
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.BFWebRequestManager.PostForm!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|