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);
        }
        private void ProcessPackStateUpdate(AssetPackState newState)
        {
            PlayAssetPackRequestImpl request;

            if (!_requestRepository.TryGetRequest(newState.Name, out request))
            {
                Debug.LogWarningFormat(
                    "Received state update \"{0}\", that is not associated with an active request.",
                    newState.Name);
                return;
            }

            UpdateRequest(request, newState, newState.ErrorCode);
        }