private void UpdatePlayerLatency(uint PlayerObject)
{
PlayerState State = TryGetPlayerState(PlayerObject);
//
// If the player is not logged on any more, stop. We will start up
// a new continuation later, at client enter, should the player
// return.
//
if (State == null || GetIsObjectValid(PlayerObject) != TRUE)
return;
//
// Record the current (server-side) tick count, then open the
// latency check scene on the client. The scene will immediately
// close itself and then call gui_measure_latency, which will call
// back into the server communicator to update the player's current
// round trip time (including server processing delays).
//
State.LatencyTickCount = (uint)Environment.TickCount;
DisplayGuiScreen(PlayerObject, "acr_measure_latency", FALSE, "acr_measure_latency.xml", FALSE);
CloseGUIScreen(PlayerObject, "acr_measure_latency");
//
// Schedule the next latency check for this player.
//
DelayCommand(30.0f, delegate()
{
UpdatePlayerLatency(PlayerObject);
});
}