Exemple #1
0
        /// <summary>
        /// Adds the source cache data from WW.
        /// </summary>
        /// <param name="www">Www.</param>
        /// <param name="req">Req.</param>
        internal static bool AddSourceCacheDataFromWWW(WWW www, CRequest req)
        {
            object data = null;
            var    ab   = www.assetBundle;

            req.isAssetBundle = false;

            if (ab != null)
            {
                data = ab;
                req.isAssetBundle = true;
                CacheData cacheData = new CacheData(data, null, req.key);                 //缓存
                CacheManager.AddCache(cacheData);
                cacheData.allDependencies = req.allDependencies;
                cacheData.assetBundle     = ab;
            }
            else if (Typeof_String.Equals(req.assetType))
            {
                req.data = www.text;
            }
            else if (Typeof_AudioClip.Equals(req.assetType))
            {
                req.data = www.audioClip;
            }
            else if (Typeof_Texture2D.Equals(req.assetType))
            {
                if (req.assetName.Equals("textureNonReadable"))
                {
                    req.data = www.textureNonReadable;
                }
                else
                {
                    req.data = www.texture;
                }
            }

            if (Typeof_Bytes.Equals(req.assetType))
            {
                req.data          = www.bytes;
                req.isAssetBundle = false;
            }

            req.uris.OnWWWComplete(req, www.bytes);

            www.Dispose();
            return(req.isAssetBundle);
        }
Exemple #2
0
        /// <summary>
        /// Adds the source cache data from WW.
        /// </summary>
        /// <param name="www">Www.</param>
        /// <param name="req">Req.</param>
        internal static bool AddSourceCacheDataFromWWW(WWW www, CRequest req)
        {
            var ab = www.assetBundle;

            req.isAssetBundle = false;

            if (ab != null)
            {
                AddSourceCacheDataFromWWW(ab, req);
            }
            else if (Typeof_String.Equals(req.assetType))
            {
                req.data = www.text;
            }
            else if (Typeof_AudioClip.Equals(req.assetType))
            {
                req.data = www.audioClip;
            }
            else if (Typeof_Texture2D.Equals(req.assetType))
            {
                if (req.assetName.Equals("textureNonReadable"))
                {
                    req.data = www.textureNonReadable;
                }
                else
                {
                    req.data = www.texture;
                }
            }

            if (Typeof_Bytes.Equals(req.assetType))
            {
                req.data          = www.bytes;
                req.isAssetBundle = false;
            }

            UriGroup.CheckWWWComplete(req, www);
            www.Dispose();

            return(req.isAssetBundle);
        }