character sizes, ..
This commit is contained in:
parent
74f730e450
commit
517e7d74f9
42 changed files with 405 additions and 209 deletions
|
@ -302,7 +302,7 @@ public abstract class Gui {
|
|||
// }
|
||||
|
||||
public void drawMainBackground() {
|
||||
if(this.gm.theWorld != null) {
|
||||
if(this.gm.theWorld != null && !this.gm.charEditor) {
|
||||
// Drawing.drawGradient(0, 0, this.fb_x, this.fb_y, this.theWorld == null ? this.style.bg_top : 0x3f202020,
|
||||
// this.theWorld == null ? this.style.bg_btm : 0x3f000000);
|
||||
Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010);
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11;
|
|||
import org.lwjgl.opengl.GL13;
|
||||
|
||||
import game.Game;
|
||||
import game.Game.FileMode;
|
||||
import game.entity.npc.Alignment;
|
||||
import game.entity.npc.CharacterInfo;
|
||||
import game.entity.npc.EntityNPC;
|
||||
|
@ -42,11 +43,12 @@ import game.renderer.ItemRenderer;
|
|||
import game.renderer.entity.RenderManager;
|
||||
import game.renderer.texture.EntityTexManager;
|
||||
import game.renderer.texture.TextureUtil;
|
||||
import game.util.FileCallback;
|
||||
import game.util.FileUtils;
|
||||
import game.util.SkinConverter;
|
||||
import game.window.Button;
|
||||
|
||||
public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
||||
public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||
{
|
||||
protected class SkinEntry implements ListEntry
|
||||
{
|
||||
|
@ -80,7 +82,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
int h = this.skinImage.getHeight();
|
||||
int[] data = new int[w * h];
|
||||
this.skinImage.getRGB(0, 0, w, h, data, 0, w);
|
||||
this.dynId = 0xffff0000 + GuiSkin.this.elements.size();
|
||||
this.dynId = 0xffff0000 + GuiChar.this.elements.size();
|
||||
EntityTexManager.setTexture(this.dynId, EntityTexManager.imageToComp(data, model), model);
|
||||
}
|
||||
else {
|
||||
|
@ -97,7 +99,7 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
(this.charinfo.species.prefix && this.charinfo.spclass != null && this.charinfo.spclass.type != null ?
|
||||
this.charinfo.spclass.type.toString() :
|
||||
EntityRegistry.getEntityName(this.charinfo.species.id))
|
||||
+ (this.charinfo.name.isEmpty() ? "" : (" " + this.charinfo.name)) + " (" + this.charinfo.skin + ")")));
|
||||
+ (this.charinfo.name.isEmpty() ? "" : (" " + this.charinfo.name)))));
|
||||
// + TextColor.LIGHT_GRAY + " (" + TextColor.GREEN +
|
||||
// this.model.display + TextColor.LIGHT_GRAY +")"
|
||||
// , listWidth - 16 - 2);
|
||||
|
@ -106,6 +108,8 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
// {
|
||||
Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ?
|
||||
(this.skinFile != null ? 0xffffff : 0xc0c0c0) : this.charinfo.color1 | this.charinfo.color2));
|
||||
if(this.skinFile == null && this.charinfo != null)
|
||||
Drawing.drawText(this.charinfo.skin, x + 64 + 3, y + 18, 0xffc0c0c0);
|
||||
// }
|
||||
|
||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
@ -147,14 +151,14 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
// GuiSkin.this.gm.getTextureManager().bindTexture(tex);
|
||||
GlState.enableBlend();
|
||||
GlState.enableDepth();
|
||||
boolean flag = GuiSkin.this.gm.cameraUsed;
|
||||
GuiSkin.this.gm.cameraUsed = true;
|
||||
boolean flag = GuiChar.this.gm.cameraUsed;
|
||||
GuiChar.this.gm.cameraUsed = true;
|
||||
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);
|
||||
GuiSkin.this.gm.cameraUsed = flag;
|
||||
/* / GuiChar.this.gm.thePlayer.getHeight() */ * Math.min(1.8f / GuiChar.this.gm.thePlayer.height, 1.5f / GuiChar.this.gm.thePlayer.width), -45.0f, -20.0f, GuiChar.this.gm.thePlayer);
|
||||
GuiChar.this.gm.cameraUsed = flag;
|
||||
EntityTexManager.altTexture = null;
|
||||
EntityTexManager.altLayer = -1;
|
||||
EntityTexManager.altNpcLayer = null;
|
||||
|
@ -202,10 +206,10 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
// slim = this.skinFile.getName().startsWith("slim_");
|
||||
// }
|
||||
// GuiSkin.this.selectEntry(slotIndex, slim);
|
||||
GuiSkin.this.convertButton1.enabled = this.canConvert();
|
||||
GuiSkin.this.convertButton2.enabled = this.canConvert();
|
||||
GuiSkin.this.templateButton.enabled = this.canCopy();
|
||||
GuiSkin.this.selectSkin(img, this.model);
|
||||
// GuiChar.this.convertButton1.enabled = this.canConvert();
|
||||
// GuiChar.this.convertButton2.enabled = this.canConvert();
|
||||
GuiChar.this.templateButton.enabled = this.canCopy();
|
||||
GuiChar.this.selectSkin(img, this.model);
|
||||
// if(mx < 16 && mx > 0)
|
||||
// GuiSkin.this.gm.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
// return;
|
||||
|
@ -217,10 +221,10 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
return this.skinFile;
|
||||
}
|
||||
|
||||
public boolean canConvert()
|
||||
{
|
||||
return this.skinFile != null && this.model == ModelType.HUMANOID;
|
||||
}
|
||||
// public boolean canConvert()
|
||||
// {
|
||||
// return this.skinFile != null && this.model == ModelType.HUMANOID;
|
||||
// }
|
||||
|
||||
public String getLocation()
|
||||
{
|
||||
|
@ -255,15 +259,15 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
}
|
||||
|
||||
public void drag(int x, int y) {
|
||||
GuiSkin.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f;
|
||||
GuiSkin.this.pitch = this.pitchOffset + (this.mouseY - y) * 2.0f;
|
||||
GuiChar.this.yaw = this.yawOffset + (this.mouseX - x) * 2.0f;
|
||||
GuiChar.this.pitch = this.pitchOffset + (this.mouseY - y) * 2.0f;
|
||||
}
|
||||
|
||||
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
|
||||
this.mouseX = x;
|
||||
this.mouseY = y;
|
||||
this.yawOffset = GuiSkin.this.yaw;
|
||||
this.pitchOffset = GuiSkin.this.pitch;
|
||||
this.yawOffset = GuiChar.this.yaw;
|
||||
this.pitchOffset = GuiChar.this.pitch;
|
||||
// this.dragging = true;
|
||||
}
|
||||
|
||||
|
@ -276,52 +280,58 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
}
|
||||
}
|
||||
|
||||
public static final GuiSkin INSTANCE = new GuiSkin();
|
||||
public static final GuiChar INSTANCE = new GuiChar();
|
||||
|
||||
private ActButton convertButton1;
|
||||
private ActButton convertButton2;
|
||||
// private ActButton convertButton1;
|
||||
// private ActButton convertButton2;
|
||||
private ActButton templateButton;
|
||||
private DragAdjust adjust;
|
||||
private float yaw = -15.0f;
|
||||
private float pitch = -15.0f;
|
||||
private boolean waiting = true;
|
||||
|
||||
private GuiSkin() {
|
||||
private GuiChar() {
|
||||
}
|
||||
|
||||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.waiting = true;
|
||||
this.setDimensions(400, height, 52, height - 52);
|
||||
this.setDimensions(400, height, 32, height - 32);
|
||||
if(this.gm.getRenderManager().gm == null) {
|
||||
this.unload();
|
||||
this.adjust = null;
|
||||
return;
|
||||
}
|
||||
this.load(null, this.gm.thePlayer == null ? ModelType.HUMANOID : this.gm.thePlayer.getModel());
|
||||
this.convertButton1 = this.add(new ActButton(10, height - 48, 200, 20, new ActButton.Callback() {
|
||||
this.add(new ActButton(4, 4, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
SkinEntry skin = GuiSkin.this.getSelected();
|
||||
if(skin != null && skin.getFile() != null && SkinConverter.convertSkin(skin.getFile(), new File("skins"), false))
|
||||
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this);
|
||||
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren", new File("skins"), new FileCallback() {
|
||||
public void selected(File file) {
|
||||
if(SkinConverter.convertSkin(file, new File("skins"), false) && GuiChar.this.gm.open == GuiChar.this)
|
||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, "Konvertieren: Standard"));
|
||||
this.convertButton2 = this.add(new ActButton(10, height - 24, 200, 20, new ActButton.Callback() {
|
||||
}, "Importieren: Standard"));
|
||||
this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
SkinEntry skin = GuiSkin.this.getSelected();
|
||||
if(skin != null && skin.getFile() != null && SkinConverter.convertSkin(skin.getFile(), new File("skins"), true))
|
||||
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this);
|
||||
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren (schlank)", new File("skins"), new FileCallback() {
|
||||
public void selected(File file) {
|
||||
if(SkinConverter.convertSkin(file, new File("skins"), true) && GuiChar.this.gm.open == GuiChar.this)
|
||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, "Konvertieren: Schlank"));
|
||||
this.add(new ActButton(240, height - 48, 150, 20, new ActButton.Callback() {
|
||||
}, "Importieren: Schlank"));
|
||||
this.add(new ActButton(4, height - 28, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this);
|
||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||
}
|
||||
}, "Neu laden"));
|
||||
this.templateButton = this.add(new ActButton(240, height - 24, 150, 20, new ActButton.Callback() {
|
||||
this.templateButton = this.add(new ActButton(202, height - 28, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
SkinEntry skin = GuiSkin.this.getSelected();
|
||||
SkinEntry skin = GuiChar.this.getSelected();
|
||||
if(skin != null && skin.getLocation() != null) {
|
||||
String loc = skin.getLocation();
|
||||
File file = new File(new File("skins"), loc + ".png");
|
||||
|
@ -349,21 +359,21 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
}
|
||||
}
|
||||
}
|
||||
GuiSkin.this.gm.displayGuiScreen(GuiSkin.this);
|
||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||
}
|
||||
}
|
||||
}, "Vorlage kopieren"));
|
||||
this.adjust = this.add(new DragAdjust(400 + 10, 64, width - 400 - 400 - 20, height - 128));
|
||||
this.adjust = this.add(new DragAdjust(width / 2 - 230, height - 64 - 640, 460, 640));
|
||||
|
||||
// final ActButton[] speciesBtns = new ActButton[SpeciesRegistry.SPECIMEN.size()];
|
||||
for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
|
||||
final SpeciesInfo species = SpeciesRegistry.SPECIMEN.get(z);
|
||||
// speciesBtns[z] =
|
||||
this.add(new ActButton(width - 400 + (z % 2) * 196, 4 + 23 * (z / 2), 194, 20, new ActButton.Callback() {
|
||||
this.add(new ActButton(width - 396 + (z % 2) * 198, 36 + 28 * (z / 2), 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
if(GuiSkin.this.gm.thePlayer != null) {
|
||||
GuiSkin.this.gm.displayGuiScreen(null);
|
||||
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz)));
|
||||
if(GuiChar.this.gm.thePlayer != null) {
|
||||
GuiChar.this.gm.displayGuiScreen(null);
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_SPECIES, EntityRegistry.getEntityID(species.clazz)));
|
||||
// for(ActButton btn : speciesBtns) {
|
||||
// btn.enabled = btn != elem;
|
||||
// }
|
||||
|
@ -378,11 +388,11 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
for (int z = 0; z < Alignment.values().length; z++)
|
||||
{
|
||||
final Alignment align = Alignment.values()[z];
|
||||
alignBtns[z] = this.add(new ActButton(width - 400 + (z % 3) * 131, height - 198 + 23 * (z / 3), 129, 20, new ActButton.Callback() {
|
||||
alignBtns[z] = this.add(new ActButton(width - 396 + (z % 3) * 132, height - 32 - 28 * 3 + 28 * (z / 3), 128, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
if(GuiSkin.this.gm.thePlayer != null) {
|
||||
GuiSkin.this.waiting = false;
|
||||
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal()));
|
||||
if(GuiChar.this.gm.thePlayer != null) {
|
||||
GuiChar.this.waiting = false;
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ALIGN, align.ordinal()));
|
||||
for(ActButton btn : alignBtns) {
|
||||
btn.enabled = btn != elem;
|
||||
}
|
||||
|
@ -391,36 +401,36 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
}, align.color + align.display));
|
||||
alignBtns[z].enabled = this.gm.thePlayer == null || this.gm.thePlayer.getAlignment() != align;
|
||||
}
|
||||
this.add(new Slider(width - 400, height - 28 - 84, 390, 20, 1, 120, 320, 180, this.gm.thePlayer == null ? 180 : (int)(this.gm.thePlayer.getSpecies().renderer.height * this.gm.thePlayer.getHeight() * 100.0f + 0.5f), new Slider.Callback() {
|
||||
this.add(new Slider(width / 2 - 200, height - 28, 400, 24, 1, this.gm.thePlayer == null ? 120 : this.gm.thePlayer.getMinSize(), this.gm.thePlayer == null ? 320 : this.gm.thePlayer.getMaxSize(), this.gm.thePlayer == null ? 180 : this.gm.thePlayer.getDefaultSize(), this.gm.thePlayer == null ? 180 : this.gm.thePlayer.getCurrentSize(), new Slider.Callback() {
|
||||
public void use(Slider elem, int value) {
|
||||
if(GuiSkin.this.gm.thePlayer != null) {
|
||||
GuiSkin.this.waiting = false;
|
||||
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value));
|
||||
if(GuiChar.this.gm.thePlayer != null) {
|
||||
GuiChar.this.waiting = false;
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_HEIGHT, value));
|
||||
}
|
||||
}
|
||||
}, "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, new ActButton.Callback() {
|
||||
}, "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));
|
||||
this.add(new ActButton(width - 198, height - 28, 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
if(GuiSkin.this.gm.thePlayer != null)
|
||||
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR));
|
||||
if(GuiChar.this.gm.thePlayer != null)
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketAction(CPacketAction.Action.CLOSE_EDITOR));
|
||||
}
|
||||
}, "Fertig"));
|
||||
Textbox nameField = this.add(new Textbox(width - 400, height + 2 - 28 - 34, 390, 20, Player.MAX_NICK_LENGTH, true, new Textbox.Callback() {
|
||||
}, "Charakter erstellen"));
|
||||
Textbox nameField = 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();
|
||||
if(name.isEmpty())
|
||||
elem.setText(GuiSkin.this.gm.thePlayer == null ? "..." : GuiSkin.this.gm.thePlayer.getCustomNameTag());
|
||||
else if(GuiSkin.this.gm.thePlayer != null) {
|
||||
GuiSkin.this.waiting = false;
|
||||
GuiSkin.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name));
|
||||
elem.setText(GuiChar.this.gm.thePlayer == null ? "..." : GuiChar.this.gm.thePlayer.getCustomNameTag());
|
||||
else if(GuiChar.this.gm.thePlayer != null) {
|
||||
GuiChar.this.waiting = false;
|
||||
GuiChar.this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.DISPLAY, name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag()));
|
||||
this.convertButton1.enabled = false;
|
||||
this.convertButton2.enabled = false;
|
||||
// this.convertButton1.enabled = false;
|
||||
// this.convertButton2.enabled = false;
|
||||
this.templateButton.enabled = false;
|
||||
}
|
||||
|
||||
|
@ -436,9 +446,12 @@ public class GuiSkin extends GuiList<GuiSkin.SkinEntry>
|
|||
|
||||
public void drawOverlays()
|
||||
{
|
||||
if(this.adjust != null)
|
||||
drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y / 2 + 160, 160.0f
|
||||
/ this.gm.thePlayer.getHeight(), this.yaw, this.pitch, this.gm.thePlayer);
|
||||
if(this.adjust != null) {
|
||||
float factor = this.gm.thePlayer.width > 2.15f ? 2.15f / this.gm.thePlayer.width : 1.0f;
|
||||
factor = this.gm.thePlayer.height > 3.0f && 3.0f / this.gm.thePlayer.height < factor ? 3.0f / this.gm.thePlayer.height : factor;
|
||||
drawEntity(400 + (this.gm.fb_x - 400 - 400) / 2, this.gm.fb_y - 160, 160.0f * factor
|
||||
/* / this.gm.thePlayer.getHeight() */, this.yaw, this.pitch, this.gm.thePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateScreen() {
|
|
@ -62,7 +62,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
|
|||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.setDimensions(width - 400, height, 52, height - 52);
|
||||
this.setDimensions(600, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
if(this.gm.getNetHandler() != null) {
|
||||
int initialSelection = this.gm.getNetHandler().getSelectedCharacter();
|
||||
|
@ -72,8 +72,8 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
|
|||
this.elements.add(new CharacterEntry(null, false));
|
||||
this.setSelected(initialSelection);
|
||||
}
|
||||
this.descField = this.add(new TransparentBox(width - 400, 0, 400, height - 28, ""));
|
||||
this.actionButtom = this.add(new ActButton(width - 198 * 2, height - 24, 194, 20, new ActButton.Callback() {
|
||||
this.descField = this.add(new TransparentBox(width - 390, 62, 380, height - 124, "", false));
|
||||
this.actionButtom = this.add(new ActButton(width / 2 - 200, height - 28, 198, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
CharacterEntry entry = GuiCharacters.this.getSelected();
|
||||
if(entry != null && GuiCharacters.this.gm.getNetHandler() != null) {
|
||||
|
@ -84,7 +84,7 @@ public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry>
|
|||
}
|
||||
}
|
||||
}, ""));
|
||||
this.add(new NavButton(width - 198, height - 24, 194, 20, GuiMenu.INSTANCE, "Abbrechen"));
|
||||
this.add(new NavButton(width / 2 + 2, height - 28, 198, 24, GuiMenu.INSTANCE, "Abbrechen"));
|
||||
this.updateButtons();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ 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.add(new TransparentBox(0, 80, 500, 300, this.messageLine2, this.gm.theWorld != null && !this.gm.charEditor));
|
||||
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();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class GuiConsole extends Gui implements Textbox.Callback {
|
|||
}
|
||||
}, "Löschen"));
|
||||
}
|
||||
this.logBox = this.add(new TransparentBox(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer()));
|
||||
this.logBox = this.add(new TransparentBox(0, this.full ? 24 : 0, width, height - (this.full ? 48 : 24), this.gm.getBuffer(), this.gm.theWorld != null && !this.gm.charEditor));
|
||||
if(this.full)
|
||||
this.add(new Fill(640, 0, width - 640, 24));
|
||||
this.inputField = this.add(new Textbox(0, height - 24, width, 24, Player.MAX_CMD_LENGTH, true, this, ""));
|
||||
|
@ -79,7 +79,7 @@ public class GuiConsole extends Gui implements Textbox.Callback {
|
|||
}
|
||||
|
||||
public void drawMainBackground() {
|
||||
if(this.gm.theWorld == null)
|
||||
if(this.gm.theWorld == null || this.gm.charEditor)
|
||||
super.drawMainBackground();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ public class GuiGameOver extends Gui {
|
|||
this.timer = 0;
|
||||
this.add(new Label(0, 0, 200, 20, "Du bist gestorben!"));
|
||||
this.add(new Label(0, 32, 200, 20, "Punktestand: " + TextColor.YELLOW + this.gm.thePlayer.experienceLevel));
|
||||
this.button = this.add(new ActButton(0, 100, 200, 20, new ActButton.Callback() {
|
||||
this.button = this.add(new ActButton(0, 100, 200, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
GuiGameOver.this.gm.thePlayer.respawnPlayer();
|
||||
GuiGameOver.this.gm.displayGuiScreen(null);
|
||||
|
|
|
@ -125,7 +125,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 TransparentBox(10, 10, width - 20, height - 44, this.info, this.gm.theWorld != null && !this.gm.charEditor));
|
||||
this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ public class GuiLoading extends Gui {
|
|||
|
||||
public void init(int width, int height) {
|
||||
this.taskLabel = this.add(new Label(0, 40, 500, 20, ""));
|
||||
this.progressBar1 = this.add(new Bar(0, 80, 500, 20));
|
||||
this.progressBar2 = this.add(new Bar(0, 120, 500, 20));
|
||||
this.progressBar1 = this.add(new Bar(0, 80, 500, 24));
|
||||
this.progressBar2 = this.add(new Bar(0, 120, 500, 24));
|
||||
this.shift();
|
||||
this.headerLabel = this.add(new Label(0, 40, width, 20, this.message));
|
||||
this.progressBar1.visible = false;
|
||||
|
|
|
@ -107,7 +107,7 @@ public class GuiMenu extends Gui {
|
|||
this.pickSplash();
|
||||
}
|
||||
else {
|
||||
this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiSkin.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel"));
|
||||
this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel"));
|
||||
this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen"));
|
||||
if(!this.gm.charEditor)
|
||||
this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter"));
|
||||
|
|
|
@ -169,10 +169,10 @@ public abstract class GuiList<T extends ListEntry> extends Gui
|
|||
|
||||
float f = 32.0F;
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex((double)((float)0 / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex((double)((float)0 / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
|
||||
int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
|
||||
|
@ -192,16 +192,16 @@ public abstract class GuiList<T extends ListEntry> extends Gui
|
|||
|
||||
int i1 = 4;
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)this.left, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.left, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
|
||||
Tessellator.draw();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
worldrenderer.pos((double)this.left, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.right, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)this.left, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
|
||||
worldrenderer.pos((double)this.gm.fb_x, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
worldrenderer.pos((double)0, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
|
||||
Tessellator.draw();
|
||||
|
||||
int j1 = this.getMaxScroll();
|
||||
|
@ -362,10 +362,10 @@ public abstract class GuiList<T extends ListEntry> extends Gui
|
|||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
float f = 32.0F;
|
||||
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
rb.pos((double)this.left, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)(this.left + this.width), (double)endY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)(this.left + this.width), (double)startY, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
rb.pos((double)this.left, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
rb.pos((double)0, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)this.gm.fb_x, (double)endY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
|
||||
rb.pos((double)this.gm.fb_x, (double)startY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
rb.pos((double)0, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
|
||||
Tessellator.draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,12 +3,15 @@ package game.gui.element;
|
|||
import game.renderer.Drawing;
|
||||
|
||||
public class TransparentBox extends Textbox {
|
||||
public TransparentBox(int x, int y, int w, int h, String text) {
|
||||
private final boolean background;
|
||||
|
||||
public TransparentBox(int x, int y, int w, int h, String text, boolean background) {
|
||||
super(x, y, w, h, text);
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
protected void drawBackground() {
|
||||
if(this.gm.theWorld != null)
|
||||
if(this.background)
|
||||
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x3f000000);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public class GuiCreate extends Gui implements ActButton.Callback, Textbox.Callba
|
|||
this.userLabel = this.add(new Label(20, 70, 284, 20, this.getUserDesc(), true));
|
||||
this.seed = this.add(new Label(20, 120, 284, 20, "", true));
|
||||
this.decoded = this.add(new Label(20, 164, 284, 20, "", true));
|
||||
this.descLines = this.add(new TransparentBox(0, 244, 324, 160, ""));
|
||||
this.descLines = this.add(new TransparentBox(0, 244, 324, 160, "", false));
|
||||
this.shift();
|
||||
this.setDimButton();
|
||||
}
|
||||
|
|
|
@ -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, 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.actionButton = this.add(new ActButton(width / 2 - 200, height / 4 + 96 + 12, 198, 24, this, this.action));
|
||||
this.cancelButton = this.add(new ActButton(width / 2 + 2, height / 4 + 96 + 12, 198, 24, this, "Abbrechen"));
|
||||
this.nameField = this.add(new Textbox(width / 2 - 200, 60, 400, 24, 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);
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Set;
|
|||
import game.collect.Sets;
|
||||
|
||||
import game.Game;
|
||||
import game.Game.FileMode;
|
||||
import game.color.TextColor;
|
||||
import game.dimension.Dimension;
|
||||
import game.gui.GuiConfirm;
|
||||
|
@ -157,7 +158,7 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
{
|
||||
super.init(width, height);
|
||||
this.starting = false;
|
||||
this.setDimensions(width, height, 48, height - 64);
|
||||
this.setDimensions(width, height, 32, height - 60);
|
||||
boolean create = true;
|
||||
this.elements.clear();
|
||||
try
|
||||
|
@ -205,23 +206,23 @@ 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, this, "Welt spielen"));
|
||||
this.add(this.createButton = new ActButton(width / 2 + 233, height - 52, 150, 20, this,
|
||||
this.add(this.selectButton = new ActButton(width / 2 - 383, height - 56, 150, 24, this, "Welt spielen"));
|
||||
this.add(this.createButton = new ActButton(width / 2 + 233, height - 56, 150, 24, this,
|
||||
(create ? "" : "" + TextColor.DRED) + (create ? "Neue Welt ..." : "Fehler!")));
|
||||
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(this.deleteButton = new ActButton(width / 2 - 229, height - 28, 150, 24, this, "Löschen"));
|
||||
this.add(this.pruneButton = new ActButton(width / 2 - 75, height - 28, 150, 24, this, "Leeren"));
|
||||
this.add(this.copyButton = new ActButton(width / 2 - 383, height - 28, 150, 24, this, "Kopieren"));
|
||||
this.add(this.moveButton = new ActButton(width / 2 + 79, height - 28, 150, 24, this, "Verschieben"));
|
||||
this.add(this.seedButton = new ActButton(width / 2 - 75, height - 56, 150, 24, this, "Startwert"));
|
||||
this.add(this.userButton = new ActButton(width / 2 - 229, height - 56, 150, 24, this, "Spieler"));
|
||||
this.add(this.dupeButton = new ActButton(width / 2 + 79, height - 56, 150, 24, this, "Duplizieren"));
|
||||
this.add(new NavButton(width / 2 + 233, height - 28, 150, 24, GuiMenu.INSTANCE, "Abbrechen"));
|
||||
|
||||
this.add(new ActButton(20, 20, 200, 20, new ActButton.Callback() {
|
||||
this.add(new ActButton(4, 4, 200, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, ActButton.Mode action) {
|
||||
if(GuiWorlds.this.gm.theWorld != null)
|
||||
return;
|
||||
GuiWorlds.this.gm.showDirDialog("Welt öffnen", "saves", new FileCallback() {
|
||||
GuiWorlds.this.gm.showDirDialog(FileMode.DIRECTORY_LOAD, "Welt öffnen", Region.SAVE_DIR, new FileCallback() {
|
||||
public void selected(File file) {
|
||||
if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds)
|
||||
GuiWorlds.this.gm.startServer(file, "sen");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue