Пример #1
0
        private byte[] LoadLuaFiles(ref string fileName)
        {
            LuaRequireToPath(ref fileName);

            //使用同步接口加载资源
            try
            {
                var    ta   = Assets.Load <TextAsset>(fileName);
                byte[] code = ta.bytes;
                Assets.Release(ta);
                return(code);
            }
            catch
            {
                Debug.LogWarning("Load Lua file failed: " + fileName);
                return(null);
            }
        }
Пример #2
0
        private byte[] LoadLuaFiles(ref string fileName)
        {
            if (m_CustomLoadHandlerManager.TryGetHandler(fileName, out var handler)) //自定义加载
            {
                return(handler?.Invoke());
            }


            LuaRequireToPath(ref fileName);

            //使用同步接口加载资源
            try
            {
                var    ta   = m_Assets.Load <TextAsset>(fileName);
                byte[] code = ta.bytes;
                m_Assets.Release(ta);
                return(code);
            }
            catch
            {
                Debug.LogWarning("Load Lua file failed: " + fileName);
                return(null);
            }
        }