2
0

CheckJobs combined cancelled and completed checks,

added standby check
This commit is contained in:
glax 2023-09-02 16:15:47 +02:00
parent 22c4c0eb2c
commit 14ba71005f
2 changed files with 12 additions and 11 deletions

View File

@ -165,16 +165,7 @@ public class JobBoss : GlobalBase
if(jobQueue.Count < 1)
continue;
Job queueHead = jobQueue.Peek();
if (queueHead.progressToken.state is ProgressToken.State.Complete)
{
if(queueHead.recurring)
queueHead.ResetProgress();
jobQueue.Dequeue();
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
{
AddJobsToQueue(jobQueue.Peek().ExecuteReturnSubTasks());
}
else if (queueHead.progressToken.state is ProgressToken.State.Cancelled)
if (queueHead.progressToken.state is ProgressToken.State.Complete or ProgressToken.State.Cancelled)
{
switch (queueHead)
{
@ -187,6 +178,11 @@ public class JobBoss : GlobalBase
break;
}
jobQueue.Dequeue();
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
{
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray();
AddJobs(subJobs);
AddJobsToQueue(subJobs);
}
}
}

View File

@ -15,7 +15,7 @@ public class ProgressToken
this.cancellationRequested = false;
this.increments = increments;
this.incrementsCompleted = 0;
this.state = State.Standby;
this.state = State.Complete;
}
private float GetProgress()
@ -32,6 +32,11 @@ public class ProgressToken
state = State.Complete;
}
public void Standby()
{
state = State.Standby;
}
public void Start()
{
state = State.Running;