Ejemplo n.º 1
0
        /// <summary>
        /// 读取文件
        /// </summary>
        /// <returns>The load file.</returns>
        /// <param name="path">Path.</param>
        /// <param name="callBack">Call back.</param>
        IEnumerator ILoadFile(string path, LoadFileCallBack callBack)
        {
            WWW www;

            if (path.IndexOf("://") != -1)
            {
                //获取网络数据逻辑
                www = new WWW(path);
                yield return(www);
            }
            else
            {
                //			path = "files:///" + path;
                www = new WWW("file:///" + path);
                yield return(www);
            }
            if (www.error != null)
            {
                Debug.LogError(string.Format("fileMgr==>>>path = {0}\nerror = {1}", path, www.error));
                callBack(path, null);
            }
            else
            {
                callBack(path, www.bytes);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 读取文件接口.
 /// </summary>
 /// <param name="path">Path.</param>
 /// <param name="callBack">Call back.</param>
 public void LoadFile(string path, LoadFileCallBack callBack)
 {
     StartCoroutine(ILoadFile(path, callBack));
 }