From 45594e5b61512402cd8609b6557256a16aff6e2a Mon Sep 17 00:00:00 2001 From: Sen Date: Thu, 4 Sep 2025 12:00:11 +0200 Subject: [PATCH] revert gui element height changes --- .../java/client/gui/character/GuiChar.java | 171 ++++++++++-------- .../client/gui/character/GuiCharacters.java | 10 +- .../java/client/gui/character/GuiClass.java | 6 +- .../java/client/gui/character/GuiSpecies.java | 6 +- 4 files changed, 103 insertions(+), 90 deletions(-) diff --git a/client/src/main/java/client/gui/character/GuiChar.java b/client/src/main/java/client/gui/character/GuiChar.java index 0883e300..6ee946ee 100755 --- a/client/src/main/java/client/gui/character/GuiChar.java +++ b/client/src/main/java/client/gui/character/GuiChar.java @@ -278,7 +278,7 @@ public class GuiChar extends GuiList this.dimensions.add(dim); } this.waiting = true; - this.setDimensions(390, height, 32, height - 32); + this.setDimensions(390, height, BASE_HEIGHT + BASE_GAP * 2, height - BASE_HEIGHT - BASE_GAP * 2); if(this.gm.getRenderManager().gm == null) { this.unload(); this.adjust = null; @@ -286,7 +286,7 @@ public class GuiChar extends GuiList } this.currentSkin = this.gm.player != null && !EntityTexManager.hasCustomSkin(this.gm.player.getId()) ? this.gm.player.getChar() : null; this.load(this.gm.player == null ? ModelType.HUMANOID : this.gm.player.getModel(), this.gm.player != null ? this.gm.player.getSpecies() : SpeciesRegistry.CLASSES.get(EntityHuman.class)); - this.add(new ActButton(2, 12, 193, 0, new ButtonCallback() { + this.add(new ActButton(2, BASE_GAP, 193, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren", TEXTURE_FOLDER, new FileCallback() { public void selected(File file) { @@ -296,7 +296,7 @@ public class GuiChar extends GuiList }); } }, "Importieren: Standard")); - this.add(new ActButton(197, 12, 193, 0, new ButtonCallback() { + this.add(new ActButton(197, BASE_GAP, 193, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.showFileDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren (schlank)", TEXTURE_FOLDER, new FileCallback() { public void selected(File file) { @@ -306,13 +306,13 @@ public class GuiChar extends GuiList }); } }, "Importieren: Schlank")); - this.addSelector("char_filter_species", 392, 12, 250, 0); - this.add(new ActButton(2, height - 30, 193, 0, new ButtonCallback() { + this.addSelector("char_filter_species", 392, BASE_GAP, 250, 0); + this.add(new ActButton(2, height - BASE_SHIFT, 193, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { GuiChar.this.gm.show(GuiChar.this); } }, "Neu laden")); - this.templateButton = this.add(new ActButton(197, height - 30, 193, 0, new ButtonCallback() { + this.templateButton = this.add(new ActButton(197, height - BASE_SHIFT, 193, 0, new ButtonCallback() { public void use(ActButton elem, PressType action) { SkinEntry skin = GuiChar.this.getSelected(); if(skin != null && skin.getLocation() != null) { @@ -346,64 +346,24 @@ public class GuiChar extends GuiList } } }, "Vorlage kopieren")); - if(width >= 784 + 460 && height >= 128 + 640) - this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640)); - else - this.adjust = this.add(new DragAdjust(390 - 115 - 4, height - 32 - 160 - 4, 115, 160)); - - this.add(new Label(width - 390, 48, 388, "Spezies: " + (this.gm.player == null ? "" : this.gm.player.getSpecies().name), true)); - this.add(new NavButton(width - 390, 48, 388, 0, GuiSpecies.INSTANCE, "Spezies ändern")); - this.add(new Label(width - 390, 82, 388, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "" : this.gm.player.getNpcClass().toString()), true)) - .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; - this.add(new NavButton(width - 390, 82, 388, 0, GuiClass.INSTANCE, "Klasse ändern")) - .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; - final ActButton[] alignBtns = new ActButton[Alignment.values().length]; - for (int z = 0; z < Alignment.values().length; z++) - { - final Alignment align = Alignment.values()[z]; - alignBtns[z] = this.add(new ActButton(width - 390 + (z % 3) * 130, height - 32 - 20 * 3 + 20 * (z / 3), 128, 0, new ButtonCallback() { - public void use(ActButton elem, PressType action) { - if(GuiChar.this.gm.player != null) { - GuiChar.this.waiting = false; - GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal())); - for(ActButton btn : alignBtns) { - btn.enabled = btn != elem; - } - } - } - }, align.color + align.display)); - alignBtns[z].enabled = this.gm.player == null || this.gm.player.getAlignment() != align; - } - this.add(new Slider(width - 390, 136, 388, 0, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() { - public void use(Slider elem, int value) { - if(GuiChar.this.gm.player != null) { - GuiChar.this.waiting = false; - GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value)); - } - } - }, "Spieler-Größe", "cm")).enabled = this.gm.player == null || this.gm.player.getMinSize() != this.gm.player.getMaxSize(); - this.add(new Label(width - 390, 116, 388, "Name", true)); - this.add(new Label(width - 390, 170, 388, "Beschreibung", true)); - final Area descField = this.add(new Area(width - 390, 170, 388, height - 328, IPlayer.MAX_INFO_LENGTH, "")); - this.add(new ActButton(width - 195, height - 30, 193, 0, new ButtonCallback() { - public void use(ActButton elem, PressType action) { - if(GuiChar.this.gm.player != null) { - GuiChar.this.gm.show(new GuiLoading("Lade Welt ...")); - Dimension dim = GuiChar.this.dimensions.get(GuiChar.this.dimension); - GuiChar.this.gm.player.client.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText())); - GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, DimensionMapping.getId(dim))); - } - } - }, "Charakter erstellen")); - this.cancelButton = this.add(new ActButton(width - 390, height - 30, 193, 0, new ButtonCallback() { - public void use(ActButton elem, PressType action) { - if(GuiChar.this.gm.player != null) - GuiChar.this.gm.show(GuiCharacters.INSTANCE); - } - }, "Abbrechen")); - this.setCharsAvailable(); - this.add(new Field(width - 390, 116, 388, 0, IPlayer.MAX_NICK_LENGTH, new FieldCallback() { + if(width >= 784 + 460 && height >= 128 + 640) + this.adjust = this.add(new DragAdjust(width / 2 - 230, height - (BASE_HEIGHT + BASE_GAP * 2) * 2 - 640, 460, 640)); + else + this.adjust = this.add(new DragAdjust(390 - 115 - 4, height - (BASE_HEIGHT + BASE_GAP * 2) - 160 - 4, 115, 160)); + + int y = BASE_HEIGHT + BASE_GAP * 2 + LABEL_SHIFT - BASE_SHIFT; + + this.add(new Label(width - 390, y, 388, "Spezies: " + (this.gm.player == null ? "" : this.gm.player.getSpecies().name), true)); + this.add(new NavButton(width - 390, y, 388, 0, GuiSpecies.INSTANCE, "Spezies ändern")); + + this.add(new Label(width - 390, y += LABEL_SHIFT, 388, "Klasse: " + (this.gm.player == null || this.gm.player.getSpecies().classEnum == null || this.gm.player.getNpcClass() == null || this.gm.player.getNpcClass().toString().isEmpty() ? "" : this.gm.player.getNpcClass().toString()), true)) + .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; + this.add(new NavButton(width - 390, y, 388, 0, GuiClass.INSTANCE, "Klasse ändern")) + .enabled = this.gm.player != null && this.gm.player.getSpecies().classEnum != null; + + this.add(new Label(width - 390, y += LABEL_SHIFT, 388, "Name", true)); + this.add(new Field(width - 390, y, 388, 0, IPlayer.MAX_NICK_LENGTH, new FieldCallback() { public void use(Field elem, FieldAction value) { if(value == FieldAction.SEND || value == FieldAction.UNFOCUS) { String name = elem.getText(); @@ -416,21 +376,17 @@ public class GuiChar extends GuiList } } }, IPlayer.VALID_NICK, this.gm.player == null ? "" : this.gm.player.getCustomNameTag())); - this.templateButton.enabled = false; - this.dimension = new Random().zrange(this.dimensions.size()); - EntityInfo info = EntityRegistry.DNA.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player)); - if(info != null && info.origin() != null) { - Dimension dim = DimensionMapping.getDimension(info.origin()); - if(dim != null) { - for(int z = 0; z < this.dimensions.size(); z++) { - if(this.dimensions.get(z) == dim) { - this.dimension = z; - break; - } - } - } - } - this.dimButton = this.add(new ActButton(width - 390, height - 156, 388, 0, new ButtonCallback() { + + this.add(new Slider(width - 390, y += SEPARATOR_SHIFT, 388, 0, 1, this.gm.player == null ? 120 : this.gm.player.getMinSize(), this.gm.player == null ? 320 : this.gm.player.getMaxSize(), this.gm.player == null ? 180 : this.gm.player.getDefaultSize(), this.gm.player == null ? 180 : this.gm.player.getCurrentSize(), new SliderCallback() { + public void use(Slider elem, int value) { + if(GuiChar.this.gm.player != null) { + GuiChar.this.waiting = false; + GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value)); + } + } + }, "Spieler-Größe", "cm")).enabled = this.gm.player == null || this.gm.player.getMinSize() != this.gm.player.getMaxSize(); + + this.dimButton = this.add(new ActButton(width - 390, y += SEPARATOR_SHIFT, 388, 0, new ButtonCallback() { public void use(ActButton elem, PressType mode) { if(mode == PressType.TERTIARY) { GuiChar.this.dimension = new Random().zrange(GuiChar.this.dimensions.size()); @@ -446,7 +402,64 @@ public class GuiChar extends GuiList GuiChar.this.setDimButton(); } }, "")); - this.descLines = this.add(new MultiLabel(width - 390, height - 156 + BASE_HEIGHT, 388, 42, "", true)); + this.descLines = this.add(new MultiLabel(width - 390, y + BASE_HEIGHT, 388, 42, "", true)); + + this.add(new Label(width - 390, y += LABEL_SHIFT + 42, 388, "Ausrichtung", true)); + final ActButton[] alignBtns = new ActButton[Alignment.values().length]; + for (int z = 0; z < Alignment.values().length; z++) + { + if(z != 0 && z % 3 == 0) + y += BASE_SHIFT; + final Alignment align = Alignment.values()[z]; + alignBtns[z] = this.add(new ActButton(width - 390 + (z % 3) * 130, y, 128, 0, new ButtonCallback() { + public void use(ActButton elem, PressType action) { + if(GuiChar.this.gm.player != null) { + GuiChar.this.waiting = false; + GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal())); + for(ActButton btn : alignBtns) { + btn.enabled = btn != elem; + } + } + } + }, align.color + align.display)); + alignBtns[z].enabled = this.gm.player == null || this.gm.player.getAlignment() != align; + } + + this.add(new Label(width - 390, y += LABEL_SHIFT, 388, "Beschreibung", true)); + final Area descField = this.add(new Area(width - 390, y, 388, height - y - BASE_HEIGHT - BASE_GAP * 3, IPlayer.MAX_INFO_LENGTH, "")); + + this.add(new ActButton(width - 195, height - BASE_SHIFT, 193, 0, new ButtonCallback() { + public void use(ActButton elem, PressType action) { + if(GuiChar.this.gm.player != null) { + GuiChar.this.gm.show(new GuiLoading("Lade Welt ...")); + Dimension dim = GuiChar.this.dimensions.get(GuiChar.this.dimension); + GuiChar.this.gm.player.client.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText())); + GuiChar.this.gm.player.client.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, DimensionMapping.getId(dim))); + } + } + }, "Charakter erstellen")); + this.cancelButton = this.add(new ActButton(width - 390, height - BASE_SHIFT, 193, 0, new ButtonCallback() { + public void use(ActButton elem, PressType action) { + if(GuiChar.this.gm.player != null) + GuiChar.this.gm.show(GuiCharacters.INSTANCE); + } + }, "Abbrechen")); + + this.setCharsAvailable(); + this.templateButton.enabled = false; + this.dimension = new Random().zrange(this.dimensions.size()); + EntityInfo info = EntityRegistry.DNA.get(this.gm.player == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.player)); + if(info != null && info.origin() != null) { + Dimension dim = DimensionMapping.getDimension(info.origin()); + if(dim != null) { + for(int z = 0; z < this.dimensions.size(); z++) { + if(this.dimensions.get(z) == dim) { + this.dimension = z; + break; + } + } + } + } this.setDimButton(); } diff --git a/client/src/main/java/client/gui/character/GuiCharacters.java b/client/src/main/java/client/gui/character/GuiCharacters.java index 079c2f7f..7e9e1051 100644 --- a/client/src/main/java/client/gui/character/GuiCharacters.java +++ b/client/src/main/java/client/gui/character/GuiCharacters.java @@ -72,7 +72,7 @@ public class GuiCharacters extends GuiList impleme public void init(int width, int height) { super.init(width, height); - this.setDimensions(width - 300, height, 32, height - 32); + this.setDimensions(width - 300, height, BASE_HEIGHT + BASE_GAP * 2, height - BASE_HEIGHT - BASE_GAP * 2); this.elements.clear(); int selected = this.gm.selectedCharacter; for(PlayerCharacter character : this.gm.characterList) { @@ -81,10 +81,10 @@ public class GuiCharacters extends GuiList impleme if(!this.gm.charEditor) this.elements.add(new CharacterEntry(null, false)); this.setSelected(ExtMath.clampi(selected, -1, this.elements.size() - 1)); - this.descField = this.add(new Area(width - 300, 32, 300, height - 64, "")); - this.deleteButtom = this.add(new ActButton(width / 2 - 302, height - 30, 200, 0, this, "Charakter löschen")); - this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 30, 200, 0, this, "")); - this.add(new NavButton(width / 2 + 102, height - 30, 200, 0, this.gm.charEditor ? GuiChar.INSTANCE : GuiMenu.INSTANCE, this.gm.charEditor ? "Zurück" : "Abbrechen")); + this.descField = this.add(new Area(width - 300, BASE_HEIGHT + BASE_GAP * 2, 300, height - (BASE_HEIGHT + BASE_GAP * 2) * 2, "")); + this.deleteButtom = this.add(new ActButton(width / 2 - 302, height - BASE_SHIFT, 200, 0, this, "Charakter löschen")); + this.actionButtom = this.add(new ActButton(width / 2 - 100, height - BASE_SHIFT, 200, 0, this, "")); + this.add(new NavButton(width / 2 + 102, height - BASE_SHIFT, 200, 0, this.gm.charEditor ? GuiChar.INSTANCE : GuiMenu.INSTANCE, this.gm.charEditor ? "Zurück" : "Abbrechen")); this.updateButtons(); } diff --git a/client/src/main/java/client/gui/character/GuiClass.java b/client/src/main/java/client/gui/character/GuiClass.java index 16aa52ed..a3e18c1a 100644 --- a/client/src/main/java/client/gui/character/GuiClass.java +++ b/client/src/main/java/client/gui/character/GuiClass.java @@ -44,14 +44,14 @@ public class GuiClass extends GuiList implements ButtonCall public void init(int width, int height) { super.init(width, height); - this.setDimensions(width, height, 32, height - 32); + this.setDimensions(width, height, BASE_HEIGHT + BASE_GAP * 2, height - BASE_HEIGHT - BASE_GAP * 2); this.elements.clear(); if(this.gm.player != null && this.gm.player.getSpecies().classEnum != null) for(Enum clazz : this.gm.player.getSpecies().classEnum.getEnumConstants()) { this.elements.add(new ClassEntry(clazz)); } - this.add(new NavButton(width / 2 - 195, height - 30, 194, 0, GuiChar.INSTANCE, "Zurück")); - this.selectButton = this.add(new ActButton(width / 2 + 1, height - 30, 194, 0, this, "Klasse ändern")); + this.add(new NavButton(width / 2 - BASE_WIDTH - BASE_GAP / 2, height - BASE_SHIFT, 0, 0, GuiChar.INSTANCE, "Zurück")); + this.selectButton = this.add(new ActButton(width / 2 + BASE_GAP / 2, height - BASE_SHIFT, 0, 0, this, "Klasse ändern")); } public String getTitle() { diff --git a/client/src/main/java/client/gui/character/GuiSpecies.java b/client/src/main/java/client/gui/character/GuiSpecies.java index 6f190db8..0c51ba3b 100644 --- a/client/src/main/java/client/gui/character/GuiSpecies.java +++ b/client/src/main/java/client/gui/character/GuiSpecies.java @@ -49,13 +49,13 @@ public class GuiSpecies extends GuiList implements Butt public void init(int width, int height) { super.init(width, height); - this.setDimensions(width, height, 32, height - 32); + this.setDimensions(width, height, BASE_HEIGHT + BASE_GAP * 2, height - BASE_HEIGHT - BASE_GAP * 2); this.elements.clear(); for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { this.elements.add(new SpeciesEntry(species)); } - this.add(new NavButton(width / 2 - 195, height - 30, 194, 0, GuiChar.INSTANCE, "Zurück")); - this.selectButton = this.add(new ActButton(width / 2 + 1, height - 30, 194, 0, this, "Spezies ändern")); + this.add(new NavButton(width / 2 - BASE_WIDTH - BASE_GAP / 2, height - BASE_SHIFT, 0, 0, GuiChar.INSTANCE, "Zurück")); + this.selectButton = this.add(new ActButton(width / 2 + BASE_GAP / 2, height - BASE_SHIFT, 0, 0, this, "Spezies ändern")); } public String getTitle() {