Skip to content

Commit

Permalink
fix: prevent login/register button flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
lodicolo committed Dec 28, 2024
1 parent ddf5cf5 commit 270961a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Intersect.Client.Core/Interface/Menu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion Intersect.Client.Core/MonoGame/Network/MonoSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public override void Update()
);
}

if (MainMenu.LastNetworkStatusChangeTime + ServerStatusPingInterval < now)
if (MainMenu.LastNetworkStatusChangeTime + ServerStatusPingInterval * 1.5f < now)
{
MainMenu.SetNetworkStatus(NetworkStatus.Offline);
}
Expand Down

0 comments on commit 270961a

Please sign in to comment.