char gui species name

This commit is contained in:
Sen 2025-03-30 21:15:22 +02:00
parent 5e20c6f90d
commit 40bd8d2758
2 changed files with 8 additions and 7 deletions

View file

@ -374,8 +374,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
} }
}, "Vorlage kopieren")); }, "Vorlage kopieren"));
this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640)); this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640));
this.add(new NavButton(width - 396, 36, 392, 24, GuiSpecies.INSTANCE, "Spezies ändern")); this.add(new Label(width - 396, 36, 392, 20, this.gm.thePlayer == null ? "<?>" : this.gm.thePlayer.getSpecies().name, true));
this.add(new NavButton(width - 396, 56, 392, 24, GuiSpecies.INSTANCE, "Spezies ändern"));
// for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) { // for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
// final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z); // final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z);
// this.add(new ActButton(width - 396 + (z % 2) * 198, 36 + 28 * (z / 2), 194, 24, new ActButton.Callback() { // this.add(new ActButton(width - 396 + (z % 2) * 198, 36 + 28 * (z / 2), 194, 24, new ActButton.Callback() {

View file

@ -11,13 +11,13 @@ import game.init.SpeciesRegistry;
import game.packet.CPacketAction; import game.packet.CPacketAction;
import game.renderer.Drawing; import game.renderer.Drawing;
public class GuiSpecies extends GuiList<GuiSpecies.SkinEntry> implements ActButton.Callback public class GuiSpecies extends GuiList<GuiSpecies.SpeciesEntry> implements ActButton.Callback
{ {
protected class SkinEntry implements ListEntry protected class SpeciesEntry implements ListEntry
{ {
private final SpeciesInfo species; private final SpeciesInfo species;
protected SkinEntry(SpeciesInfo species) protected SpeciesEntry(SpeciesInfo species)
{ {
this.species = species; this.species = species;
} }
@ -49,7 +49,7 @@ public class GuiSpecies extends GuiList<GuiSpecies.SkinEntry> implements ActButt
this.setDimensions(400, height, 32, height - 32); this.setDimensions(400, height, 32, height - 32);
this.elements.clear(); this.elements.clear();
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) { for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
this.elements.add(new SkinEntry(species)); this.elements.add(new SpeciesEntry(species));
} }
this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück")); this.add(new NavButton(width - 198 * 2, height - 28, 194, 24, GuiChar.INSTANCE, "Zurück"));
this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Spezies ändern")); this.selectButton = this.add(new ActButton(width - 198, height - 28, 194, 24, this, "Spezies ändern"));
@ -70,7 +70,7 @@ public class GuiSpecies extends GuiList<GuiSpecies.SkinEntry> implements ActButt
} }
public void use(ActButton elem, Mode action) { public void use(ActButton elem, Mode action) {
SkinEntry entry = this.getSelected(); SpeciesEntry entry = this.getSelected();
if(entry != null && GuiSpecies.this.gm.thePlayer != null) if(entry != null && GuiSpecies.this.gm.thePlayer != null)
GuiSpecies.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(entry.species.clazz))); GuiSpecies.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(entry.species.clazz)));
} }