Get replay working from dropdown menu. (right now everyone has the replay button. We will hide it for most cases later on)
This commit is contained in:
@ -81,6 +81,10 @@ namespace EduNetworkBuilder
|
||||
|
||||
private List<AnimationClass> Animations = new List<AnimationClass>();
|
||||
|
||||
public bool ReplayInProgress = false;
|
||||
public DateTime NextReplayAction = DateTime.UtcNow;
|
||||
public int NextReplayIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// WhatFrom: If we are launched from a homework, we remember it here.
|
||||
/// </summary>
|
||||
@ -1642,6 +1646,28 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ReplayInProgress && myPackets.Count == 0)
|
||||
{
|
||||
if(DateTime.UtcNow >= NextReplayAction)
|
||||
{
|
||||
//We are doing a replay and enough time has passed from the last replay...
|
||||
NBSettings Settings = NB.GetSettings();
|
||||
ActionCollection AC = Settings.GetUserActionCollection();
|
||||
bool Success = AC.RunAction(NextReplayIndex++);
|
||||
|
||||
NextReplayAction = DateTime.UtcNow.AddMilliseconds(NB.MillisecondsBetweenReplays);
|
||||
if(Success)
|
||||
{
|
||||
//we did something. keep replaying
|
||||
NB.MarkToUpdate();
|
||||
}
|
||||
else
|
||||
{
|
||||
//replay finished
|
||||
ReplayInProgress = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (myPackets.Count > 50)
|
||||
//Console.WriteLine("Packets: " + myPackets.Count.ToString());
|
||||
if (myPackets.Count > 0)
|
||||
|
Reference in New Issue
Block a user