438 lines
15 KiB
C#
438 lines
15 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 UnityEngineResourcesWrap
|
|||
|
{
|
|||
|
public static void __Register(RealStatePtr L)
|
|||
|
{
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
System.Type type = typeof(UnityEngine.Resources);
|
|||
|
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Utils.EndObjectRegister(type, L, translator, null, null,
|
|||
|
null, null, null);
|
|||
|
|
|||
|
Utils.BeginClassRegister(type, L, __CreateInstance, 12, 0, 0);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "FindObjectsOfTypeAll", _m_FindObjectsOfTypeAll_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "Load", _m_Load_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LoadAsync", _m_LoadAsync_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "LoadAll", _m_LoadAll_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "GetBuiltinResource", _m_GetBuiltinResource_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "UnloadAsset", _m_UnloadAsset_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "UnloadUnusedAssets", _m_UnloadUnusedAssets_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "InstanceIDToObject", _m_InstanceIDToObject_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "InstanceIDToObjectList", _m_InstanceIDToObjectList_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "InstanceIDIsValid", _m_InstanceIDIsValid_xlua_st_);
|
|||
|
Utils.RegisterFunc(L, Utils.CLS_IDX, "InstanceIDsToValidArray", _m_InstanceIDsToValidArray_xlua_st_);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
Utils.EndClassRegister(type, L, translator);
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int __CreateInstance(RealStatePtr L)
|
|||
|
{
|
|||
|
|
|||
|
try {
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
if(LuaAPI.lua_gettop(L) == 1)
|
|||
|
{
|
|||
|
|
|||
|
UnityEngine.Resources gen_ret = new UnityEngine.Resources();
|
|||
|
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 UnityEngine.Resources constructor!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_FindObjectsOfTypeAll_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
System.Type _type = (System.Type)translator.GetObject(L, 1, typeof(System.Type));
|
|||
|
|
|||
|
UnityEngine.Object[] gen_ret = UnityEngine.Resources.FindObjectsOfTypeAll( _type );
|
|||
|
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_Load_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|||
|
|
|||
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
|
|||
|
UnityEngine.Object gen_ret = UnityEngine.Resources.Load( _path );
|
|||
|
translator.Push(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Type>(L, 2))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
System.Type _systemTypeInstance = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|||
|
|
|||
|
UnityEngine.Object gen_ret = UnityEngine.Resources.Load( _path, _systemTypeInstance );
|
|||
|
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 UnityEngine.Resources.Load!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_LoadAsync_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|||
|
|
|||
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
|
|||
|
UnityEngine.ResourceRequest gen_ret = UnityEngine.Resources.LoadAsync( _path );
|
|||
|
translator.Push(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Type>(L, 2))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|||
|
|
|||
|
UnityEngine.ResourceRequest gen_ret = UnityEngine.Resources.LoadAsync( _path, _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 UnityEngine.Resources.LoadAsync!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_LoadAll_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|||
|
|
|||
|
if(gen_param_count == 1&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
|
|||
|
UnityEngine.Object[] gen_ret = UnityEngine.Resources.LoadAll( _path );
|
|||
|
translator.Push(L, gen_ret);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 1;
|
|||
|
}
|
|||
|
if(gen_param_count == 2&& (LuaAPI.lua_isnil(L, 1) || LuaAPI.lua_type(L, 1) == LuaTypes.LUA_TSTRING)&& translator.Assignable<System.Type>(L, 2))
|
|||
|
{
|
|||
|
string _path = LuaAPI.lua_tostring(L, 1);
|
|||
|
System.Type _systemTypeInstance = (System.Type)translator.GetObject(L, 2, typeof(System.Type));
|
|||
|
|
|||
|
UnityEngine.Object[] gen_ret = UnityEngine.Resources.LoadAll( _path, _systemTypeInstance );
|
|||
|
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 UnityEngine.Resources.LoadAll!");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_GetBuiltinResource_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
System.Type _type = (System.Type)translator.GetObject(L, 1, typeof(System.Type));
|
|||
|
string _path = LuaAPI.lua_tostring(L, 2);
|
|||
|
|
|||
|
UnityEngine.Object gen_ret = UnityEngine.Resources.GetBuiltinResource( _type, _path );
|
|||
|
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_UnloadAsset_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
UnityEngine.Object _assetToUnload = (UnityEngine.Object)translator.GetObject(L, 1, typeof(UnityEngine.Object));
|
|||
|
|
|||
|
UnityEngine.Resources.UnloadAsset( _assetToUnload );
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_UnloadUnusedAssets_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
|
|||
|
UnityEngine.AsyncOperation gen_ret = UnityEngine.Resources.UnloadUnusedAssets( );
|
|||
|
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_InstanceIDToObject_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
int _instanceID = LuaAPI.xlua_tointeger(L, 1);
|
|||
|
|
|||
|
UnityEngine.Object gen_ret = UnityEngine.Resources.InstanceIDToObject( _instanceID );
|
|||
|
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_InstanceIDToObjectList_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
Unity.Collections.NativeArray<int> _instanceIDs;translator.Get(L, 1, out _instanceIDs);
|
|||
|
System.Collections.Generic.List<UnityEngine.Object> _objects = (System.Collections.Generic.List<UnityEngine.Object>)translator.GetObject(L, 2, typeof(System.Collections.Generic.List<UnityEngine.Object>));
|
|||
|
|
|||
|
UnityEngine.Resources.InstanceIDToObjectList( _instanceIDs, _objects );
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|||
|
static int _m_InstanceIDIsValid_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
int _instanceId = LuaAPI.xlua_tointeger(L, 1);
|
|||
|
|
|||
|
bool gen_ret = UnityEngine.Resources.InstanceIDIsValid( _instanceId );
|
|||
|
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 _m_InstanceIDsToValidArray_xlua_st_(RealStatePtr L)
|
|||
|
{
|
|||
|
try {
|
|||
|
|
|||
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
{
|
|||
|
Unity.Collections.NativeArray<int> _instanceIDs;translator.Get(L, 1, out _instanceIDs);
|
|||
|
Unity.Collections.NativeArray<bool> _validArray;translator.Get(L, 2, out _validArray);
|
|||
|
|
|||
|
UnityEngine.Resources.InstanceIDsToValidArray( _instanceIDs, _validArray );
|
|||
|
|
|||
|
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|
|||
|
|
|||
|
} catch(System.Exception gen_e) {
|
|||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|