split client and server 1
This commit is contained in:
parent
26a15a0b15
commit
2fa521c3d1
661 changed files with 3058 additions and 2826 deletions
79
java/src/client/gui/character/GuiSpecies.java
Normal file
79
java/src/client/gui/character/GuiSpecies.java
Normal file
|
@ -0,0 +1,79 @@
|
|||
package client.gui.character;
|
||||
|
||||
import client.gui.element.ActButton;
|
||||
import client.gui.element.ActButton.Mode;
|
||||
import client.gui.element.GuiList;
|
||||
import client.gui.element.ListEntry;
|
||||
import client.gui.element.NavButton;
|
||||
import client.renderer.Drawing;
|
||||
import game.entity.npc.SpeciesInfo;
|
||||
import game.init.EntityRegistry;
|
||||
import game.init.SpeciesRegistry;
|
||||
import game.packet.CPacketAction;
|
||||
|
||||
public class GuiSpecies extends GuiList<GuiSpecies.SpeciesEntry> implements ActButton.Callback
|
||||
{
|
||||
protected class SpeciesEntry implements ListEntry
|
||||
{
|
||||
private final SpeciesInfo species;
|
||||
|
||||
protected SpeciesEntry(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);
|
||||
if(this.species.classEnum != null)
|
||||
Drawing.drawText(this.species.classEnum.getEnumConstants().length + " Klassen", x + 3, y + 18, 0xffc0c0c0);
|
||||
}
|
||||
|
||||
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 SpeciesEntry(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) {
|
||||
SpeciesEntry 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)));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue