From 3b0b3d9b159512a703074d36ca3298b9c785fc11 Mon Sep 17 00:00:00 2001 From: Ivan Filipenkov Date: Fri, 18 Aug 2023 17:48:08 +0300 Subject: [PATCH] test --- DangerousD/GameCore/Managers/GameManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DangerousD/GameCore/Managers/GameManager.cs b/DangerousD/GameCore/Managers/GameManager.cs index 8d1c7c4..0c23c12 100644 --- a/DangerousD/GameCore/Managers/GameManager.cs +++ b/DangerousD/GameCore/Managers/GameManager.cs @@ -30,6 +30,8 @@ namespace DangerousD.GameCore public List otherObjects = new(); public Vector4 CameraBorder; public Player GetPlayer1 { get; private set; } + private int _lastUpdate = 0; + public GameManager() { others = new List(); @@ -132,8 +134,12 @@ namespace DangerousD.GameCore { if (AppManager.Instance.NetworkTasks.Count > 0) { - AppManager.Instance.NetworkManager.SendMsg(AppManager.Instance.NetworkTasks.ToList()); - AppManager.Instance.NetworkTasks.Clear(); + if (gameTime.ElapsedGameTime.Milliseconds - _lastUpdate > 1000) + { + AppManager.Instance.NetworkManager.SendMsg(AppManager.Instance.NetworkTasks.ToList()); + AppManager.Instance.NetworkTasks.Clear(); + _lastUpdate = gameTime.ElapsedGameTime.Milliseconds; + } } foreach (var item in BackgroundObjects) item.Update(gameTime);