From 270961ada59da8f5929ad3d1230f868d072910bc Mon Sep 17 00:00:00 2001 From: Robbie Lodico Date: Sat, 28 Dec 2024 18:01:53 +0100 Subject: [PATCH] fix: prevent login/register button flickering --- Intersect.Client.Core/Interface/Menu/MainMenu.cs | 7 +++++-- Intersect.Client.Core/MonoGame/Network/MonoSocket.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Intersect.Client.Core/Interface/Menu/MainMenu.cs b/Intersect.Client.Core/Interface/Menu/MainMenu.cs index 900d98ab1c..b5ffd5beb4 100644 --- a/Intersect.Client.Core/Interface/Menu/MainMenu.cs +++ b/Intersect.Client.Core/Interface/Menu/MainMenu.cs @@ -203,8 +203,11 @@ internal void SettingsButton_Clicked() public static void SetNetworkStatus(NetworkStatus networkStatus, bool resetStatusCheck = false) { - ActiveNetworkStatus = networkStatus; - NetworkStatusChanged?.Invoke(); + if (ActiveNetworkStatus != networkStatus) + { + ActiveNetworkStatus = networkStatus; + NetworkStatusChanged?.Invoke(); + } LastNetworkStatusChangeTime = resetStatusCheck ? -1 : Timing.Global.MillisecondsUtc; } } diff --git a/Intersect.Client.Core/MonoGame/Network/MonoSocket.cs b/Intersect.Client.Core/MonoGame/Network/MonoSocket.cs index 390e083e9b..5edc7eefba 100644 --- a/Intersect.Client.Core/MonoGame/Network/MonoSocket.cs +++ b/Intersect.Client.Core/MonoGame/Network/MonoSocket.cs @@ -251,7 +251,7 @@ public override void Update() ); } - if (MainMenu.LastNetworkStatusChangeTime + ServerStatusPingInterval < now) + if (MainMenu.LastNetworkStatusChangeTime + ServerStatusPingInterval * 1.5f < now) { MainMenu.SetNetworkStatus(NetworkStatus.Offline); }