mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-31 01:44:22 +07:00
Sort community servers by ping
This commit is contained in:
parent
d64f603e08
commit
d13b69c36f
@ -836,7 +836,6 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
if(type == null) return;
|
||||
|
||||
boolean omni = unit.type.omniMovement;
|
||||
boolean ground = unit.isGrounded();
|
||||
boolean allowHealing = type.canHeal;
|
||||
boolean validHealTarget = allowHealing && target instanceof Building && ((Building)target).isValid() && target.team() == unit.team &&
|
||||
((Building)target).damaged() && target.within(unit, type.range);
|
||||
|
@ -356,43 +356,45 @@ public class JoinDialog extends BaseDialog{
|
||||
continue;
|
||||
}
|
||||
|
||||
Table[] groupTable = {null};
|
||||
|
||||
//table containing all groups
|
||||
global.table(g -> {
|
||||
for(String address : group.addresses){
|
||||
String resaddress = address.contains(":") ? address.split(":")[0] : address;
|
||||
int resport = address.contains(":") ? Strings.parseInt(address.split(":")[1]) : port;
|
||||
net.pingHost(resaddress, resport, res -> {
|
||||
if(refreshes != cur) return;
|
||||
res.port = resport;
|
||||
for(String address : group.addresses){
|
||||
String resaddress = address.contains(":") ? address.split(":")[0] : address;
|
||||
int resport = address.contains(":") ? Strings.parseInt(address.split(":")[1]) : port;
|
||||
net.pingHost(resaddress, resport, res -> {
|
||||
if(refreshes != cur) return;
|
||||
res.port = resport;
|
||||
|
||||
//add header
|
||||
if(g.getChildren().isEmpty()){
|
||||
g.table(head -> {
|
||||
if(!group.name.isEmpty()){
|
||||
head.add(group.name).color(Color.lightGray).padRight(4);
|
||||
}
|
||||
head.image().height(3f).growX().color(Color.lightGray);
|
||||
//add header
|
||||
if(groupTable[0] == null){
|
||||
global.table(t -> groupTable[0] = t).row();
|
||||
|
||||
//button for showing/hiding servers
|
||||
ImageButton[] image = {null};
|
||||
image[0] = head.button(hidden ? Icon.eyeOffSmall : Icon.eyeSmall, Styles.accenti, () -> {
|
||||
group.setHidden(!group.hidden());
|
||||
image[0].getStyle().imageUp = group.hidden() ? Icon.eyeOffSmall : Icon.eyeSmall;
|
||||
if(group.hidden() && !showHidden){
|
||||
g.remove();
|
||||
}
|
||||
}).size(40f).get();
|
||||
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
|
||||
}).width(targetWidth()).padBottom(-2).row();
|
||||
}
|
||||
groupTable[0].table(head -> {
|
||||
if(!group.name.isEmpty()){
|
||||
head.add(group.name).color(Color.lightGray).padRight(4);
|
||||
}
|
||||
head.image().height(3f).growX().color(Color.lightGray);
|
||||
|
||||
addGlobalHost(res, g);
|
||||
//button for showing/hiding servers
|
||||
ImageButton[] image = {null};
|
||||
image[0] = head.button(hidden ? Icon.eyeOffSmall : Icon.eyeSmall, Styles.accenti, () -> {
|
||||
group.setHidden(!group.hidden());
|
||||
image[0].getStyle().imageUp = group.hidden() ? Icon.eyeOffSmall : Icon.eyeSmall;
|
||||
if(group.hidden() && !showHidden){
|
||||
groupTable[0].remove();
|
||||
}
|
||||
}).size(40f).get();
|
||||
image[0].addListener(new Tooltip(t -> t.background(Styles.black6).margin(4).label(() -> !group.hidden() ? "@server.shown" : "@server.hidden")));
|
||||
}).width(targetWidth()).padBottom(-2).row();
|
||||
}
|
||||
|
||||
g.margin(5f);
|
||||
g.pack();
|
||||
}, e -> {});
|
||||
}
|
||||
}).row();
|
||||
addGlobalHost(res, groupTable[0]);
|
||||
|
||||
groupTable[0].margin(5f);
|
||||
groupTable[0].pack();
|
||||
}, e -> {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user