diff --git a/Assets/Scripts/UI/JoinGameWindow.cs b/Assets/Scripts/UI/JoinGameWindow.cs index e45e0b3f..8e955a16 100644 --- a/Assets/Scripts/UI/JoinGameWindow.cs +++ b/Assets/Scripts/UI/JoinGameWindow.cs @@ -3,6 +3,7 @@ using UnityEngine; using SanAndreasUnity.Utilities; using SanAndreasUnity.Net; using System.Linq; +using System.Threading.Tasks; namespace SanAndreasUnity.UI { @@ -146,13 +147,7 @@ namespace SanAndreasUnity.UI { GUI.enabled = !_isRefreshingMasterServerList; buttonText = _isRefreshingMasterServerList ? ( "Refreshing." + new string('.', (int) ((Time.time * 2) % 3)) ) : "Refresh servers"; - buttonAction = async () => - { - _isRefreshingMasterServerList = true; - _serversFromMasterServer = new List(); - _serversFromMasterServer = await MasterServerClient.Instance.GetAllServers(); - _isRefreshingMasterServerList = false; - }; + buttonAction = async () => await RefreshMasterServersButtonPressed(); } } @@ -161,6 +156,14 @@ namespace SanAndreasUnity.UI } + async Task RefreshMasterServersButtonPressed() + { + _isRefreshingMasterServerList = true; + _serversFromMasterServer = new List(); + _serversFromMasterServer = await MasterServerClient.Instance.GetAllServers(); + _isRefreshingMasterServerList = false; + } + void ConnectDirectly() { this.Connect(m_ipStr, ushort.Parse(m_portStr));