Exemplo n.º 1
0
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="_operation"></param>
        /// <returns></returns>
        protected IEnumerator LoadAsset(UAsyncOperation _operation)
        {
            IsSuccess = _operation != null;
            Request   = _operation;
            Content   = "";
            if (Request != null)
            {
                yield return(Request);

                Content = GetContent(Request);
                if (string.IsNullOrEmpty(Content))
                {
                    Debug.LogError("The Publish Content is invalid!");
                    IsSuccess = false;
                    yield break;
                }
            }
            yield break;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取下载数据的抽象过程
        /// </summary>
        /// <param name="_operation"></param>
        /// <returns></returns>
        protected string GetContent(UAsyncOperation _operation)
        {
            UDownloadRequest request = _operation as UDownloadRequest;

            byte[] binary;
            if (UnpackKeystore != null)
            {
                binary = UnpackKeystore(request.Bytes);
            }
            else
            {
                binary = request.Bytes;
            }

            if (binary != null)
            {
                return(Encoding.Default.GetString(binary));
            }
            else
            {
                return("");
            }
        }