#region Copyright RenGuiYou. All rights reserved. //===================================================== // NeatlyFrameWork // Author: RenGuiyou // Feedback: mailto:750539605@qq.com //===================================================== #endregion using System.IO; using Neatly.Module; using Neatly.Native; using UnityEngine; namespace Neatly.Load.Manager { //1.找可读写目录bytecode //2.解压bundle包内的bytecode public class LuaLoadManager : Singleton { private LoadModule m_LoadModule; public void Init(LoadModule loadModule) { m_LoadModule = loadModule; } public byte[] LoadLua(string fileName) { fileName = fileName.ToLower(); byte[] luaByte = null; #if !UNITY_EDITOR fileName = fileName.Replace('/', '_'); luaByte = FileModule.Instance.ReadUpdateLua(fileName); if (luaByte != null) { return luaByte; } #if UNITY_ANDROID string path = string.Format("lua/{0}/{1}", NeatlyConfig.LUA_PACKAGE, fileName); luaByte = AndroidHelper.ReadBytes(path); #else string path = string.Format("{0}/lua/{1}/{2}",Application.streamingAssetsPath, NeatlyConfig.LUA_PACKAGE, fileName); luaByte = FileModule.Instance.ReadFile(path); #endif if (luaByte != null) { return luaByte; } #endif #if !UNITY_STANDALONE_OSX #if UNITY_EDITOR luaByte = FileModule.Instance.ReadEditorLua(fileName); return luaByte; #endif fileName = fileName.Replace('/', '_'); luaByte = FileModule.Instance.ReadUpdateLua(fileName); return luaByte; #endif } } }