public override void OnAfterSimulationTick() { // Send economy packets every two seconds if (DateTime.Now.Subtract(_lastEconomyAndDropSync).TotalSeconds > 2) { ResourceCommandHandler.Send(); SlowdownHelper.SendDroppedFrames(); _lastEconomyAndDropSync = DateTime.Now; } // Finish transactions TransactionHandler.FinishSend(); }
public override void OnAfterSimulationTick() { // Send economy and frame drop packets every two seconds if (DateTime.Now.Subtract(_lastEconomyAndDropSync).TotalSeconds > 2) { // Only send economy and dropped frames when connected // (loading may accumulate dropped frames we need to ignore) if (MultiplayerManager.Instance.IsConnected()) { ResourceCommandHandler.Send(); SlowdownHelper.SendDroppedFrames(); } _lastEconomyAndDropSync = DateTime.Now; } // Finish transactions TransactionHandler.FinishSend(); }
public override void OnAfterSimulationTick() { // Normally, the game is paused when the player is in Esc or similar menus. We ignore this setting. if (SimulationManager.instance.ForcedSimulationPaused && MultiplayerManager.Instance.CurrentRole != MultiplayerRole.None) { SimulationManager.instance.ForcedSimulationPaused = false; } if (_lastSelectedSimulationSpeed != SimulationManager.instance.SelectedSimulationSpeed) { Command.SendToAll(new SpeedCommand { SelectedSimulationSpeed = SimulationManager.instance.SelectedSimulationSpeed }); } if (_lastSimulationPausedState != SimulationManager.instance.SimulationPaused) { Command.SendToAll(new PauseCommand { SimulationPaused = SimulationManager.instance.SimulationPaused }); } _lastSimulationPausedState = SimulationManager.instance.SimulationPaused; _lastSelectedSimulationSpeed = SimulationManager.instance.SelectedSimulationSpeed; // Send economy packets every two seconds if (DateTime.Now.Subtract(lastEconomySync).TotalSeconds > 2) { ResourceCommandHandler.Send(); lastEconomySync = DateTime.Now; } // Finish transactions TransactionHandler.FinishSend(); }