add char descs
This commit is contained in:
parent
c130bb1272
commit
1219616a44
3 changed files with 20 additions and 5 deletions
|
@ -419,17 +419,22 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}, "Spieler-Größe", "cm")).enabled = this.gm.thePlayer == null || this.gm.thePlayer.getMinSize() != this.gm.thePlayer.getMaxSize();
|
||||
this.add(new Label(width / 2 - 200, 36, 400, 20, "Name", true));
|
||||
final Textbox descField = this.add(new Textbox(width - 396, height - 384, 392, 160, Player.MAX_INFO_LENGTH, new Textbox.Callback() {
|
||||
public void use(Textbox elem, Action value) {
|
||||
}
|
||||
}, ""));
|
||||
this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
if(GuiChar.this.gm.thePlayer != null) {
|
||||
GuiChar.this.gm.waitForServer();
|
||||
Dimension dim = // GuiChar.this.dimension == Integer.MAX_VALUE ? Space.INSTANCE :
|
||||
UniverseRegistry.getBaseDimensions().get(GuiChar.this.dimension);
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.INFO, descField.getText()));
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR, dim.getDimensionId()));
|
||||
}
|
||||
}
|
||||
}, "Charakter erstellen"));
|
||||
Textbox nameField = this.add(new Textbox(width / 2 - 200, 36 + 20, 400, 24, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() {
|
||||
this.add(new Textbox(width / 2 - 200, 36 + 20, 400, 24, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() {
|
||||
public void use(Textbox elem, Action value) {
|
||||
if(value == Action.SEND || value == Action.UNFOCUS) {
|
||||
String name = elem.getText();
|
||||
|
@ -458,7 +463,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}
|
||||
this.dimButton = this.add(new ActButton(width - 396, height - 300, 392, 24, new ActButton.Callback() {
|
||||
this.dimButton = this.add(new ActButton(width - 396, height - 220, 392, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode mode) {
|
||||
if(mode == Mode.TERTIARY) {
|
||||
GuiChar.this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size());
|
||||
|
@ -479,7 +484,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
GuiChar.this.setDimButton();
|
||||
}
|
||||
}, ""));
|
||||
this.descLines = this.add(new TransparentBox(width - 396, height - 300 + 24, 392, 160, "", false));
|
||||
this.descLines = this.add(new TransparentBox(width - 396, height - 220 + 24, 392, 76, "", false));
|
||||
this.setDimButton();
|
||||
}
|
||||
|
||||
|
|
|
@ -1958,7 +1958,7 @@ public class Player extends NetHandler implements ICrafting, Executor
|
|||
}
|
||||
|
||||
CPacketMessage.Type type = packetIn.getType();
|
||||
if(this.charEditor != (type == CPacketMessage.Type.DISPLAY))
|
||||
if(this.charEditor != (type == CPacketMessage.Type.DISPLAY || type == CPacketMessage.Type.INFO))
|
||||
return;
|
||||
|
||||
switch(type) {
|
||||
|
@ -1978,6 +1978,12 @@ public class Player extends NetHandler implements ICrafting, Executor
|
|||
this.entity.setCustomNameTag(msg);
|
||||
break;
|
||||
|
||||
case INFO:
|
||||
if(msg.length() > MAX_INFO_LENGTH)
|
||||
throw new IllegalArgumentException("Ungültige Beschreibung");
|
||||
this.entity.setDescription(msg.isEmpty() ? null : msg);
|
||||
break;
|
||||
|
||||
// case ITEM:
|
||||
// if(this.entity.openContainer instanceof ContainerRepair)
|
||||
// ((ContainerRepair)this.entity.openContainer).updateItemName(msg);
|
||||
|
|
|
@ -49,7 +49,11 @@ public class CPacketMessage implements Packet<Player>
|
|||
}
|
||||
|
||||
public static enum Type {
|
||||
COMMAND(Player.MAX_CMD_LENGTH), CHAT(Player.MAX_CMD_LENGTH), DISPLAY(Player.MAX_NICK_LENGTH); // , ITEM(30);
|
||||
COMMAND(Player.MAX_CMD_LENGTH),
|
||||
CHAT(Player.MAX_CMD_LENGTH),
|
||||
DISPLAY(Player.MAX_NICK_LENGTH),
|
||||
INFO(Player.MAX_INFO_LENGTH);
|
||||
// , ITEM(30);
|
||||
|
||||
private final int length;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue