/// <summary> /// 从文件系统加载文本文件 /// </summary> /// <param name="file"></param> /// <returns></returns> public IEnumerator LoadTextFileAsync(string file) { string url = null; WWW www = null; com.QH.QPGame.GameUtils.Logger.Res.Log("load text:" + file); #if !UNITY_EDITOR || TEST_AB if (downloadedABs.Contains(file)) { url = GameHelper.GetDownloadPath(true) + file; www = new WWW(url); yield return(www); } #endif if (www == null || !string.IsNullOrEmpty(www.error)) { url = GameHelper.GetInternalPath(true) + file; www = new WWW(url); yield return(www); if (!string.IsNullOrEmpty(www.error)) { com.QH.QPGame.GameUtils.Logger.Res.Log("get file text error. Error:" + www.error + " File:" + file); yield break; } } cachedFiles[file] = www.text; }
public bool Initialize() { com.QH.QPGame.GameUtils.Logger.Res.Log("Res System Init"); Reset(); #if !UNITY_EDITOR || TEST_AB if (abMgr == null) { abMgr = new LOAssetManager[2]; for (int i = 0; i < 2; i++) { abMgr[i] = gameObject.AddComponent <LOAssetManager>(); abMgr[i].URI = i == 0 ? GameHelper.GetInternalPath(true) : GameHelper.GetDownloadPath(true); } } #endif StartCoroutine(InternalInit()); return(true); }