mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
better server list
This commit is contained in:
parent
d29d86f746
commit
a52f8e46a0
1 changed files with 27 additions and 0 deletions
|
|
@ -106,10 +106,26 @@ class MPServerListGui extends GuiImage {
|
|||
serverList.setTexts(serverDisplays);
|
||||
}
|
||||
|
||||
var serverListStatusText = new GuiText(arial14);
|
||||
serverListStatusText.text.text = "Searching for matches...";
|
||||
serverListStatusText.justify = Center;
|
||||
serverListStatusText.horizSizing = Center;
|
||||
serverListStatusText.vertSizing = Center;
|
||||
serverListStatusText.position = new Vector();
|
||||
serverListStatusText.extent = new Vector(100, 30);
|
||||
serverList.addChild(serverListStatusText);
|
||||
|
||||
MasterServerClient.connectToMasterServer(() -> {
|
||||
MasterServerClient.instance.getServerList((servers) -> {
|
||||
ourServerList = servers;
|
||||
updateServerListDisplay();
|
||||
|
||||
if (ourServerList.length == 0) {
|
||||
serverListStatusText.text.visible = true;
|
||||
serverListStatusText.text.text = "No matches found, you should start a match for others.";
|
||||
} else {
|
||||
serverListStatusText.text.visible = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -139,14 +155,25 @@ class MPServerListGui extends GuiImage {
|
|||
if (refreshing)
|
||||
return;
|
||||
refreshing = true;
|
||||
serverListStatusText.text.visible = true;
|
||||
serverListStatusText.text.text = "Searching for matches...";
|
||||
MasterServerClient.connectToMasterServer(() -> {
|
||||
MasterServerClient.instance.getServerList((servers) -> {
|
||||
ourServerList = servers;
|
||||
updateServerListDisplay();
|
||||
refreshing = false;
|
||||
|
||||
if (ourServerList.length == 0) {
|
||||
serverListStatusText.text.visible = true;
|
||||
serverListStatusText.text.text = "No matches found, you should start a match for others.";
|
||||
} else {
|
||||
serverListStatusText.text.visible = false;
|
||||
}
|
||||
});
|
||||
}, () -> {
|
||||
refreshing = false;
|
||||
serverListStatusText.text.visible = true;
|
||||
serverListStatusText.text.text = "Failed to connect to master server.";
|
||||
});
|
||||
}
|
||||
bottomBar.addChild(refreshButton);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue