212 lines
7.3 KiB
C#
212 lines
7.3 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 UnityEngineAsyncOperationWrap
|
|
{
|
|
public static void __Register(RealStatePtr L)
|
|
{
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
System.Type type = typeof(UnityEngine.AsyncOperation);
|
|
Utils.BeginObjectRegister(type, L, translator, 0, 1, 4, 2);
|
|
|
|
|
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "completed", _e_completed);
|
|
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "isDone", _g_get_isDone);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "progress", _g_get_progress);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "priority", _g_get_priority);
|
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "allowSceneActivation", _g_get_allowSceneActivation);
|
|
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "priority", _s_set_priority);
|
|
Utils.RegisterFunc(L, Utils.SETTER_IDX, "allowSceneActivation", _s_set_allowSceneActivation);
|
|
|
|
|
|
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 {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
if(LuaAPI.lua_gettop(L) == 1)
|
|
{
|
|
|
|
UnityEngine.AsyncOperation gen_ret = new UnityEngine.AsyncOperation();
|
|
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.AsyncOperation constructor!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_isDone(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.isDone);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_progress(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushnumber(L, gen_to_be_invoked.progress);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_priority(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.priority);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _g_get_allowSceneActivation(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.allowSceneActivation);
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _s_set_priority(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.priority = LuaAPI.xlua_tointeger(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_allowSceneActivation(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
gen_to_be_invoked.allowSceneActivation = LuaAPI.lua_toboolean(L, 2);
|
|
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
|
static int _e_completed(RealStatePtr L)
|
|
{
|
|
try {
|
|
ObjectTranslatorChild translator = (ObjectTranslatorChild)ObjectTranslatorPool.Instance.Find(L);
|
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
|
UnityEngine.AsyncOperation gen_to_be_invoked = (UnityEngine.AsyncOperation)translator.FastGetCSObj(L, 1);
|
|
System.Action<UnityEngine.AsyncOperation> gen_delegate = translator.GetDelegate<System.Action<UnityEngine.AsyncOperation>>(L, 3);
|
|
if (gen_delegate == null) {
|
|
return LuaAPI.luaL_error(L, "#3 need System.Action<UnityEngine.AsyncOperation>!");
|
|
}
|
|
|
|
if (gen_param_count == 3)
|
|
{
|
|
|
|
if (LuaAPI.xlua_is_eq_str(L, 2, "+")) {
|
|
gen_to_be_invoked.completed += gen_delegate;
|
|
return 0;
|
|
}
|
|
|
|
|
|
if (LuaAPI.xlua_is_eq_str(L, 2, "-")) {
|
|
gen_to_be_invoked.completed -= gen_delegate;
|
|
return 0;
|
|
}
|
|
|
|
}
|
|
} catch(System.Exception gen_e) {
|
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
|
}
|
|
LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.AsyncOperation.completed!");
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|