mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-26 12:41:40 +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);
|
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.connectToMasterServer(() -> {
|
||||||
MasterServerClient.instance.getServerList((servers) -> {
|
MasterServerClient.instance.getServerList((servers) -> {
|
||||||
ourServerList = servers;
|
ourServerList = servers;
|
||||||
updateServerListDisplay();
|
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)
|
if (refreshing)
|
||||||
return;
|
return;
|
||||||
refreshing = true;
|
refreshing = true;
|
||||||
|
serverListStatusText.text.visible = true;
|
||||||
|
serverListStatusText.text.text = "Searching for matches...";
|
||||||
MasterServerClient.connectToMasterServer(() -> {
|
MasterServerClient.connectToMasterServer(() -> {
|
||||||
MasterServerClient.instance.getServerList((servers) -> {
|
MasterServerClient.instance.getServerList((servers) -> {
|
||||||
ourServerList = servers;
|
ourServerList = servers;
|
||||||
updateServerListDisplay();
|
updateServerListDisplay();
|
||||||
refreshing = false;
|
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;
|
refreshing = false;
|
||||||
|
serverListStatusText.text.visible = true;
|
||||||
|
serverListStatusText.text.text = "Failed to connect to master server.";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
bottomBar.addChild(refreshButton);
|
bottomBar.addChild(refreshButton);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue