Exemple #1
0
        internal PlayAssetPackRequest RetrieveAssetPackAsyncInternal(string assetPackName)
        {
            if (_requestRepository.ContainsAssetBundleRequest(assetPackName))
            {
                throw new ArgumentException(string.Format(
                                                "Cannot create a new PlayAssetPackRequest because there is already an active " +
                                                "PlayAssetBundleRequest for asset bundle: {0}",
                                                assetPackName));
            }

            PlayAssetPackRequestImpl request;

            if (_requestRepository.TryGetRequest(assetPackName, out request))
            {
                Debug.LogFormat("Returning existing active request for {0}", assetPackName);
                return(request);
            }

            request = CreateAssetPackRequest(assetPackName);
            _requestRepository.AddRequest(request);
            request.Completed += req => _requestRepository.RemoveRequest(assetPackName);

            InitiateRequest(request);

            return(request);
        }
        internal PlayAssetBundleRequest RetrieveAssetBundleAsyncInternal(string assetBundleName)
        {
            if (_requestRepository.ContainsRequest(assetBundleName))
            {
                throw new ArgumentException(string.Format("There is already an active request for AssetBundle: {0}",
                                                          assetBundleName));
            }

            var request = CreateAssetBundleRequest(assetBundleName);

            _requestRepository.AddRequest(request.PackRequest);
            request.Completed += req => _requestRepository.RemoveRequest(assetBundleName);

            InitiateRequest(request.PackRequest);

            return(request);
        }