Added player tracing tools, fixed some bugs

This commit is contained in:
Anuken
2018-02-26 17:20:05 -05:00
parent c90395ee2b
commit 32791b4baa
20 changed files with 464 additions and 250 deletions

View File

@@ -0,0 +1,53 @@
package io.anuke.mindustry.ui.dialogs;
import io.anuke.mindustry.entities.Player;
import io.anuke.mindustry.net.TraceInfo;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Bundles;
public class TraceDialog extends FloatingDialog {
public TraceDialog(){
super("$text.trace");
addCloseButton();
}
public void show(Player player, TraceInfo info){
content().clear();
Table table = new Table("button");
table.margin(14);
table.defaults().pad(1);
table.defaults().left();
table.add(Bundles.format("text.trace.playername", player.name));
table.row();
table.add(Bundles.format("text.trace.ip", info.ip));
table.row();
table.add(Bundles.format("text.trace.modclient", info.modclient));
table.row();
table.add().pad(5);
table.row();
table.add(Bundles.format("text.trace.totalblocksbroken", info.totalBlocksBroken));
table.row();
table.add(Bundles.format("text.trace.structureblocksbroken", info.structureBlocksBroken));
table.row();
table.add(Bundles.format("text.trace.lastblockbroken", info.lastBlockBroken));
table.row();
table.add().pad(5);
table.row();
table.add(Bundles.format("text.trace.totalblocksplaced", info.totalBlocksPlaced));
table.row();
table.add(Bundles.format("text.trace.lastblockplaced", info.lastBlockPlaced));
table.row();
content().add(table);
show();
}
}

View File

@@ -117,7 +117,7 @@ public class PlayerListFragment implements Fragment{
button.addImage("icon-admin").size(14*2).visible(() -> player.isAdmin && !(!player.isLocal && Net.server())).padRight(5);
if((Net.server() || Vars.player.isAdmin) && !player.isLocal && !player.isAdmin){
if((Net.server() || Vars.player.isAdmin) && !player.isLocal && (!player.isAdmin || Net.server())){
button.add().growY();
float bs = (h + 14)/2f;
@@ -163,8 +163,8 @@ public class PlayerListFragment implements Fragment{
}).update(b -> b.setChecked(connection != null && netServer.admins.isAdmin(connection.address)))
.disabled(Net.client());
//TODO unused?
t.addImageButton("icon-cancel", 14*2, () -> {});
//TODO trace info for player
t.addImageButton("icon-zoom-small", 14*2, () -> NetEvents.handleTraceRequest(player));
}).padRight(12).padTop(-5).padLeft(0).padBottom(-10).size(bs + 10f, bs);