123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //------------------------------------------------------------
- // Game Framework
- // Copyright © 2013-2021 loyalsoft. All rights reserved.
- // Homepage: http://www.game7000.com/
- // Feedback: http://www.game7000.com/
- //------------------------------------------------------------
- namespace GameFramework.Resource
- {
- /// <summary>
- /// 资源更新开始事件。
- /// </summary>
- public sealed class ResourceUpdateStartEventArgs : GameFrameworkEventArgs
- {
- /// <summary>
- /// 初始化资源更新开始事件的新实例。
- /// </summary>
- public ResourceUpdateStartEventArgs()
- {
- Name = null;
- DownloadPath = null;
- DownloadUri = null;
- CurrentLength = 0;
- CompressedLength = 0;
- RetryCount = 0;
- }
- /// <summary>
- /// 获取资源名称。
- /// </summary>
- public string Name
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取资源下载后存放路径。
- /// </summary>
- public string DownloadPath
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取下载地址。
- /// </summary>
- public string DownloadUri
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取当前下载大小。
- /// </summary>
- public int CurrentLength
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取压缩后大小。
- /// </summary>
- public int CompressedLength
- {
- get;
- private set;
- }
- /// <summary>
- /// 获取已重试下载次数。
- /// </summary>
- public int RetryCount
- {
- get;
- private set;
- }
- /// <summary>
- /// 创建资源更新开始事件。
- /// </summary>
- /// <param name="name">资源名称。</param>
- /// <param name="downloadPath">资源下载后存放路径。</param>
- /// <param name="downloadUri">资源下载地址。</param>
- /// <param name="currentLength">当前下载大小。</param>
- /// <param name="compressedLength">压缩后大小。</param>
- /// <param name="retryCount">已重试下载次数。</param>
- /// <returns>创建的资源更新开始事件。</returns>
- public static ResourceUpdateStartEventArgs Create(string name, string downloadPath, string downloadUri, int currentLength, int compressedLength, int retryCount)
- {
- ResourceUpdateStartEventArgs resourceUpdateStartEventArgs = ReferencePool.Acquire<ResourceUpdateStartEventArgs>();
- resourceUpdateStartEventArgs.Name = name;
- resourceUpdateStartEventArgs.DownloadPath = downloadPath;
- resourceUpdateStartEventArgs.DownloadUri = downloadUri;
- resourceUpdateStartEventArgs.CurrentLength = currentLength;
- resourceUpdateStartEventArgs.CompressedLength = compressedLength;
- resourceUpdateStartEventArgs.RetryCount = retryCount;
- return resourceUpdateStartEventArgs;
- }
- /// <summary>
- /// 清理资源更新开始事件。
- /// </summary>
- public override void Clear()
- {
- Name = null;
- DownloadPath = null;
- DownloadUri = null;
- CurrentLength = 0;
- CompressedLength = 0;
- RetryCount = 0;
- }
- }
- }
|