split char gui
This commit is contained in:
parent
1b9ef61599
commit
5e20c6f90d
10 changed files with 105 additions and 29 deletions
|
@ -66,17 +66,17 @@ import game.entity.npc.EntityNPC;
|
|||
import game.entity.types.EntityLiving;
|
||||
import game.gui.Font;
|
||||
import game.gui.Gui;
|
||||
import game.gui.GuiConnect;
|
||||
import game.gui.GuiConsole;
|
||||
import game.gui.GuiGameOver;
|
||||
import game.gui.GuiInfo;
|
||||
import game.gui.GuiLoading;
|
||||
import game.gui.GuiMenu;
|
||||
import game.gui.GuiChar;
|
||||
import game.gui.Style;
|
||||
import game.gui.character.GuiChar;
|
||||
import game.gui.container.GuiContainer;
|
||||
import game.gui.container.GuiInventory;
|
||||
import game.gui.element.Textbox;
|
||||
import game.gui.ingame.GuiGameOver;
|
||||
import game.gui.server.GuiConnect;
|
||||
import game.init.BlockRegistry;
|
||||
import game.init.Config;
|
||||
import game.init.EntityRegistry;
|
||||
|
|
|
@ -45,7 +45,6 @@ import game.entity.projectile.EntityPotion;
|
|||
import game.entity.projectile.EntitySnowball;
|
||||
import game.entity.types.EntityLiving;
|
||||
import game.entity.types.IEntityMultiPart;
|
||||
import game.gui.GuiSign;
|
||||
import game.gui.container.GuiBrewing;
|
||||
import game.gui.container.GuiChest;
|
||||
import game.gui.container.GuiCrafting;
|
||||
|
@ -56,6 +55,7 @@ import game.gui.container.GuiHopper;
|
|||
import game.gui.container.GuiHorse;
|
||||
import game.gui.container.GuiMerchant;
|
||||
import game.gui.container.GuiRepair;
|
||||
import game.gui.ingame.GuiSign;
|
||||
import game.init.Config;
|
||||
import game.init.ItemRegistry;
|
||||
import game.init.Items;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package game.gui;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.gui.character.GuiChar;
|
||||
import game.gui.character.GuiCharacters;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Label;
|
||||
|
@ -8,6 +10,7 @@ import game.gui.element.NavButton;
|
|||
import game.gui.element.Textbox;
|
||||
import game.gui.element.Textbox.Action;
|
||||
import game.gui.options.GuiOptions;
|
||||
import game.gui.server.GuiConnect;
|
||||
import game.gui.world.GuiWorlds;
|
||||
import game.init.Config;
|
||||
import game.renderer.Drawing;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package game.gui;
|
||||
package game.gui.character;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
@ -29,6 +29,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.TransparentBox;
|
||||
|
@ -374,24 +375,13 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}, "Vorlage kopieren"));
|
||||
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 - 396 + (z % 2) * 198, 36 + 28 * (z / 2), 194, 24, new ActButton.Callback() {
|
||||
public void use(ActButton elem, Mode action) {
|
||||
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;
|
||||
this.add(new NavButton(width - 396, 36, 392, 24, GuiSpecies.INSTANCE, "Spezies ändern"));
|
||||
// for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); 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() {
|
||||
// }, EntityRegistry.getEntityName(EntityRegistry.getEntityString(species.clazz)))) // ;
|
||||
// .enabled = this.gm.thePlayer == null || this.gm.thePlayer.getClass() != species.clazz;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}, EntityRegistry.getEntityName(EntityRegistry.getEntityString(species.clazz)))) // ;
|
||||
// speciesBtns[z]
|
||||
.enabled = this.gm.thePlayer == null || this.gm.thePlayer.getClass() != species.clazz;
|
||||
}
|
||||
|
||||
final ActButton[] alignBtns = new ActButton[Alignment.values().length];
|
||||
for (int z = 0; z < Alignment.values().length; z++)
|
|
@ -1,7 +1,9 @@
|
|||
package game.gui;
|
||||
package game.gui.character;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.entity.npc.PlayerCharacter;
|
||||
import game.gui.GuiConfirm;
|
||||
import game.gui.GuiMenu;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.GuiList;
|
77
java/src/game/gui/character/GuiSpecies.java
Normal file
77
java/src/game/gui/character/GuiSpecies.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
package game.gui.character;
|
||||
|
||||
import game.entity.npc.SpeciesInfo;
|
||||
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.init.EntityRegistry;
|
||||
import game.init.SpeciesRegistry;
|
||||
import game.packet.CPacketAction;
|
||||
import game.renderer.Drawing;
|
||||
|
||||
public class GuiSpecies extends GuiList<GuiSpecies.SkinEntry> implements ActButton.Callback
|
||||
{
|
||||
protected class SkinEntry implements ListEntry
|
||||
{
|
||||
private final SpeciesInfo species;
|
||||
|
||||
protected SkinEntry(SpeciesInfo species)
|
||||
{
|
||||
this.species = species;
|
||||
}
|
||||
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
if(GuiSpecies.this.gm.thePlayer != null && this.species == GuiSpecies.this.gm.thePlayer.getSpecies())
|
||||
Drawing.drawRect(x, y, 1, 44, 0xffaf0000);
|
||||
Drawing.drawText(this.species.name, x + 3, y, 0xff000000 | this.species.color1 | this.species.color2);
|
||||
}
|
||||
|
||||
public void select(boolean dclick, int mx, int my)
|
||||
{
|
||||
if((GuiSpecies.this.selectButton.enabled = GuiSpecies.this.gm.thePlayer == null || this.species != GuiSpecies.this.gm.thePlayer.getSpecies()) && dclick)
|
||||
GuiSpecies.this.use(GuiSpecies.this.selectButton, Mode.PRIMARY);
|
||||
}
|
||||
}
|
||||
|
||||
public static final GuiSpecies INSTANCE = new GuiSpecies();
|
||||
|
||||
private ActButton selectButton;
|
||||
|
||||
private GuiSpecies() {
|
||||
}
|
||||
|
||||
public void init(int width, int height)
|
||||
{
|
||||
super.init(width, height);
|
||||
this.setDimensions(400, height, 32, height - 32);
|
||||
this.elements.clear();
|
||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||
this.elements.add(new SkinEntry(species));
|
||||
}
|
||||
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"));
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return "Spezies wählen";
|
||||
}
|
||||
|
||||
public int getListWidth()
|
||||
{
|
||||
return 400 - 20;
|
||||
}
|
||||
|
||||
public int getSlotHeight()
|
||||
{
|
||||
return 44 + 4;
|
||||
}
|
||||
|
||||
public void use(ActButton elem, Mode action) {
|
||||
SkinEntry entry = this.getSelected();
|
||||
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)));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package game.gui;
|
||||
package game.gui.ingame;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.gui.Gui;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.ActButton.Mode;
|
||||
import game.gui.element.Label;
|
|
@ -1,5 +1,6 @@
|
|||
package game.gui;
|
||||
package game.gui.ingame;
|
||||
|
||||
import game.gui.Gui;
|
||||
import game.gui.element.NavButton;
|
||||
import game.gui.element.Textbox;
|
||||
import game.gui.element.Textbox.Action;
|
|
@ -1,6 +1,8 @@
|
|||
package game.gui;
|
||||
package game.gui.server;
|
||||
|
||||
import game.color.TextColor;
|
||||
import game.gui.Gui;
|
||||
import game.gui.GuiMenu;
|
||||
import game.gui.element.ActButton;
|
||||
import game.gui.element.Label;
|
||||
import game.gui.element.Textbox;
|
|
@ -27,8 +27,8 @@ import game.entity.projectile.EntityProjectile;
|
|||
import game.entity.types.EntityLiving;
|
||||
import game.gui.Gui;
|
||||
import game.gui.GuiConsole;
|
||||
import game.gui.GuiChar;
|
||||
import game.gui.GuiCharacters;
|
||||
import game.gui.character.GuiChar;
|
||||
import game.gui.character.GuiCharacters;
|
||||
import game.gui.container.GuiMachine;
|
||||
import game.gui.container.GuiMerchant;
|
||||
import game.init.EntityRegistry;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue