mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-05 07:49:22 +00:00
Move many mods to Deprecated folder, fix spelling
This commit is contained in:
parent
5e822cec8d
commit
0042590aa6
539 changed files with 7475 additions and 3120 deletions
62
BetterContentLoading/DownloadManager2/DownloadTask2.cs
Normal file
62
BetterContentLoading/DownloadManager2/DownloadTask2.cs
Normal file
|
@ -0,0 +1,62 @@
|
|||
namespace NAK.BetterContentLoading;
|
||||
|
||||
public class DownloadTask2
|
||||
{
|
||||
public DownloadInfo Info { get; }
|
||||
public DownloadTaskStatus Status { get; set; }
|
||||
public DownloadTaskType Type { get; }
|
||||
|
||||
public float BasePriority { get; set; }
|
||||
public float CurrentPriority => BasePriority * (1 + Progress / 100f);
|
||||
|
||||
public long BytesRead { get; set; }
|
||||
public int Progress { get; set; }
|
||||
|
||||
public string CachePath { get; }
|
||||
public Dictionary<string, string> Targets { get; } // Key: targetId (playerId/instanceId), Value: spawnerId
|
||||
public bool LoadOnComplete { get; } // For worlds only
|
||||
|
||||
public DownloadTask2(
|
||||
DownloadInfo info,
|
||||
string cachePath,
|
||||
DownloadTaskType type,
|
||||
bool loadOnComplete = false)
|
||||
{
|
||||
Info = info;
|
||||
CachePath = cachePath;
|
||||
Type = type;
|
||||
LoadOnComplete = loadOnComplete;
|
||||
Targets = new Dictionary<string, string>();
|
||||
Status = DownloadTaskStatus.Queued;
|
||||
}
|
||||
|
||||
public void AddTarget(string targetId, string spawnerId = null)
|
||||
{
|
||||
if (Type == DownloadTaskType.World && Targets.Count > 0)
|
||||
throw new InvalidOperationException("World downloads cannot have multiple targets");
|
||||
|
||||
Targets[targetId] = spawnerId;
|
||||
}
|
||||
|
||||
public void RemoveTarget(string targetId)
|
||||
{
|
||||
Targets.Remove(targetId);
|
||||
}
|
||||
}
|
||||
|
||||
public enum DownloadTaskType
|
||||
{
|
||||
Avatar,
|
||||
Prop,
|
||||
World
|
||||
}
|
||||
|
||||
public enum DownloadTaskStatus
|
||||
{
|
||||
Queued,
|
||||
Downloading,
|
||||
Paused,
|
||||
Complete,
|
||||
Failed,
|
||||
Cancelled
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue