public static WWW SmartCreateWww(string resPath) { #if STANDALONE string url = Path.Combine(Application.streamingAssetsPath, resPath); if (!url.Contains("://")) { url = "file:///" + url; } #else XmlResourceList.Item item = RemoteResourceList.GetItem(resPath); XmlResourceList.Item builintItem = BuiltinResourceList.GetItem(resPath); if (item == null || item.Deleted) { Debug.LogError("Resource not in ResourceList: " + resPath); return(null); } string url = ""; if (builintItem != null && item.Version <= builintItem.Version) { url = Path.Combine(Application.streamingAssetsPath, resPath); if (!url.Contains("://")) { url = "file:///" + url; } } else { url = "file:///" + UnityEngine.Application.persistentDataPath + "/" + resPath; } #endif return(new WWW(url)); }
public static WWW CreateRemoteWww(string resPath) { XmlResourceList.Item item = RemoteResourceList.GetItem(resPath); if (item == null || item.Deleted) { Debug.LogError("Resource not in ResourceList: " + resPath); //这里本来是返回null,但上层会出错,所以还是返回一个无效的www return(new WWW(GetResourceRemoteUrl(resPath))); } return(new WWW(GetResourceRemoteUrl(resPath))); }
/// <summary> /// 预加载舰船数据 /// </summary> /// <returns></returns> public Coroutine PreloadShipDefines() { XmlResourceList.Item[] allShip = null; allShip = RemoteResourceList.FindItem(PalmPoineer.Defines.AssetExt.ShipDefine); if (allShip == null) { Debug.Log("Ship List is null"); return(null); } CoroutineJoin join = new CoroutineJoin(this); foreach (var item in allShip) { join.StartSubtask(LoadShip(item.Path)); } Debug.Log("Total ship Defines: " + allShip.Length); return(join.WaitForAll()); }