mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 04:23:04 +00:00
extract function
This commit is contained in:
parent
0d7ac7b6b4
commit
b4c0df123c
1 changed files with 10 additions and 7 deletions
|
@ -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<ServerInfo>();
|
||||
_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<ServerInfo>();
|
||||
_serversFromMasterServer = await MasterServerClient.Instance.GetAllServers();
|
||||
_isRefreshingMasterServerList = false;
|
||||
}
|
||||
|
||||
void ConnectDirectly()
|
||||
{
|
||||
this.Connect(m_ipStr, ushort.Parse(m_portStr));
|
||||
|
|
Loading…
Reference in a new issue