private void InitLua() { lua.AddLoader(Loader.Create()); string luaCode; if (string.IsNullOrEmpty(CustomSearchPath)) { luaCode = @"package.path=package.path .. " + $"';{GameConf.LUA_BASE_PATH}?.lua;{Application.persistentDataPath}?.lua;{Application.streamingAssetsPath}?.lua;'"; } else { GameConf.CustomLuaGame = CustomSearchPath; luaCode = $"package.path=package.path ..';{GameConf.LUA_BASE_PATH}?.lua;{CustomSearchPath}?.lua;{Application.persistentDataPath}?.lua;{Application.streamingAssetsPath}?.lua;'"; } lua.DoString(luaCode); lua.Global.Set("ResourceManager", ResourceManager.Get()); lua.Global.Set("LooperManager", LooperManager.Get()); lua.DoString("BabyEngine = BabyEngine or {}\nrequire('framework.init')"); }
private void Awake() { Instance = this; }