namespace YooAsset
{
internal class DownloadFileOptions
{
///
/// 失败后重试次数
///
public readonly int FailedTryAgain;
///
/// 超时时间
///
public readonly int Timeout;
///
/// 主资源地址
///
public string MainURL { set; get; }
///
/// 备用资源地址
///
public string FallbackURL { set; get; }
///
/// 导入的本地文件路径
///
public string ImportFilePath { set; get; }
public DownloadFileOptions(int failedTryAgain, int timeout)
{
FailedTryAgain = failedTryAgain;
Timeout = timeout;
}
}
internal abstract class FSDownloadFileOperation : AsyncOperationBase
{
public PackageBundle Bundle { private set; get; }
///
/// 引用计数
///
public int RefCount { private set; get; }
///
/// HTTP返回码
///
public long HttpCode { protected set; get; }
///
/// 当前下载的字节数
///
public long DownloadedBytes { protected set; get; }
///
/// 当前下载进度(0f - 1f)
///
public float DownloadProgress { protected set; get; }
public FSDownloadFileOperation(PackageBundle bundle)
{
Bundle = bundle;
RefCount = 0;
HttpCode = 0;
DownloadedBytes = 0;
DownloadProgress = 0;
}
internal override string InternalGetDesc()
{
return $"RefCount : {RefCount}";
}
///
/// 减少引用计数
///
public virtual void Release()
{
RefCount--;
}
///
/// 增加引用计数
///
public virtual void Reference()
{
RefCount++;
}
}
}