static int Close(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); Framework.LuaManager obj = (Framework.LuaManager)ToLua.CheckObject <Framework.LuaManager>(L, 1); obj.Close(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int GetLuaManager(IntPtr L) { try { ToLua.CheckArgsCount(L, 0); Framework.LuaManager o = Framework.Utility.LuaHelper.GetLuaManager(); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int AddBundle(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Framework.LuaManager obj = (Framework.LuaManager)ToLua.CheckObject <Framework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.AddBundle(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_mLuaState(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Framework.LuaManager obj = (Framework.LuaManager)o; LuaInterface.LuaState arg0 = (LuaInterface.LuaState)ToLua.CheckObject <LuaInterface.LuaState>(L, 2); obj.mLuaState = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mLuaState on a nil value")); } }
static int get_mLuaState(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); Framework.LuaManager obj = (Framework.LuaManager)o; LuaInterface.LuaState ret = obj.mLuaState; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index mLuaState on a nil value")); } }
/* void OnSceneLoaded(Scene scene, LoadSceneMode mode) { * * if (luaState != null) * { * luaState.RefreshDelegateMap(); * } * }*/ public virtual void Destroy() { if (luaState != null) { //SceneManager.sceneLoaded -= OnSceneLoaded; luaState.Call("OnDestroy", false); DetachProfiler(); LuaState state = luaState; luaState = null; if (loop != null) { loop.Destroy(); loop = null; } state.Dispose(); Instance = null; } }
/// <summary> /// 析构函数 /// </summary> private void OnDestroy() { LuaManager.Close(); Debug.Log("~GameManager was destroyed"); }
/// <summary> /// 执行Lua方法 /// </summary> public static object[] CallMethod(string module, string func, params object[] args) { LuaManager luaMgr = GameManager.Instance.LuaMgr; return(luaMgr.CallFunction(module + "." + func, args)); }