c1_unity/Assets/XLua/Gen/BF_AssetLoaderWrap.cs
2023-04-03 11:04:31 +08:00

395 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 BFAssetLoaderWrap
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(BF.AssetLoader);
Utils.BeginObjectRegister(type, L, translator, 0, 10, 0, 0);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadAssetAsync", _m_LoadAssetAsync);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadAssetSync", _m_LoadAssetSync);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Unload", _m_Unload);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetSceneLoadPath", _m_GetSceneLoadPath);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadSceneAsync", _m_LoadSceneAsync);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnloadScene", _m_UnloadScene);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Tick", _m_Tick);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnloadAllDelayAssets", _m_UnloadAllDelayAssets);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Clear", _m_Clear);
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ContainsAsset", _m_ContainsAsset);
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.AssetLoader();
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.AssetLoader constructor!");
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_LoadAssetAsync(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
string _assetPath = LuaAPI.lua_tostring(L, 2);
System.Type _type = (System.Type)translator.GetObject(L, 3, typeof(System.Type));
System.Action<string, UnityEngine.Object> _complete = translator.GetDelegate<System.Action<string, UnityEngine.Object>>(L, 4);
var gen_ret = gen_to_be_invoked.LoadAssetAsync( _assetPath, _type, _complete );
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_LoadAssetSync(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
int gen_param_count = LuaAPI.lua_gettop(L);
if(gen_param_count == 2&& translator.Assignable<BF.AssetObject>(L, 2))
{
BF.AssetObject _assetObject = (BF.AssetObject)translator.GetObject(L, 2, typeof(BF.AssetObject));
gen_to_be_invoked.LoadAssetSync( _assetObject );
return 0;
}
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Type>(L, 3))
{
string _assetPath = LuaAPI.lua_tostring(L, 2);
System.Type _type = (System.Type)translator.GetObject(L, 3, typeof(System.Type));
var gen_ret = gen_to_be_invoked.LoadAssetSync( _assetPath, _type );
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.AssetLoader.LoadAssetSync!");
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_Unload(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
BF.AssetObject _asset = (BF.AssetObject)translator.GetObject(L, 2, typeof(BF.AssetObject));
bool _immediately = LuaAPI.lua_toboolean(L, 3);
gen_to_be_invoked.Unload( _asset, _immediately );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_GetSceneLoadPath(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
string _assetBundlePath = LuaAPI.lua_tostring(L, 2);
var gen_ret = gen_to_be_invoked.GetSceneLoadPath( _assetBundlePath );
LuaAPI.lua_pushstring(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_LoadSceneAsync(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
string _assetBundlePath = LuaAPI.lua_tostring(L, 2);
System.Action<BF.AssetBundleObject> _complete = translator.GetDelegate<System.Action<BF.AssetBundleObject>>(L, 3);
gen_to_be_invoked.LoadSceneAsync( _assetBundlePath, _complete );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_UnloadScene(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
string _assetBundlePath = LuaAPI.lua_tostring(L, 2);
gen_to_be_invoked.UnloadScene( _assetBundlePath );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_Tick(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
gen_to_be_invoked.Tick( );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_UnloadAllDelayAssets(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
gen_to_be_invoked.UnloadAllDelayAssets( );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_Clear(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
gen_to_be_invoked.Clear( );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m_ContainsAsset(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
BF.AssetLoader gen_to_be_invoked = (BF.AssetLoader)translator.FastGetCSObj(L, 1);
{
string _assetPath = LuaAPI.lua_tostring(L, 2);
var gen_ret = gen_to_be_invoked.ContainsAsset( _assetPath );
LuaAPI.lua_pushboolean(L, gen_ret);
return 1;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
}
}