using System; using System.Collections.Generic; using System.IO; using System.Text; using UnityEngine; namespace Thousandto.Core.Base { /// /// WWW的工厂 /// public class WWWFactory { /// /// 获取某个文件的Cache的WWW对象 /// /// /// public static WWW GetWWWFileCache(string filePath, bool inAndroidPkg) { WWW retval = null; string path = filePath; var code = AssetsCacheManager.GetFileVersion(filePath); if (!inAndroidPkg && !File.Exists(filePath)) { Debug.LogError(string.Format( "AsyncLoadBundle load failed! NOT EXIST File:{0}", filePath)); return retval; } if (!inAndroidPkg) path = "file://" + filePath; //Debug.Log("WWWURL:"+filePath+";;code:"+code); retval = WWW.LoadFromCacheOrDownload(path, code); return retval; } /// /// 获取文件的WWW对象 /// /// /// public static WWW GetWWWFile(string filePath ,bool inAndroidPkg) { WWW retval = null; var path = filePath; if (!inAndroidPkg && !File.Exists(filePath)) { Debug.LogError(string.Format( "AsyncLoadBundle load failed! NOT EXIST File:{0}", filePath)); return retval; } if (!inAndroidPkg) path = "file://" + filePath; //Debug.Log("WWWURL:" + filePath); retval = new WWW(path); return retval; } } }