Compact player list
This commit is contained in:
@@ -402,7 +402,7 @@ public class JoinDialog extends BaseDialog{
|
||||
t.add("@search").padRight(10);
|
||||
t.field(serverSearch, text ->
|
||||
serverSearch = text.trim().replaceAll(" +", " ").toLowerCase()
|
||||
).grow().pad(8);
|
||||
).grow().pad(8).get().keyDown(KeyCode.enter, this::refreshCommunity);
|
||||
t.button(Icon.zoom, Styles.emptyi, this::refreshCommunity).size(54f);
|
||||
}).width(targetWidth()).height(70f).pad(4).row();
|
||||
|
||||
@@ -422,14 +422,11 @@ public class JoinDialog extends BaseDialog{
|
||||
net.pingHost(resaddress, resport, res -> {
|
||||
if(refreshes != cur) return;
|
||||
|
||||
if(!serverSearch.isEmpty()){
|
||||
if(!(group.name.toLowerCase().contains(serverSearch)
|
||||
|| res.name.toLowerCase().contains(serverSearch)
|
||||
|| res.description.toLowerCase().contains(serverSearch)
|
||||
|| res.mapname.toLowerCase().contains(serverSearch)
|
||||
|| (res.modeName != null && res.modeName.toLowerCase().contains(serverSearch))))
|
||||
return;
|
||||
}
|
||||
if(!serverSearch.isEmpty() && !(group.name.toLowerCase().contains(serverSearch)
|
||||
|| res.name.toLowerCase().contains(serverSearch)
|
||||
|| res.description.toLowerCase().contains(serverSearch)
|
||||
|| res.mapname.toLowerCase().contains(serverSearch)
|
||||
|| (res.modeName != null && res.modeName.toLowerCase().contains(serverSearch)))) return;
|
||||
|
||||
//add header
|
||||
if(groupTable[0] == null){
|
||||
|
||||
@@ -12,6 +12,7 @@ import arc.struct.*;
|
||||
import arc.util.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.input.*;
|
||||
import mindustry.net.*;
|
||||
import mindustry.net.Packets.*;
|
||||
import mindustry.ui.*;
|
||||
@@ -74,7 +75,7 @@ public class PlayerListFragment{
|
||||
public void rebuild(){
|
||||
content.clear();
|
||||
|
||||
float h = 74f;
|
||||
float h = 50f;
|
||||
boolean found = false;
|
||||
|
||||
players.clear();
|
||||
@@ -95,25 +96,47 @@ public class PlayerListFragment{
|
||||
button.left();
|
||||
button.margin(5).marginBottom(10);
|
||||
|
||||
Table table = new Table(){
|
||||
ClickListener listener = new ClickListener();
|
||||
|
||||
Table iconTable = new Table(){
|
||||
@Override
|
||||
public void draw(){
|
||||
super.draw();
|
||||
Draw.color(Pal.gray);
|
||||
Draw.colorMul(user.team().color, listener.isOver() ? 1.3f : 1f);
|
||||
Draw.alpha(parentAlpha);
|
||||
Lines.stroke(Scl.scl(4f));
|
||||
Lines.rect(x, y, width, height);
|
||||
Draw.reset();
|
||||
}
|
||||
};
|
||||
table.margin(8);
|
||||
table.add(new Image(user.icon()).setScaling(Scaling.bounded)).grow();
|
||||
table.name = user.name();
|
||||
|
||||
button.add(table).size(h);
|
||||
button.labelWrap("[#" + user.color().toString().toUpperCase() + "]" + user.name()).width(170f).pad(10);
|
||||
boolean clickable = !(state.rules.fog && state.rules.pvp && user.team() != player.team());
|
||||
|
||||
if(clickable){
|
||||
iconTable.addListener(listener);
|
||||
iconTable.addListener(new HandCursorListener());
|
||||
}
|
||||
iconTable.margin(8);
|
||||
iconTable.add(new Image(user.icon()).setScaling(Scaling.bounded)).grow();
|
||||
iconTable.name = user.name();
|
||||
iconTable.touchable = Touchable.enabled;
|
||||
|
||||
iconTable.tapped(() -> {
|
||||
if(!user.dead() && clickable){
|
||||
Core.camera.position.set(user.unit());
|
||||
ui.showInfoFade(Core.bundle.format("viewplayer", user.name), 1f);
|
||||
if(control.input instanceof DesktopInput input){
|
||||
input.panning = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
button.add(iconTable).size(h);
|
||||
button.labelWrap("[#" + user.color().toString().toUpperCase() + "]" + user.name()).style(Styles.outlineLabel).width(170f).pad(10);
|
||||
button.add().grow();
|
||||
|
||||
button.background(Tex.underline);
|
||||
|
||||
button.image(Icon.admin).visible(() -> user.admin && !(!user.isLocal() && net.server())).padRight(5).get().updateVisibility();
|
||||
|
||||
var style = new ImageButtonStyle(){{
|
||||
@@ -141,14 +164,14 @@ public class PlayerListFragment{
|
||||
button.table(t -> {
|
||||
t.defaults().size(bs);
|
||||
|
||||
t.button(Icon.hammer, ustyle,
|
||||
t.button(Icon.hammerSmall, ustyle,
|
||||
() -> ui.showConfirm("@confirm", Core.bundle.format("confirmban", user.name()), () -> Call.adminRequest(user, AdminAction.ban)));
|
||||
t.button(Icon.cancel, ustyle,
|
||||
t.button(Icon.cancelSmall, ustyle,
|
||||
() -> ui.showConfirm("@confirm", Core.bundle.format("confirmkick", user.name()), () -> Call.adminRequest(user, AdminAction.kick)));
|
||||
|
||||
t.row();
|
||||
|
||||
t.button(Icon.admin, style, () -> {
|
||||
t.button(Icon.adminSmall, style, () -> {
|
||||
if(net.client()) return;
|
||||
|
||||
String id = user.uuid();
|
||||
@@ -169,23 +192,19 @@ public class PlayerListFragment{
|
||||
.touchable(() -> net.client() ? Touchable.disabled : Touchable.enabled)
|
||||
.checked(user.admin);
|
||||
|
||||
t.button(Icon.zoom, ustyle, () -> Call.adminRequest(user, AdminAction.trace));
|
||||
t.button(Icon.zoomSmall, ustyle, () -> Call.adminRequest(user, AdminAction.trace));
|
||||
|
||||
}).padRight(12).size(bs + 10f, bs);
|
||||
}else if(!user.isLocal() && !user.admin && net.client() && Groups.player.size() >= 3 && player.team() == user.team()){ //votekick
|
||||
button.add().growY();
|
||||
|
||||
button.button(Icon.hammer, ustyle,
|
||||
() -> {
|
||||
ui.showConfirm("@confirm", Core.bundle.format("confirmvotekick", user.name()), () -> {
|
||||
Call.sendChatMessage("/votekick " + user.name());
|
||||
});
|
||||
}).size(h);
|
||||
() -> ui.showConfirm("@confirm", Core.bundle.format("confirmvotekick", user.name()),
|
||||
() -> Call.sendChatMessage("/votekick " + user.name())))
|
||||
.size(h);
|
||||
}
|
||||
|
||||
content.add(button).padBottom(-6).width(350f).maxHeight(h + 14);
|
||||
content.row();
|
||||
content.image().height(4f).color(state.rules.pvp ? user.team().color : Pal.gray).growX();
|
||||
content.add(button).width(350f).height(h + 14);
|
||||
content.row();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user