615 lines
21 KiB
C#
615 lines
21 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 BFAssetBundleLoaderWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(BF.AssetBundleLoader);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 15, 2, 0);
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadAssetAsync", _m_LoadAssetAsync);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadDependBundleAsync", _m_LoadDependBundleAsync);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadBundleAsync", _m_LoadBundleAsync);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadAssetSync", _m_LoadAssetSync);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "LoadDependBundleSync", _m_LoadDependBundleSync);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Unload", _m_Unload);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnLoadBundle", _m_UnLoadBundle);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "RemoveCache", _m_RemoveCache);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Tick", _m_Tick);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "UnloadAllDelayAssets", _m_UnloadAllDelayAssets);
|
|
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, "Clear", _m_Clear);
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "ContainsAsset", _m_ContainsAsset);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Config", _g_get_Config);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "Manifest", _g_get_Manifest);
|
|
|
|
|
|
|
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|
null, null, null);
|
|
|
|
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
|
|
|
|
|
|
Utils.RegisterObject(L, translator, Utils.CLS_IDX, "MAX_LOADING", BF.AssetBundleLoader.MAX_LOADING);
|
|
|
|
|
|
|
|
|
|
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.AssetBundleLoader();
|
|
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.AssetBundleLoader constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LoadAssetAsync(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.LoadAssetAsync( _assetObject );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Type>(L, 3)&& translator.Assignable<System.Action<string, UnityEngine.Object>>(L, 4))
|
|
{
|
|
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);
|
|
}
|
|
|
|
return LuaAPI.luaL_error(L, "invalid arguments to BF.AssetBundleLoader.LoadAssetAsync!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LoadDependBundleAsync(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _bundlePath = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<BF.AssetBundleObject> _complete = translator.GetDelegate<System.Action<BF.AssetBundleObject>>(L, 3);
|
|
|
|
gen_to_be_invoked.LoadDependBundleAsync( _bundlePath, _complete );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LoadBundleAsync(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _bundlePath = LuaAPI.lua_tostring(L, 2);
|
|
System.Action<BF.AssetBundleObject> _complete = translator.GetDelegate<System.Action<BF.AssetBundleObject>>(L, 3);
|
|
|
|
gen_to_be_invoked.LoadBundleAsync( _bundlePath, _complete );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} 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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.AssetBundleLoader.LoadAssetSync!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_LoadDependBundleSync(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
string _bundlePath = LuaAPI.lua_tostring(L, 2);
|
|
|
|
gen_to_be_invoked.LoadDependBundleSync( _bundlePath );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_Unload(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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_UnLoadBundle(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
|
|
if(gen_param_count == 3&& translator.Assignable<BF.AssetObject>(L, 2)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3))
|
|
{
|
|
BF.AssetObject _assetObject = (BF.AssetObject)translator.GetObject(L, 2, typeof(BF.AssetObject));
|
|
bool _immediately = LuaAPI.lua_toboolean(L, 3);
|
|
|
|
gen_to_be_invoked.UnLoadBundle( _assetObject, _immediately );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 3&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3))
|
|
{
|
|
string _assetBundlePath = LuaAPI.lua_tostring(L, 2);
|
|
bool _immediately = LuaAPI.lua_toboolean(L, 3);
|
|
|
|
gen_to_be_invoked.UnLoadBundle( _assetBundlePath, _immediately );
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
if(gen_param_count == 4&& (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)&& LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 3)&& translator.Assignable<System.Action>(L, 4))
|
|
{
|
|
string _assetBundlePath = LuaAPI.lua_tostring(L, 2);
|
|
bool _immediately = LuaAPI.lua_toboolean(L, 3);
|
|
System.Action _unloadCallback = translator.GetDelegate<System.Action>(L, 4);
|
|
|
|
gen_to_be_invoked.UnLoadBundle( _assetBundlePath, _immediately, _unloadCallback );
|
|
|
|
|
|
|
|
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.AssetBundleLoader.UnLoadBundle!");
|
|
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _m_RemoveCache(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
|
|
|
|
|
|
{
|
|
BF.AssetBundleObject _abo = (BF.AssetBundleObject)translator.GetObject(L, 2, typeof(BF.AssetBundleObject));
|
|
|
|
gen_to_be_invoked.RemoveCache( _abo );
|
|
|
|
|
|
|
|
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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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_GetSceneLoadPath(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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_Clear(RealStatePtr L)
|
|
{
|
|
try {
|
|
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Config(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Config);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_Manifest(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
BF.AssetBundleLoader gen_to_be_invoked = (BF.AssetBundleLoader)translator.FastGetCSObj(L, 1);
|
|
translator.Push(L, gen_to_be_invoked.Manifest);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|