more ui improvements

This commit is contained in:
Sen 2025-06-12 20:11:59 +02:00
parent 48918f0139
commit 836094a00b
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
6 changed files with 35 additions and 42 deletions

View file

@ -2351,7 +2351,7 @@ public class Client implements IThreadListener {
public void disconnected(String msg) {
Log.NETWORK.info("Getrennt: %s", msg);
this.unload(true);
this.displayGuiScreen(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg, true));
this.displayGuiScreen(new GuiInfo("Von Server getrennt", TextColor.RED + "Verbindung zum Server wurde getrennt\n\n" + TextColor.RESET + msg));
}
@ -2560,7 +2560,7 @@ public class Client implements IThreadListener {
public String apply(DebugFunction func) {
return TextColor.CYAN + bind + TextColor.RED + "+" + TextColor.GREEN + func.key.getDisplay() + TextColor.GRAY + " - " + TextColor.YELLOW + func.help;
}
}, Client.this.debug.values()), true));
}, Client.this.debug.values())));
}
});
this.registerDebug(Keysym.N, "NoClip umschalten", new DebugRunner() {

View file

@ -158,12 +158,12 @@ public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements Button
(this.keypair != null ? "Pubkey " + this.keyDigest : "") + (this.keypair != null && !this.password.isEmpty() ? " + " : "") + (!this.password.isEmpty() ? "Passwort" : ""),
x + width - 2, y, 0xffffffff);
Drawing.drawText(this.address + TextColor.GRAY + " Port " + TextColor.RESET + this.port + (this.enforceEncryption ? TextColor.GRAY + ", nur verschlüsselt" : ""),
x + 2, y + 18, 0xff808080);
x + 2, y + 18, 0xffb0b0b0);
if(!this.access.isEmpty())
Drawing.drawTextRight((this.keypair != null || !this.password.isEmpty() ? "+ " : "") + "Server-Passwort", x + width - 2, y + 18, 0xff808080);
Drawing.drawText("Zuletzt verbunden: " + (this.lastConnected == -1L ? "nie" : DATE_FORMAT.format(new Date(this.lastConnected))), x + 2, y + 18 + 16, 0xff808080);
Drawing.drawTextRight((this.keypair != null || !this.password.isEmpty() ? "+ " : "") + "Server-Passwort", x + width - 2, y + 18, 0xffb0b0b0);
Drawing.drawText("Zuletzt verbunden: " + (this.lastConnected == -1L ? "nie" : DATE_FORMAT.format(new Date(this.lastConnected))), x + 2, y + 18 + 16, 0xffb0b0b0);
if(this.serverDigest != null)
Drawing.drawTextRight("Server-ID: " + this.serverDigest, x + width - 2, y + 18 + 16, 0xff808080);
Drawing.drawTextRight("Server-ID: " + this.serverDigest, x + width - 2, y + 18 + 16, 0xffb0b0b0);
}
}

View file

@ -1,10 +1,8 @@
package client.gui;
import client.Client;
import client.gui.element.Element;
import client.gui.element.MultiLabel;
import client.gui.element.NavButton;
import client.gui.element.TransparentArea;
import common.Version;
import common.color.TextColor;
import common.log.Log;
@ -34,12 +32,11 @@ public class GuiInfo extends Gui {
"JOrbis 20101023 (JCraft) - jogg, jorbis, CodecJOrbis"
};
public static final GuiInfo INSTANCE = new GuiInfo("Über dieses Programm", getFormat(false), true);
public static final GuiInfo HAX = new GuiInfo("Üb3r d1es3n Cr4ck", getFormat(true), true);
public static final GuiInfo INSTANCE = new GuiInfo("Über dieses Programm", getFormat(false));
public static final GuiInfo HAX = new GuiInfo("Üb3r d1es3n Cr4ck", getFormat(true));
private final String header;
private final String info;
private final boolean center;
private static String getFormat(boolean hax) {
return getInfo(hax) + "\n\n" + getCredits(hax) + "\n\n" + getLibraries(hax) + "\n\n" + getCode(hax) + "\n\n" + getColors();
@ -104,15 +101,14 @@ public class GuiInfo extends Gui {
return sb.toString();
}
public GuiInfo(String header, String info, boolean center) {
public GuiInfo(String header, String info) {
this.header = header;
this.info = info;
this.center = center;
}
public void init(int width, int height) {
this.add(this.center ? new MultiLabel(10, 10, width - 20, height - 44, this.info, false) : new TransparentArea(10, 10, width - 20, height - 44, this.info, this.gm.world != null && !this.gm.charEditor));
this.add(new NavButton(0, height - Element.BASE_HEIGHT, width, 0, GuiMenu.INSTANCE, "Zurück"));
this.add(new MultiLabel(10, 10, width - 20, height - 44, this.info, false));
this.add(new NavButton((width - 280) / 2, height - 20, 280, 0, GuiMenu.INSTANCE, "Zurück"));
}
public String getTitle() {

View file

@ -68,32 +68,31 @@ public class GuiServer extends Gui implements FieldCallback {
public void init(int width, int height) {
if(this.server != null) {
this.nameBox = this.add(new Field(0, -50, 400, 0, 128, this, this.server.getName()));
this.nameBox = this.add(new Field(0, 0, 400, 0, 128, this, this.server.getName()));
this.nameLabel = this.add(new Label(0, 0, 410, "Name in der Liste", true));
this.keypair = this.server.getKeypair();
this.keyDigest = this.keypair == null ? null : EncryptUtil.getXorSha512Hash(this.keypair.getPublic().getEncoded());
}
this.addrBox = this.add(new Field(0, 20, 400, 0, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
this.addrBox = this.add(new Field(0, 34, 400, 0, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
this.addrLabel = this.add(new Label(0, 34, 410, "Adresse / Hostname", true));
int port = this.server == null ? this.lastPort : this.server.getPort();
this.portBox = this.add(new Field(404, 20, 76, 0, 5, this, port < 0 ? "" : "" + port));
this.userBox = this.add(new Field(0, 70, 220, 0, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
this.passBox = this.add(new PasswordField(0, this.server == null ? 120 : 170, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
this.accBox = this.add(new PasswordField(0, this.server == null ? 170 : 220, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
this.add(new ActButton(0, this.server == null ? 220 : 350, 480, 0, new ButtonCallback() {
this.portBox = this.add(new Field(404, 34, 76, 0, 5, this, port < 0 ? "" : "" + port));
this.portLabel = this.add(new Label(404, 34, 76, "Port", true));
this.rangeLabel = this.add(new Label(370, 34 + Element.BASE_HEIGHT, 110, 0, "[1024..32767]", true));
this.userBox = this.add(new Field(0, 68, 220, 0, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
this.userLabel = this.add(new Label(0, 68, 220, "Benutzername", true));
this.passBox = this.add(new PasswordField(0, this.server == null ? 102 : 136, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
this.passLabel = this.add(new Label(0, this.server == null ? 102 : 136, 480, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true));
this.accBox = this.add(new PasswordField(0, this.server == null ? 136 : 170, 480, 0, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
this.accLabel = this.add(new Label(0, this.server == null ? 136 : 170, 480, "Server-Passwort (mind. 8 Zeichen)", true));
this.add(new ActButton(241, this.server == null ? 166 : 254, 239, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiServer.this.connect();
}
}, this.server == null ? "Verbinden" : (this.server.getName().isEmpty() ? "Hinzufügen" : "Übernehmen")));
this.add(new NavButton(0, this.server == null ? 250 : 380, 480, 0, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
if(this.server != null)
this.nameLabel = this.add(new Label(0, -50, 410, "Name in der Liste", true));
this.addrLabel = this.add(new Label(0, 20, 410, "Adresse / Hostname", true));
this.portLabel = this.add(new Label(404, 20, 76, "Port", true));
this.rangeLabel = this.add(new Label(370, 20 + Element.BASE_HEIGHT, 110, 0, "[1024..32767]", true));
this.userLabel = this.add(new Label(0, 70, 220, "Benutzername", true));
this.passLabel = this.add(new Label(0, this.server == null ? 120 : 170, 480, (this.keypair == null ? "Anmelde" : "Ersatz") + "-Passwort (mind. 8 Zeichen)", true));
this.accLabel = this.add(new Label(0, this.server == null ? 170 : 220, 480, "Server-Passwort (mind. 8 Zeichen)", true));
this.add(new NavButton(0, this.server == null ? 166 : 254, 239, 0, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
if(this.server != null) {
this.keyButton = this.add(new ActButton(0, 120, 391, 0, new ButtonCallback() {
this.keyButton = this.add(new ActButton(0, 102, 391, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.keypair == null) {
GuiServer.this.keypair = EncryptUtil.createKeypair();
@ -148,19 +147,18 @@ public class GuiServer extends Gui implements FieldCallback {
}
}
}, this.keypair == null ? "Neues Schlüsselpaar generieren" : "Schlüsselpaar entfernen"));
this.copyKeyButton = this.add(new ActButton(395, 120, 85, 0, new ButtonCallback() {
this.copyKeyButton = this.add(new ActButton(395, 102, 85, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.keypair != null)
Window.setClipboard(EncryptUtil.getArmoredPubkey(GuiServer.this.keypair.getPublic(), GuiServer.this.userBox.getText()));
}
}, "Kopieren"));
this.copyKeyButton.enabled = this.keypair != null;
this.keyLabel = this.add(new Label(0, 120, 480, "Anmelde-Pubkey: " + (this.keypair != null ? "RSA-4096 " + this.keyDigest : "nicht vorhanden"), true));
this.encToggle = this.add(new Toggle(0, 250, 480, 0, false, this.server.requiresEncryption(), null, "Nur Verschlüsselte Verbindung akzeptieren"));
this.keyLabel = this.add(new Label(0, 102, 480, "Anmelde-Pubkey: " + (this.keypair != null ? "RSA-4096 " + this.keyDigest : "nicht vorhanden"), true));
this.encToggle = this.add(new Toggle(0, 190, 480, 0, false, this.server.requiresEncryption(), null, "Nur Verschlüsselte Verbindung akzeptieren"));
this.serverKey = this.server.getServerKey();
this.serverDigest = this.serverKey == null ? null : EncryptUtil.getXorSha512Hash(this.serverKey.getEncoded());
this.idLabel = this.add(new Label(0, 300, 480, "Server-Pubkey: " + (this.serverKey != null ? "RSA-4096 " + this.serverDigest : "nicht vorhanden"), true));
this.resetButton = this.add(new ActButton(0, 300, 391, 0, new ButtonCallback() {
this.resetButton = this.add(new ActButton(0, 224, 391, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.serverKey != null) {
GuiServer.this.serverKey = null;
@ -172,13 +170,14 @@ public class GuiServer extends Gui implements FieldCallback {
}
}, "Server-Identifizierung / Pubkey zurücksetzen"));
this.resetButton.enabled = this.serverKey != null;
this.copyIdButton = this.add(new ActButton(395, 300, 85, 0, new ButtonCallback() {
this.copyIdButton = this.add(new ActButton(395, 224, 85, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiServer.this.serverKey != null)
Window.setClipboard(EncryptUtil.getArmoredPubkey(GuiServer.this.serverKey, GuiServer.this.nameBox.getText()));
}
}, "Kopieren"));
this.copyIdButton.enabled = this.serverKey != null;
this.idLabel = this.add(new Label(0, 224, 480, "Server-Pubkey: " + (this.serverKey != null ? "RSA-4096 " + this.serverDigest : "nicht vorhanden"), true));
}
this.shift();
}

View file

@ -33,7 +33,6 @@ import client.gui.element.Area;
import client.gui.element.ButtonCallback;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
import client.gui.element.TransparentArea;
import client.renderer.Drawing;
import client.renderer.GlState;
import client.renderer.ItemRenderer;

View file

@ -2,7 +2,6 @@ package client.gui.options;
import client.gui.Gui;
import client.gui.GuiMenu;
import client.gui.element.Element;
import client.gui.element.NavButton;
public abstract class GuiOptions extends Gui {
@ -19,8 +18,8 @@ public abstract class GuiOptions extends Gui {
this.shift();
for(int z = 0; z < PAGES.length; z++) {
GuiOptions gui = PAGES[z];
this.add(new NavButton(z % 2 == 1 ? width - 210 : 0, 20 * (z / 2), 210, 0, gui, gui.getTitle()));
this.add(new NavButton(z % 2 == 1 ? width - 212 : 2, 2 + 20 * (z / 2), 210, 0, gui, gui.getTitle()));
}
this.add(new NavButton(210, height - Element.BASE_HEIGHT, width - 420, 0, GuiMenu.INSTANCE, "Zurück"));
this.add(new NavButton((width - 280) / 2, height - 20, 280, 0, GuiMenu.INSTANCE, "Zurück"));
}
}