Beispiel #1
0
        /// <summary>
        /// 从IFS或StreamingAssets目录异步加载资源
        /// </summary>
        /// <param name="complete"></param>
        /// <param name="progress"></param>
        /// <returns></returns>
        public IEnumerator LoadAsync(string pkgPath, bool outside, Action <ResObj> complete = null, Action <float> progress = null)
        {
            string realPath = FileUtil.CombinePath(pkgPath, OriginPath);

            if (outside)
            {
                yield return(LoadAsync(FileUtil.GetIFSExtractPathWithHeader(), pkgPath, complete, progress));
            }
            else
            {
                yield return(LoadAsync(FileUtil.GetStreamingAssetsPathWithHeader(""), pkgPath, complete, progress));
            }
        }
        /// <summary>
        /// 取bundle完整路径
        /// </summary>
        /// <param name="pi"></param>
        /// <returns></returns>
        string GetBundleFullPath(BundlePackInfo pi, bool withHeader)
        {
#if UNITY_EDITOR && !UNITY_EDITOR_OSX
            // 在PC上用Windows的Shader包,解决材质丢失问题
            if (pi.Path == "Shaders.ab")
            {
                if (withHeader)
                {
                    return(string.Format("file:///{0}/../../IFS/Build/Win/shaders.ab", Application.dataPath));
                }
                else
                {
                    return(string.Format("{0}/../../IFS/Build/Win/shaders.ab", Application.dataPath));
                }
            }
            else
#endif
            {
                if (pi.Outside)
                {
                    if (withHeader)
                    {
                        return(FileUtil.CombinePath(FileUtil.GetIFSExtractPathWithHeader(), pi.Path));
                    }
                    else
                    {
                        return(FileUtil.CombinePath(FileUtil.GetIFSExtractPath(), pi.Path));
                    }
                }
                else
                {
                    if (withHeader)
                    {
                        return(FileUtil.GetStreamingAssetsPathWithHeader(pi.Path));
                    }
                    else
                    {
                        return(FileUtil.CombinePath(Application.streamingAssetsPath, pi.Path));
                    }
                }
            }
        }