Ejemplo n.º 1
0
        private void OnResourceUpdateStart(object sender, CFEventArgs e)
        {
            ResourceUpdateStartEventArgs ne = (ResourceUpdateStartEventArgs)e;

            //添加记录 当前开始下载的资源的 下载大小
            m_LoadedLength[ne.Name] = ne.CurrentLength;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建资源更新开始事件。
        /// </summary>
        /// <param name="name">资源名称。</param>
        /// <param name="downloadPath">资源下载后存放路径。</param>
        /// <param name="downloadUri">资源下载地址。</param>
        /// <param name="currentLength">当前下载大小。</param>
        /// <param name="zipLength">压缩包大小。</param>
        /// <param name="retryCount">已重试下载次数。</param>
        /// <returns>创建的资源更新开始事件。</returns>
        public static ResourceUpdateStartEventArgs Create(string name, string downloadPath, string downloadUri, int currentLength, int zipLength, int retryCount)
        {
            ResourceUpdateStartEventArgs resourceUpdateStartEventArgs = ReferencePool.Acquire <ResourceUpdateStartEventArgs>();

            resourceUpdateStartEventArgs.Name          = name;
            resourceUpdateStartEventArgs.DownloadPath  = downloadPath;
            resourceUpdateStartEventArgs.DownloadUri   = downloadUri;
            resourceUpdateStartEventArgs.CurrentLength = currentLength;
            resourceUpdateStartEventArgs.ZipLength     = zipLength;
            resourceUpdateStartEventArgs.RetryCount    = retryCount;
            return(resourceUpdateStartEventArgs);
        }
        private void OnResourceUpdateStart(object sender, GameEventArgs e)
        {
            ResourceUpdateStartEventArgs ne = (ResourceUpdateStartEventArgs)e;

            for (int i = 0; i < m_UpdateLengthData.Count; i++)
            {
                if (m_UpdateLengthData[i].Name == ne.Name)
                {
                    Log.Warning("Update resource '{0}' is invalid.", ne.Name);
                    m_UpdateLengthData[i].Length = 0;
                    RefreshProgress();
                    return;
                }
            }
            m_UpdateLengthData.Add(new UpdateLengthData(ne.Name));
        }
Ejemplo n.º 4
0
 private void OnResourceUpdateStart(object sender, IResourceUpdateStartEventArgs e)
 {
     EventComponent.This.Fire(this, ResourceUpdateStartEventArgs.Create(e));
 }