static int _m___Gen_Delegate_Imp1(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.DelegateBridge gen_to_be_invoked = (XLua.DelegateBridge)translator.FastGetCSObj(L, 1); { double _p0 = LuaAPI.lua_tonumber(L, 2); double _p1 = LuaAPI.lua_tonumber(L, 3); double gen_ret = gen_to_be_invoked.__Gen_Delegate_Imp1(_p0, _p1); LuaAPI.lua_pushnumber(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_PCall(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.DelegateBridge gen_to_be_invoked = (XLua.DelegateBridge)translator.FastGetCSObj(L, 1); { System.IntPtr _L = LuaAPI.lua_touserdata(L, 2); int _nArgs = LuaAPI.xlua_tointeger(L, 3); int _nResults = LuaAPI.xlua_tointeger(L, 4); int _errFunc = LuaAPI.xlua_tointeger(L, 5); gen_to_be_invoked.PCall(_L, _nArgs, _nResults, _errFunc); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public static void Set(int idx, DelegateBridge val) { if (idx >= DelegateBridge.DelegateBridgeList.Length) { DelegateBridge[] newList = new DelegateBridge[idx + 1]; for (int i = 0; i < DelegateBridge.DelegateBridgeList.Length; i++) { newList[i] = DelegateBridge.DelegateBridgeList[i]; } DelegateBridge.DelegateBridgeList = newList; } DelegateBridge.DelegateBridgeList[idx] = val; }
public static void Set(int idx, DelegateBridge val) { if (idx >= DelegateBridge.DelegateBridgeList.Length) { DelegateBridge[] newList = new DelegateBridge[idx + 1]; for (int i = 0; i < DelegateBridge.DelegateBridgeList.Length; i++) { newList[i] = DelegateBridge.DelegateBridgeList[i]; } DelegateBridge.DelegateBridgeList = newList; } DelegateBridge.DelegateBridgeList[idx] = val; #if UNITY_IPHONE && !UNITY_EDITOR xlua_set_hotfix_flag(idx, val != null); #endif }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <XLua.LuaEnv>(L, 3)) { int _reference = LuaAPI.xlua_tointeger(L, 2); XLua.LuaEnv _luaenv = (XLua.LuaEnv)translator.GetObject(L, 3, typeof(XLua.LuaEnv)); XLua.DelegateBridge gen_ret = new XLua.DelegateBridge(_reference, _luaenv); 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 XLua.DelegateBridge constructor!")); }
static int _m_Set_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { int _idx = LuaAPI.xlua_tointeger(L, 1); XLua.DelegateBridge _val = (XLua.DelegateBridge)translator.GetObject(L, 2, typeof(XLua.DelegateBridge)); XLua.HotfixDelegateBridge.Set(_idx, _val); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Get_xlua_st_(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); { int _idx = LuaAPI.xlua_tointeger(L, 1); XLua.DelegateBridge gen_ret = XLua.HotfixDelegateBridge.Get(_idx); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_Action(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.DelegateBridge gen_to_be_invoked = (XLua.DelegateBridge)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.Action( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m___Gen_Delegate_Imp2(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.DelegateBridge gen_to_be_invoked = (XLua.DelegateBridge)translator.FastGetCSObj(L, 1); { string _p0 = LuaAPI.lua_tostring(L, 2); gen_to_be_invoked.__Gen_Delegate_Imp2(_p0); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_GetDelegateByType(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); XLua.DelegateBridge gen_to_be_invoked = (XLua.DelegateBridge)translator.FastGetCSObj(L, 1); { System.Type _type = (System.Type)translator.GetObject(L, 2, typeof(System.Type)); System.Delegate gen_ret = gen_to_be_invoked.GetDelegateByType(_type); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public Delegate CreateDelegateBridge(RealStatePtr L, Type delegateType, int idx) { LuaAPI.lua_pushvalue(L, idx); LuaAPI.lua_rawget(L, LuaIndexes.LUA_REGISTRYINDEX); if (!LuaAPI.lua_isnil(L, -1)) { int referenced = LuaAPI.xlua_tointeger(L, -1); LuaAPI.lua_pop(L, 1); if (delegate_bridges[referenced].IsAlive) { DelegateBridgeBase exist_bridge = delegate_bridges[referenced].Target as DelegateBridgeBase; Delegate exist_delegate; if (exist_bridge.TryGetDelegate(delegateType, out exist_delegate)) { return(exist_delegate); } else { exist_delegate = exist_bridge.GetDelegateByType(delegateType); exist_bridge.AddDelegate(delegateType, exist_delegate); return(exist_delegate); } } } else { LuaAPI.lua_pop(L, 1); } LuaAPI.lua_pushvalue(L, idx); int reference = LuaAPI.luaL_ref(L); LuaAPI.lua_pushvalue(L, idx); LuaAPI.lua_pushnumber(L, reference); LuaAPI.lua_rawset(L, LuaIndexes.LUA_REGISTRYINDEX); DelegateBridgeBase bridge; try { #if UNITY_EDITOR if (!DelegateBridge.Gen_Flag) { bridge = Activator.CreateInstance(delegate_birdge_type, new object[] { reference, luaEnv }) as DelegateBridgeBase; } else #endif { bridge = new DelegateBridge(reference, luaEnv); } } catch (Exception e) { LuaAPI.lua_pushvalue(L, idx); LuaAPI.lua_pushnil(L); LuaAPI.lua_rawset(L, LuaIndexes.LUA_REGISTRYINDEX); LuaAPI.lua_pushnil(L); LuaAPI.xlua_rawseti(L, LuaIndexes.LUA_REGISTRYINDEX, reference); throw e; } try { var ret = bridge.GetDelegateByType(delegateType); bridge.AddDelegate(delegateType, ret); delegate_bridges[reference] = new WeakReference(bridge); return(ret); } catch (Exception e) { bridge.Dispose(); throw e; } }