예제 #1
0
        private void OnResourceUpdateChanged(object sender, CFEventArgs e)
        {
            ResourceUpdateChangedEventArgs ne = (ResourceUpdateChangedEventArgs)e;

            //更新记录 当前开始下载的资源的 下载大小
            m_LoadedLength[ne.Name] = ne.CurrentLength;
        }
예제 #2
0
    private void OnResourceUpdateChanged(object sender, GameEventArgs e)
    {
        ResourceUpdateChangedEventArgs args = (ResourceUpdateChangedEventArgs)e;

        CurrentLength += args.ZipLength;
        Debug.Log("更新进度: " + CurrentLength + "/" + MaxLength + "  百分比: " + (float)CurrentLength / (float)MaxLength);
    }
        /// <summary>
        /// 创建资源更新改变事件。
        /// </summary>
        /// <param name="name">资源名称。</param>
        /// <param name="downloadPath">资源下载后存放路径。</param>
        /// <param name="downloadUri">资源下载地址。</param>
        /// <param name="currentLength">当前下载大小。</param>
        /// <param name="zipLength">压缩后大小。</param>
        /// <returns>创建的资源更新改变事件。</returns>
        public static ResourceUpdateChangedEventArgs Create(string name, string downloadPath, string downloadUri, int currentLength, int zipLength)
        {
            ResourceUpdateChangedEventArgs resourceUpdateChangedEventArgs = ReferencePool.Acquire <ResourceUpdateChangedEventArgs>();

            resourceUpdateChangedEventArgs.Name          = name;
            resourceUpdateChangedEventArgs.DownloadPath  = downloadPath;
            resourceUpdateChangedEventArgs.DownloadUri   = downloadUri;
            resourceUpdateChangedEventArgs.CurrentLength = currentLength;
            resourceUpdateChangedEventArgs.ZipLength     = zipLength;
            return(resourceUpdateChangedEventArgs);
        }
        private void OnResourceUpdateChanged(object sender, GameEventArgs e)
        {
            ResourceUpdateChangedEventArgs ne = (ResourceUpdateChangedEventArgs)e;

            for (int i = 0; i < m_UpdateLengthData.Count; i++)
            {
                if (m_UpdateLengthData[i].Name == ne.Name)
                {
                    m_UpdateLengthData[i].Length = ne.CurrentLength;
                    RefreshProgress();
                    return;
                }
            }

            Log.Warning("Update resource '{0}' is invalid.", ne.Name);
        }
예제 #5
0
 private void OnResourceUpdateChanged(object sender, IResourceUpdateChangedEventArgs e)
 {
     EventComponent.This.Fire(this, ResourceUpdateChangedEventArgs.Create(e));
 }