1
0
Fork 0

revert gui element height changes

This commit is contained in:
Sen 2025-09-04 12:17:56 +02:00
parent 45594e5b61
commit ee494c2d51
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
8 changed files with 21 additions and 25 deletions

View file

@ -6,7 +6,6 @@ import client.Client;
import client.gui.element.ActButton;
import client.gui.element.Area;
import client.gui.element.ButtonCallback;
import client.gui.element.Element;
import client.gui.element.Fill;
import client.gui.element.PressType;
import client.renderer.Drawing;

View file

@ -5,7 +5,6 @@ import client.gui.character.GuiChar;
import client.gui.character.GuiCharacters;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Element;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.PressType;

View file

@ -5,7 +5,6 @@ import java.security.PublicKey;
import client.gui.GuiConnect.ServerInfo;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Element;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.PasswordField;

View file

@ -102,7 +102,6 @@ public abstract class GuiContainer extends Gui
private int cheatWidth;
private int cheatHeight;
private Label cheatLabel;
private MultiLabel cheatDesc;
private Field cheatSearch;
private String cheatLast;
@ -293,7 +292,7 @@ public abstract class GuiContainer extends Gui
this.cheatX = this.container_x + this.container_w + 4;
this.cheatY = 16;
this.cheatWidth = Math.max((this.gm.fbX - this.container_x - this.container_w - 16) / 18, 1);
this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 100) / 18, 1);
this.cheatHeight = Math.max((this.gm.fbY - 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 46) / 18, 1);
}
}
@ -307,8 +306,8 @@ public abstract class GuiContainer extends Gui
}
if(this.gm.itemCheat) {
this.cheatLabel = this.add(new FontLabel(this.cheatX, this.cheatY, this.cheatWidth * 18, Font.SMALL, "", true));
this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)"));
this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18, 0, 128, null, ""));
// this.cheatDesc = this.add(new DisplayLabel(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4 + 18, this.cheatWidth * 18, 4, Font.SMALL, "Vorsicht: Schummeln\nwird mit Keule bestraft!!\n(Halte Strg beim Klick\nfür vollen Stapel)"));
this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18 + 10, 0, 128, null, ""));
this.cheatLast = "";
for(CheatTab tab : CheatTab.values()) {
this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, false, null));

View file

@ -32,14 +32,14 @@ public class GuiForm extends Gui implements ButtonCallback {
private boolean sent;
public void init(int width, int height) {
this.add(new Label(0, -100, 300, 0, this.title));
this.add(new Label(0, -100, 0, 0, this.title));
for(int z = 0; z < this.inputs.length; z++) {
final int index = z;
final String name = this.inputData[z].first();
Object obj = this.inputData[z].second();
int param = this.inputData[z].third();
if(obj instanceof Boolean bool) {
this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 0, bool, bool, new ToggleCallback() {
this.inputs[z] = this.add(new Toggle(0, 50 * z, 0, 0, bool, bool, new ToggleCallback() {
public void use(Toggle elem, boolean value) {
GuiForm.this.outputData[index] = value;
}
@ -47,7 +47,7 @@ public class GuiForm extends Gui implements ButtonCallback {
}
else if(obj instanceof String[] strs) {
param = ExtMath.clampi(param, 0, strs.length - 1);
this.inputs[z] = this.add(new Switch<String>(0, 50 * z, 300, 0, strs, strs[param], strs[param], new SwitchCallback<String>() {
this.inputs[z] = this.add(new Switch<String>(0, 50 * z, 0, 0, strs, strs[param], strs[param], new SwitchCallback<String>() {
public void use(Switch<String> elem, String value) {
for(int n = 0; n < strs.length; n++) {
if(value == strs[n]) {
@ -59,19 +59,19 @@ public class GuiForm extends Gui implements ButtonCallback {
}, name));
}
else {
this.labels[z] = this.add(new Label(0, 50 * z, 300, name, true));
this.labels[z] = this.add(new Label(0, 50 * z, 0, name, true));
FieldCallback callback = new FieldCallback() {
public void use(Field elem, FieldAction value) {
if(value == FieldAction.FOCUS)
GuiForm.this.labels[index].setText(name);
}
};
this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj) :
new Field(0, 50 * z, 300, 0, Math.min(param & 0xffff, 1024), callback, (String)obj));
this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 0, 0, Math.min(param & 0xffff, 1024), callback, (String)obj) :
new Field(0, 50 * z, 0, 0, Math.min(param & 0xffff, 1024), callback, (String)obj));
}
}
this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 0, null, "Abbrechen"));
this.add(new ActButton(152, 50 * (this.inputs.length + 1), 148, 0, this, "Senden"));
this.add(new NavButton(0, 50 * (this.inputs.length + 1), (BASE_WIDTH - BASE_GAP) / 2, 0, null, "Abbrechen"));
this.add(new ActButton((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP, 50 * (this.inputs.length + 1), (BASE_WIDTH - BASE_GAP) / 2, 0, this, "Senden"));
this.shift();
}

View file

@ -22,7 +22,7 @@ public class GuiGameOver extends Gui {
this.timer = 0;
this.add(new Label(0, 0, 400, 0, Color.DARK_RED + "Du bist gestorben!"));
this.add(new MultiLabel(0, 32, 400, 42, String.format(Color.GREEN + "Letzte Position" + Color.GRAY + ":\n" + Color.YELLOW + "%d, %d, %d\n" + Color.YELLOW + "%s", ExtMath.floord(this.gm.player.posX), ExtMath.floord(this.gm.player.posY), ExtMath.floord(this.gm.player.posZ), this.gm.player.worldObj.dimension.getDisplay())));
this.button = this.add(new ActButton(100, 100, 200, 0, new ButtonCallback() {
this.button = this.add(new ActButton((400 - BASE_WIDTH) / 2, 100, 0, 0, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiGameOver.this.gm.player.respawnPlayer();
GuiGameOver.this.gm.show(null);

View file

@ -24,10 +24,10 @@ public class GuiRename extends Gui implements FieldCallback, ButtonCallback {
private ActButton button;
public void init(int width, int height) {
this.add(new Label(0, -140, 300, 0, "Benenne " + this.itemName + " um"));
this.lines = this.add(new Field(0, 0, 300, 0, 50, this, this.origName));
this.add(new NavButton(0, 40, 149, 0, this.previous, "Abbrechen"));
this.button = this.add(new ActButton(151, 40, 149, 0, this, "Umbenennen"));
this.add(new Label(0, -140, 0, 0, "Benenne " + this.itemName + " um"));
this.lines = this.add(new Field(0, 0, 0, 0, 50, this, this.origName));
this.add(new NavButton(0, 40, (BASE_WIDTH - BASE_GAP) / 2, 0, this.previous, "Abbrechen"));
this.button = this.add(new ActButton((BASE_WIDTH - BASE_GAP) / 2 + BASE_GAP, 40, (BASE_WIDTH - BASE_GAP) / 2, 0, this, "Umbenennen"));
this.shift();
}

View file

@ -16,13 +16,13 @@ public class GuiSign extends Gui implements FieldCallback {
private final String[] tempLines;
public void init(int width, int height) {
this.add(new Label(0, -140, 300, 0, "Bearbeite Schild"));
this.add(new Label(0, -80, 300, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ())));
this.add(new Label(0, -50, 300, 0, this.gm.world == null ? "<?>" : this.gm.world.dimension.getDisplay()));
this.add(new Label(0, -140, 0, 0, "Bearbeite Schild"));
this.add(new Label(0, -80, 0, 0, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ())));
this.add(new Label(0, -50, 0, 0, this.gm.world == null ? "<?>" : this.gm.world.dimension.getDisplay()));
for(int z = 0; z < this.lines.length; z++) {
this.lines[z] = this.add(new Field(0, 40 * z, 300, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z]));
this.lines[z] = this.add(new Field(0, 40 * z, 0, 0, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z]));
}
this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 0, null, "Fertig"));
this.add(new NavButton(0, 40 * (this.lines.length + 1), 0, 0, null, "Fertig"));
this.shift();
}