2025-01-09 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
namespace YooAsset
|
|
|
|
|
{
|
|
|
|
|
internal abstract class FSDownloadFileOperation : AsyncOperationBase
|
|
|
|
|
{
|
|
|
|
|
public PackageBundle Bundle { private set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 引用计数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int RefCount { private set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// HTTP返回码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long HttpCode { protected set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前下载的字节数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long DownloadedBytes { protected set; get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前下载进度(0f - 1f)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public float DownloadProgress { protected set; get; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public FSDownloadFileOperation(PackageBundle bundle)
|
|
|
|
|
{
|
|
|
|
|
Bundle = bundle;
|
|
|
|
|
RefCount = 0;
|
|
|
|
|
HttpCode = 0;
|
|
|
|
|
DownloadedBytes = 0;
|
|
|
|
|
DownloadProgress = 0;
|
|
|
|
|
}
|
2025-02-28 16:11:01 +08:00
|
|
|
|
|
2025-04-01 21:12:28 +08:00
|
|
|
|
internal override string InternalGetDesc()
|
|
|
|
|
{
|
|
|
|
|
return $"RefCount : {RefCount}";
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-28 16:11:01 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 减少引用计数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual void Release()
|
2025-01-09 11:31:04 +08:00
|
|
|
|
{
|
|
|
|
|
RefCount--;
|
|
|
|
|
}
|
2025-02-28 16:11:01 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 增加引用计数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual void Reference()
|
2025-01-09 11:31:04 +08:00
|
|
|
|
{
|
|
|
|
|
RefCount++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|