commands, camera, messages, overlay, ..

This commit is contained in:
Sen 2025-03-26 12:22:32 +01:00
parent 75f91dbf4c
commit d45cd7ec2c
126 changed files with 854 additions and 628 deletions

View file

@ -29,8 +29,8 @@ public class GuiConfirm extends Gui implements ActButton.Callback {
public void init(int width, int height) {
this.add(new Label(0, 0, 500, 24, this.messageLine1, true));
this.add(new TransparentBox(0, 80, 500, 300, this.messageLine2));
this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, (ActButton.Callback)this, this.confirmButtonText));
this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, (ActButton.Callback)this, this.cancelButtonText));
this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, this, this.confirmButtonText));
this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, this, this.cancelButtonText));
this.shift();
}

View file

@ -6,7 +6,7 @@ import game.gui.element.Label;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.init.Config;
import game.network.NetHandlerPlayServer;
import game.network.Player;
import game.vars.CVarCategory;
import game.vars.Variable;
@ -31,19 +31,19 @@ public class GuiConnect extends Gui implements Textbox.Callback {
private String lastAddr = "";
@Variable(name = "srv_last_port", category = CVarCategory.SYSTEM, min = 0, max = 65535, display = "Letzter Server-Port")
private int lastPort = Config.PORT;
@Variable(name = "srv_last_user", category = CVarCategory.SYSTEM, max = NetHandlerPlayServer.MAX_USER_LENGTH, display = "Letzter Server-Nutzer", validator = NetHandlerPlayServer.UserValidator.class)
@Variable(name = "srv_last_user", category = CVarCategory.SYSTEM, max = Player.MAX_USER_LENGTH, display = "Letzter Server-Nutzer", validator = Player.UserValidator.class)
private String lastUser = "";
@Variable(name = "srv_last_password", category = CVarCategory.SYSTEM, max = NetHandlerPlayServer.MAX_PASS_LENGTH, display = "Letztes Server-Passwort")
@Variable(name = "srv_last_password", category = CVarCategory.SYSTEM, max = Player.MAX_PASS_LENGTH, display = "Letztes Server-Passwort")
private String lastPass = "";
@Variable(name = "srv_last_access", category = CVarCategory.SYSTEM, max = NetHandlerPlayServer.MAX_PASS_LENGTH, display = "Letzter Server-Zugang")
@Variable(name = "srv_last_access", category = CVarCategory.SYSTEM, max = Player.MAX_PASS_LENGTH, display = "Letzter Server-Zugang")
private String lastAcc = "";
public void init(int width, int height) {
this.addrBox = this.add(new Textbox(0, 20, 400, 24, 128, true, this, this.lastAddr));
this.portBox = this.add(new Textbox(404, 20, 76, 24, 5, true, this, "" + this.lastPort));
this.userBox = this.add(new Textbox(0, 70, 220, 24, NetHandlerPlayServer.MAX_USER_LENGTH, true, this, NetHandlerPlayServer.VALID_USER, this.lastUser));
this.passBox = this.add(new Textbox(0, 120, 480, 24, NetHandlerPlayServer.MAX_PASS_LENGTH, true, this, this.lastPass));
this.accBox = this.add(new Textbox(0, 170, 480, 24, NetHandlerPlayServer.MAX_PASS_LENGTH, true, this, this.lastAcc));
this.userBox = this.add(new Textbox(0, 70, 220, 24, Player.MAX_USER_LENGTH, true, this, Player.VALID_USER, this.lastUser));
this.passBox = this.add(new Textbox(0, 120, 480, 24, Player.MAX_PASS_LENGTH, true, this, this.lastPass));
this.accBox = this.add(new Textbox(0, 170, 480, 24, Player.MAX_PASS_LENGTH, true, this, this.lastAcc));
this.add(new ActButton(0, 220, 480, 24, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {
GuiConnect.this.connect();

View file

@ -11,7 +11,7 @@ import game.gui.element.Fill;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.gui.element.TransparentBox;
import game.network.NetHandlerPlayServer;
import game.network.Player;
import game.packet.CPacketComplete;
import game.util.ExtMath;
import game.vars.BoolVar;
@ -58,7 +58,7 @@ public class GuiConsole extends Gui implements Textbox.Callback {
this.logBox = this.add(new TransparentBox(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer()));
if(this.full)
this.add(new Fill(640, 0, width - 640, 24));
this.inputField = this.add(new Textbox(0, height - 24, width, 24, NetHandlerPlayServer.MAX_CMD_LENGTH, true, this, ""));
this.inputField = this.add(new Textbox(0, height - 24, width, 24, Player.MAX_CMD_LENGTH, true, this, ""));
this.inputField.setSelected();
this.sentHistoryCursor = this.sentMessages.size();
}

View file

@ -1,7 +1,7 @@
package game.gui;
import game.color.TextColor;
import game.gui.element.ActButton;
import game.gui.element.NavButton;
import game.gui.element.TransparentBox;
import game.init.Config;
import game.log.Log;
@ -126,7 +126,7 @@ public class GuiInfo extends Gui {
public void init(int width, int height) {
this.add(new TransparentBox(10, 10, width - 20, height - 44, this.info));
this.add(new ActButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
}
public String getTitle() {

View file

@ -4,8 +4,10 @@ import game.color.TextColor;
import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
import game.gui.element.Label;
import game.gui.element.NavButton;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.gui.options.GuiOptions;
import game.gui.world.GuiWorlds;
import game.init.Config;
import game.renderer.Drawing;
@ -93,7 +95,7 @@ public class GuiMenu extends Gui {
}
}
});
this.add(new ActButton(0, 102, 196, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new NavButton(0, 102, 196, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new ActButton(204, 102, 196, 24, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {
GuiMenu.this.gm.interrupted = true;
@ -105,9 +107,9 @@ public class GuiMenu extends Gui {
this.pickSplash();
}
else {
this.add(new ActButton(0, 0, 400, 24, (Gui)null, "Zurück zum Spiel"));
this.add(new ActButton(0, 28, 198, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new ActButton(202, 28, 198, 24, GuiSkin.INSTANCE, "Charakter"));
this.add(new NavButton(0, 0, 400, 24, null, "Zurück zum Spiel"));
this.add(new NavButton(0, 28, 198, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new NavButton(202, 28, 198, 24, GuiSkin.INSTANCE, "Charakter"));
if(!this.gm.isRemote() && !this.gm.debugWorld) {
this.add(new Textbox(0, 56, 96, 24, 5, true, new Textbox.Callback() {
public void use(Textbox elem, Action value) {

View file

@ -1,9 +1,9 @@
package game.gui;
import game.gui.element.ActButton;
import game.gui.element.NavButton;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.network.NetHandlerPlayClient;
import game.network.ClientPlayer;
import game.packet.CPacketSign;
import game.world.BlockPos;
@ -17,7 +17,7 @@ public class GuiSign extends Gui implements Textbox.Callback {
for(int z = 0; z < this.lines.length; z++) {
this.lines[z] = this.add(new Textbox(0, 40 * z, 300, 24, 50, true, this, this.tempLines[z] == null ? "" : this.tempLines[z]));
}
this.add(new ActButton(0, 40 * (this.lines.length + 1), 300, 24, (Gui)null, "Fertig"));
this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 24, null, "Fertig"));
this.shift();
}
@ -27,7 +27,7 @@ public class GuiSign extends Gui implements Textbox.Callback {
public void onGuiClosed() {
NetHandlerPlayClient nethandler = this.gm.getNetHandler();
ClientPlayer nethandler = this.gm.getNetHandler();
if(nethandler != null) {
for(int z = 0; z < this.lines.length; z++) {
this.tempLines[z] = this.lines[z].getText();

View file

@ -25,6 +25,7 @@ import game.gui.element.Element;
import game.gui.element.GuiList;
import game.gui.element.Label;
import game.gui.element.ListEntry;
import game.gui.element.NavButton;
import game.gui.element.Slider;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
@ -32,14 +33,13 @@ import game.init.EntityRegistry;
import game.init.SpeciesRegistry;
import game.init.SpeciesRegistry.ModelType;
import game.log.Log;
import game.network.NetHandlerPlayServer;
import game.network.Player;
import game.packet.CPacketAction;
import game.packet.CPacketMessage;
import game.packet.CPacketSkin;
import game.renderer.Drawing;
import game.renderer.GlState;
import game.renderer.ItemRenderer;
import game.renderer.entity.Render;
import game.renderer.entity.RenderManager;
import game.renderer.texture.EntityTexManager;
import game.renderer.texture.TextureUtil;
@ -148,13 +148,14 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
// GuiSkin.this.gm.getTextureManager().bindTexture(tex);
GlState.enableBlend();
GlState.enableDepth();
Render.drawNames = false;
boolean flag = GuiSkin.this.gm.showHud;
GuiSkin.this.gm.showHud = false;
EntityTexManager.altTexture = tex;
EntityTexManager.altLayer = this.dynId;
EntityTexManager.altNpcLayer = this.dynId == -1 && this.charinfo != null ? this.charinfo.skin : null;
drawEntity(x + 32, y + 60, 28.0f
/ GuiSkin.this.gm.thePlayer.getHeight(), -45.0f, -20.0f, GuiSkin.this.gm.thePlayer);
Render.drawNames = true;
GuiSkin.this.gm.showHud = flag;
EntityTexManager.altTexture = null;
EntityTexManager.altLayer = -1;
EntityTexManager.altNpcLayer = null;
@ -390,8 +391,8 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
}
}, "Spieler-Größe", "cm"));
this.add(new Label(width - 400, height + 2 - 28 - 24 - 30, 390, 20, "Anzeigename", true));
this.add(new ActButton(width - 274 + 154, height - 24, 264 - 154, 20, GuiMenu.INSTANCE, "Fertig"));
Textbox nameField = this.add(new Textbox(width - 400, height + 2 - 28 - 34, 390, 20, NetHandlerPlayServer.MAX_NICK_LENGTH, true, new Textbox.Callback() {
this.add(new NavButton(width - 274 + 154, height - 24, 264 - 154, 20, GuiMenu.INSTANCE, "Fertig"));
Textbox nameField = this.add(new Textbox(width - 400, height + 2 - 28 - 34, 390, 20, 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();
@ -401,7 +402,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name));
}
}
}, NetHandlerPlayServer.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag()));
}, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag()));
this.convertButton1.enabled = false;
this.convertButton2.enabled = false;
this.templateButton.enabled = false;

View file

@ -1,75 +0,0 @@
package game.gui;
import game.audio.Volume;
import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
public class GuiSound extends GuiOptions {
protected GuiSound() {
}
public void init(int width, int height) {
// this.addSelector("mid_visualizer", 30, 80, 440, 24); // "Visualisation"
// this.addSelector("mid_opl_bank", 490, 80, 440, 24);
// this.addSelector("mid_play_unknown", 30, 120, 440, 24);
// this.addSelector("mid_keep_notes", 490, 120, 440, 24);
// this.addSelector("mid_dont_fade", 30, 160, 440, 24);
// this.addSelector("mid_debug_events", 490, 160, 440, 24);
// this.addSelector("mid_velocity_func", 30, 200, 440, 24);
// this.addSelector("mid_opl_voices", 490, 200, 440, 24);
// gui_add_custom(win, 30, 240, 128, 128, gui_render_velocity);
this.addSelector("snd_enabled", 30, 380, 440, 24);
// this.addSelector("snd_sample_rate", 30, 380, 440, 24);
// this.addSelector("snd_sample_format", 490, 380, 440, 24);
this.addSelector("snd_buffer_size", 30, 420, 440, 24);
this.addSelector("snd_frame_size", 490, 420, 440, 24);
this.add(new ActButton(30, 480, 900, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
GuiSound.this.gm.restartSound(false);
}
}, "Übernehmen und Audio-Thread neu starten"));
int x = 30;
int y = 220;
for(Volume volume : Volume.values()) {
this.addSelector(volume.getCVarName(), x, y, 440, 24);
x = (x == 30) ? 490 : 30;
if(x == 30)
y += 40;
}
super.init(width, height);
}
public String getTitle() {
return "Audio und Ton";
}
// void gui_fmt_velofunc(gui_t *elem, int value) {
// snprintf(elem->text, elem->capacity, "%s %d: %s", elem->format_text, value, (value ? (value == -128 ? "Vollklang [1]" : (value < 0 ? "Log. Gedämpft [nlog(x)]" : "Log.+Minimum [m+nlog(x)]")) : "Linear [x]"));
// }
// int gui_rect(gui_t *elem, int x, int y, int w, int h, uint color) {
// gfx_draw_rect(elem->pos_x + x, elem->pos_y + y, w, h, 0, 0, 0xff000000 | color, 0xff000000 | color, 0, 0);
// return h;
// }
//
// // uint bank_getlevel(char function, byte velocity, byte volume, char pan);
//
// void gui_render_velocity(gui_t *elem, int value) {
// elem->r_dirty = 1;
// if(!value)
// gui_rect(elem, 0, 0, elem->size_x, elem->size_y, 0x202020);
// else
// return;
// int y;
// for(int x = 0; x < 128; x++) {
// y = x; // bank_getlevel(snd.mid_velo, x, 127, 0) / 512;
// gui_rect(elem, x, 128 - 1 - y, 1, y, 0x2fbf2f);
// }
// }
}

View file

@ -1,7 +1,5 @@
package game.gui.element;
import game.Game;
import game.gui.Gui;
import game.util.Formatter;
import game.window.Button;
@ -28,15 +26,6 @@ public class ActButton extends Element {
this.setText(text);
}
public ActButton(int x, int y, int w, int h, Gui gui, String text) {
this(x, y, w, h, new Callback() {
public void use(ActButton elem, Mode action) {
Game.getGame().displayGuiScreen(gui);
}
}, text);
}
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
this.func.use(this, (ctrl || (btn == Button.MOUSE_MIDDLE)) ? Mode.TERTIARY : ((shift || (btn == Button.MOUSE_RIGHT)) ? Mode.SECONDARY : Mode.PRIMARY));
this.formatText();

View file

@ -0,0 +1,25 @@
package game.gui.element;
import game.Game;
import game.gui.Gui;
import game.renderer.Drawing;
public class NavButton extends ActButton {
private final Gui navGui;
public NavButton(int x, int y, int w, int h, Gui gui, String text) {
super(x, y, w, h, new Callback() {
public void use(ActButton elem, Mode action) {
Game.getGame().displayGuiScreen(gui);
}
}, text);
this.navGui = gui;
}
protected void drawBackground() {
if(this.gm.open == this.navGui)
Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, 0xff000000, this.gm.style.brdr_top, this.gm.style.brdr_btm);
else
super.drawBackground();
}
}

View file

@ -0,0 +1,23 @@
package game.gui.element;
import game.renderer.Drawing;
public class SelectableButton extends ActButton {
private boolean selected;
public SelectableButton(int x, int y, int w, int h, Callback callback, String text, boolean selected) {
super(x, y, w, h, callback, text);
this.selected = selected;
}
protected void drawBackground() {
if(this.selected)
Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, 0xff000000, this.gm.style.brdr_top, this.gm.style.brdr_btm);
else
super.drawBackground();
}
public void setSelected(boolean selected) {
this.selected = selected;
}
}

View file

@ -1,18 +0,0 @@
package game.gui.element;
import game.gui.Gui;
import game.renderer.Drawing;
public class SelectedButton extends ActButton {
public SelectedButton(int x, int y, int w, int h, Callback callback, String text) {
super(x, y, w, h, callback, text);
}
public SelectedButton(int x, int y, int w, int h, Gui gui, String text) {
super(x, y, w, h, gui, text);
}
protected void drawBackground() {
Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, 0xff000000, this.gm.style.brdr_top, this.gm.style.brdr_btm);
}
}

View file

@ -1,4 +1,4 @@
package game.gui;
package game.gui.options;
import game.color.TextColor;
import game.gui.element.ActButton;

View file

@ -1,4 +1,4 @@
package game.gui;
package game.gui.options;
import game.color.TextColor;
import game.gui.element.Dropdown;
@ -65,15 +65,21 @@ public class GuiDisplay extends GuiOptions {
}));
this.addSelector("gl_vsync_flush", 490, 120, 440, 24);
this.addSelector("con_overlay", 30, 200, 440, 24);
this.addSelector("con_opacity", 490, 200, 440, 24);
this.addSelector("con_size", 30, 240, 440, 24);
this.addSelector("con_fadeout", 490, 240, 440, 24);
this.addSelector("con_position", 30, 280, 440, 24);
this.addSelector("overlay_enabled", 30, 200, 440, 24);
this.addSelector("overlay_opacity", 490, 200, 440, 24);
this.addSelector("gl_fov", 30, 360, 440, 24);
this.distanceSlider = this.addSelector("chunk_view_distance", 30, 400, 440, 24);
this.addSelector("chunk_build_time", 490, 400, 440, 24);
this.addSelector("overlay_fadeout", 30, 240, 440, 24);
this.addSelector("chat_permanent", 490, 240, 440, 24);
this.addSelector("console_size", 30, 280, 440, 24);
this.addSelector("chat_size", 490, 280, 440, 24);
this.addSelector("feed_size", 30, 320, 440, 24);
this.addSelector("hotbar_size", 490, 320, 440, 24);
this.addSelector("gl_fov", 30, 400, 440, 24);
this.distanceSlider = this.addSelector("chunk_view_distance", 30, 440, 440, 24);
this.addSelector("chunk_build_time", 490, 440, 440, 24);
super.init(width, height);
}

View file

@ -1,7 +1,8 @@
package game.gui;
package game.gui.options;
import game.gui.element.ActButton;
import game.gui.element.SelectedButton;
import game.gui.Gui;
import game.gui.GuiMenu;
import game.gui.element.NavButton;
public abstract class GuiOptions extends Gui {
private static final GuiOptions[] PAGES = {lastPage = new GuiBinds(), new GuiStyle(), new GuiDisplay(), new GuiSound()};
@ -18,13 +19,13 @@ public abstract class GuiOptions extends Gui {
int x = 0;
int y = 0;
for(GuiOptions gui : PAGES) {
this.add(gui == this ? new SelectedButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()) :
new ActButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()));
this.add( // gui == this ? new SelectedButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()) :
new NavButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()));
if(++x == 4) {
x = 0;
++y;
}
}
this.add(new ActButton(width - 240, 0, 240, 24, GuiMenu.INSTANCE, "Zurück"));
this.add(new NavButton(width - 240, 0, 240, 24, GuiMenu.INSTANCE, "Zurück"));
}
}

View file

@ -0,0 +1,37 @@
package game.gui.options;
import game.audio.Volume;
import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
public class GuiSound extends GuiOptions {
protected GuiSound() {
}
public void init(int width, int height) {
this.addSelector("snd_enabled", 30, 380, 440, 24);
this.addSelector("snd_buffer_size", 30, 420, 440, 24);
this.addSelector("snd_frame_size", 490, 420, 440, 24);
this.add(new ActButton(30, 480, 900, 24, new ActButton.Callback() {
public void use(ActButton elem, Mode action) {
GuiSound.this.gm.restartSound(false);
}
}, "Übernehmen und Audio-Thread neu starten"));
int x = 30;
int y = 220;
for(Volume volume : Volume.values()) {
this.addSelector(volume.getCVarName(), x, y, 440, 24);
x = (x == 30) ? 490 : 30;
if(x == 30)
y += 40;
}
super.init(width, height);
}
public String getTitle() {
return "Audio und Ton";
}
}

View file

@ -1,10 +1,11 @@
package game.gui;
package game.gui.options;
import game.gui.Style;
import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
import game.gui.element.Dropdown;
import game.gui.element.Element;
import game.gui.element.SelectedButton;
import game.gui.element.SelectableButton;
import game.gui.element.Slider;
import game.gui.element.Switch;
import game.gui.element.Textbox;
@ -61,14 +62,14 @@ public class GuiStyle extends GuiOptions implements Dropdown.Callback<String>, A
}
}
};
this.add(theme == this.gm.style ? new SelectedButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name) :
new ActButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name));
this.add( // theme == this.gm.style ? new SelectedButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name) :
new SelectableButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name, theme == this.gm.style));
z++;
}
String[] values = new String[] {"VALUE 1", "VALUE 2"};
this.add(new Dropdown(10, height - 74, 300, 24, false, values, values[1], values[0], this, "DROPDOWN"));
this.add(new ActButton(330, height - 74, 300, 24, (ActButton.Callback)this, "BUTTON"));
this.add(new ActButton(330, height - 74, 300, 24, this, "BUTTON"));
this.add(new Toggle(650, height - 74, 140, 24, false, true, this, "TOGGLE"));
this.add(new Toggle(810, height - 74, 140, 24, true, false, this, "TOGGLE"));
values = new String[] {"VALUE 1", "VALUE 2", "VALUE 3", "VALUE 4"};

View file

@ -10,6 +10,7 @@ import game.gui.Gui;
import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
import game.gui.element.Label;
import game.gui.element.NavButton;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.gui.element.TransparentBox;
@ -18,7 +19,7 @@ import game.init.UniverseRegistry;
import game.log.Log;
import game.nbt.NBTLoader;
import game.nbt.NBTTagCompound;
import game.network.NetHandlerPlayServer;
import game.network.Player;
import game.rng.Random;
import game.util.Util;
import game.world.Region;
@ -210,13 +211,13 @@ public class GuiCreate extends Gui implements ActButton.Callback, Textbox.Callba
UniverseRegistry.clear();
this.alreadyGenerated = false;
this.dimension = Integer.MAX_VALUE;
this.createButton = this.add(new ActButton(0, 340, 160, 24, (ActButton.Callback)this, "Welt erstellen"));
this.add(new ActButton(164, 340, 160, 24, (Gui)GuiWorlds.INSTANCE, "Abbrechen"));
this.dimButton = this.add(new ActButton(0, 220, 324, 24, (ActButton.Callback)this, ""));
this.createButton = this.add(new ActButton(0, 340, 160, 24, this, "Welt erstellen"));
this.add(new NavButton(164, 340, 160, 24, GuiWorlds.INSTANCE, "Abbrechen"));
this.dimButton = this.add(new ActButton(0, 220, 324, 24, this, ""));
this.worldNameField = this.add(new Textbox(20, 40, 284, 24, 256, true, this, GuiWorlds.VALID_FILE, ""));
this.worldNameField.setSelected();
this.worldSeedField = this.add(new Textbox(20, 140, 284, 24, 256, true, this, ""));
this.worldUserField = this.add(new Textbox(20, 90, 284, 24, NetHandlerPlayServer.MAX_USER_LENGTH, true, this, NetHandlerPlayServer.VALID_USER, ""));
this.worldUserField = this.add(new Textbox(20, 90, 284, 24, Player.MAX_USER_LENGTH, true, this, Player.VALID_USER, ""));
this.createButton.enabled = false;
this.actionLabel = this.add(new Label(20, 20, 284, 20, this.getFolderDesc(), true));
this.userLabel = this.add(new Label(20, 70, 284, 20, this.getUserDesc(), true));

View file

@ -9,7 +9,7 @@ import game.gui.element.ActButton.Mode;
import game.gui.element.Label;
import game.gui.element.Textbox;
import game.gui.element.Textbox.Action;
import game.network.NetHandlerPlayServer;
import game.network.Player;
import game.world.Region;
public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback {
@ -73,9 +73,9 @@ public class GuiEdit extends Gui implements ActButton.Callback, Textbox.Callback
}
public void init(int width, int height) {
this.actionButton = this.add(new ActButton(width / 2 - 100, height / 4 + 96 + 12, 200, 20, (ActButton.Callback)this, this.action));
this.cancelButton = this.add(new ActButton(width / 2 - 100, height / 4 + 120 + 12, 200, 20, (ActButton.Callback)this, "Abbrechen"));
this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 20, this.player ? NetHandlerPlayServer.MAX_USER_LENGTH : 256, true, this, this.player ? NetHandlerPlayServer.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original));
this.actionButton = this.add(new ActButton(width / 2 - 100, height / 4 + 96 + 12, 200, 20, this, this.action));
this.cancelButton = this.add(new ActButton(width / 2 - 100, height / 4 + 120 + 12, 200, 20, this, "Abbrechen"));
this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 20, this.player ? Player.MAX_USER_LENGTH : 256, true, this, this.player ? Player.VALID_USER : GuiWorlds.VALID_FILE, this.original == null ? "" : this.original));
this.nameField.setSelected();
// if(this.player) {
// this.nameField.setMaxStringLength(16);

View file

@ -21,6 +21,7 @@ import game.gui.element.ActButton;
import game.gui.element.ActButton.Mode;
import game.gui.element.GuiList;
import game.gui.element.ListEntry;
import game.gui.element.NavButton;
import game.gui.world.GuiEdit.Callback;
import game.init.Config;
import game.init.UniverseRegistry;
@ -204,17 +205,17 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
this.warningMessage = "Welten-Ordner nicht lesbar!";
}
this.add(this.selectButton = new ActButton(width / 2 - 383, height - 52, 150, 20, (ActButton.Callback)this, "Welt spielen"));
this.add(this.createButton = new ActButton(width / 2 + 233, height - 52, 150, 20, (ActButton.Callback)this,
this.add(this.selectButton = new ActButton(width / 2 - 383, height - 52, 150, 20, this, "Welt spielen"));
this.add(this.createButton = new ActButton(width / 2 + 233, height - 52, 150, 20, this,
(create ? "" : "" + TextColor.DRED) + (create ? "Neue Welt ..." : "Fehler!")));
this.add(this.deleteButton = new ActButton(width / 2 - 229, height - 28, 150, 20, (ActButton.Callback)this, "Löschen"));
this.add(this.pruneButton = new ActButton(width / 2 - 75, height - 28, 150, 20, (ActButton.Callback)this, "Leeren"));
this.add(this.copyButton = new ActButton(width / 2 - 383, height - 28, 150, 20, (ActButton.Callback)this, "Kopieren"));
this.add(this.moveButton = new ActButton(width / 2 + 79, height - 28, 150, 20, (ActButton.Callback)this, "Verschieben"));
this.add(this.seedButton = new ActButton(width / 2 - 75, height - 52, 150, 20, (ActButton.Callback)this, "Startwert"));
this.add(this.userButton = new ActButton(width / 2 - 229, height - 52, 150, 20, (ActButton.Callback)this, "Spieler"));
this.add(this.dupeButton = new ActButton(width / 2 + 79, height - 52, 150, 20, (ActButton.Callback)this, "Duplizieren"));
this.add(new ActButton(width / 2 + 233, height - 28, 150, 20, GuiMenu.INSTANCE, "Abbrechen"));
this.add(this.deleteButton = new ActButton(width / 2 - 229, height - 28, 150, 20, this, "Löschen"));
this.add(this.pruneButton = new ActButton(width / 2 - 75, height - 28, 150, 20, this, "Leeren"));
this.add(this.copyButton = new ActButton(width / 2 - 383, height - 28, 150, 20, this, "Kopieren"));
this.add(this.moveButton = new ActButton(width / 2 + 79, height - 28, 150, 20, this, "Verschieben"));
this.add(this.seedButton = new ActButton(width / 2 - 75, height - 52, 150, 20, this, "Startwert"));
this.add(this.userButton = new ActButton(width / 2 - 229, height - 52, 150, 20, this, "Spieler"));
this.add(this.dupeButton = new ActButton(width / 2 + 79, height - 52, 150, 20, this, "Duplizieren"));
this.add(new NavButton(width / 2 + 233, height - 28, 150, 20, GuiMenu.INSTANCE, "Abbrechen"));
this.add(new ActButton(20, 20, 200, 20, new ActButton.Callback() {
public void use(ActButton elem, ActButton.Mode action) {