remove GuiChar code comments (pregit)
This commit is contained in:
parent
40bd8d2758
commit
cb3787349b
1 changed files with 16 additions and 110 deletions
|
@ -66,26 +66,18 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
private final ModelType model;
|
||||
private final CharacterInfo charinfo;
|
||||
private final BufferedImage skinImage;
|
||||
// private final String icon;
|
||||
// private DynamicTexture dyntex;
|
||||
private final int dynId;
|
||||
|
||||
protected SkinEntry(String id, File file, CharacterInfo charinfo, BufferedImage image, ModelType model)
|
||||
{
|
||||
// this.owner = parent;
|
||||
this.skinFile = file;
|
||||
this.charinfo = charinfo;
|
||||
this.id = id;
|
||||
this.model = model;
|
||||
// this.gm = Game.getGame();
|
||||
if(this.skinFile != null) // {
|
||||
if(this.skinFile != null)
|
||||
this.skinImage = image;
|
||||
// this.skin = skin.getName().substring(0, skin.getName().length() - 4);
|
||||
// }
|
||||
else // {
|
||||
else
|
||||
this.skinImage = null;
|
||||
// this.skin = null;
|
||||
// }
|
||||
if(this.skinImage != null) {
|
||||
int w = this.skinImage.getWidth();
|
||||
int h = this.skinImage.getHeight();
|
||||
|
@ -101,45 +93,23 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
|
||||
{
|
||||
// FontRenderer.drawString(this.skin == null ? "---" : this.skin, x + 32 + 3, y + 1, 16777215);
|
||||
String str = // List<String> list = FontRenderer.listFormattedStringToWidth(
|
||||
String str =
|
||||
(this.skinFile != null ? this.skinFile.getName()
|
||||
: (this.charinfo == null ? "Standard" : (
|
||||
(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)))));
|
||||
// + TextColor.LIGHT_GRAY + " (" + TextColor.GREEN +
|
||||
// this.model.display + TextColor.LIGHT_GRAY +")"
|
||||
// , listWidth - 16 - 2);
|
||||
//
|
||||
// for (int i = 0; i < Math.min(list.size(), 2); ++i)
|
||||
// {
|
||||
Drawing.drawText(str, x + 64 + 3, y, 0xff000000 | (this.charinfo == null ?
|
||||
(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)))));
|
||||
|
||||
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);
|
||||
|
||||
// if(this.model != ModelType.HUMANOID) {
|
||||
// this.drawTextureAt(x, y, EntitySkinManager.HEAD_DEF);
|
||||
// }
|
||||
|
||||
if (/* this.gm.touchscreen || */ hovered)
|
||||
{
|
||||
// GuiSkin.this.gm.getTextureManager().bindTexture(SKINS_BUTTONS);
|
||||
if (hovered)
|
||||
Drawing.drawRect(x, y, 64, 64, -1601138544);
|
||||
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// int k1 = mouseX - x;
|
||||
// int l1 = mouseY - y;
|
||||
//
|
||||
// if (k1 < 16 && k1 > 0)
|
||||
// {
|
||||
// Gui.drawScaledCustomSizeModalRect(x, y, 0.0F, 32.0F, 32, 32, 16, 16, 256.0F, 256.0F);
|
||||
// }
|
||||
}
|
||||
|
||||
if (this.dynId != -1)
|
||||
{
|
||||
|
@ -157,7 +127,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
protected void drawTextureAt(int x, int y, String tex)
|
||||
{
|
||||
// GuiSkin.this.gm.getTextureManager().bindTexture(tex);
|
||||
GlState.enableBlend();
|
||||
GlState.enableDepth();
|
||||
boolean flag = GuiChar.this.gm.cameraUsed;
|
||||
|
@ -166,12 +135,11 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
EntityTexManager.altLayer = this.dynId;
|
||||
EntityTexManager.altNpcLayer = this.dynId == -1 && this.charinfo != null ? this.charinfo.skin : null;
|
||||
drawEntity(x + 32, y + 60, 28.0f
|
||||
/* / 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);
|
||||
* 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;
|
||||
// GuiSkin.this.gm.getRenderManager().getRenderObject(this.model).renderHead(x, y, this.model.texWidth, this.model.texHeight, 2);
|
||||
GlState.disableBlend();
|
||||
GlState.disableDepth();
|
||||
}
|
||||
|
@ -184,16 +152,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
public void select(boolean dclick, int mx, int my)
|
||||
{
|
||||
// if(GuiSkin.this.adjust.dragging)
|
||||
// return;
|
||||
// if (dclick)
|
||||
// {
|
||||
// GuiSkin.this.gm.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
// return;
|
||||
// }
|
||||
// else {
|
||||
BufferedImage img = this.skinImage;
|
||||
// boolean slim = false;
|
||||
if(this.charinfo != null) {
|
||||
try {
|
||||
img = TextureUtil.readImage(FileUtils.getResource(
|
||||
|
@ -207,20 +166,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
Log.JNI.error(e, "Konnte Textur nicht laden");
|
||||
return;
|
||||
}
|
||||
// slim = this.charinfo.skin.startsWith("~");
|
||||
}
|
||||
// else if(this.skinFile != null) {
|
||||
// slim = this.skinFile.getName().startsWith("slim_");
|
||||
// }
|
||||
// GuiSkin.this.selectEntry(slotIndex, slim);
|
||||
// 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;
|
||||
// }
|
||||
}
|
||||
|
||||
public File getFile()
|
||||
|
@ -228,11 +176,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
return this.skinFile;
|
||||
}
|
||||
|
||||
// public boolean canConvert()
|
||||
// {
|
||||
// return this.skinFile != null && this.model == ModelType.HUMANOID;
|
||||
// }
|
||||
|
||||
public String getLocation()
|
||||
{
|
||||
return this.charinfo == null ? null : this.charinfo.skin;
|
||||
|
@ -249,16 +192,12 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
private int mouseY;
|
||||
private float yawOffset;
|
||||
private float pitchOffset;
|
||||
// public boolean dragging;
|
||||
|
||||
public DragAdjust(int x, int y, int w, int h) {
|
||||
super(x, y, w, h, null);
|
||||
}
|
||||
|
||||
protected void drawBackground() {
|
||||
// if(this.dragging) {
|
||||
//
|
||||
// }
|
||||
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x20ffffff);
|
||||
}
|
||||
|
||||
|
@ -275,13 +214,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
this.mouseY = y;
|
||||
this.yawOffset = GuiChar.this.yaw;
|
||||
this.pitchOffset = GuiChar.this.pitch;
|
||||
// this.dragging = true;
|
||||
}
|
||||
|
||||
// public void mouserel() {
|
||||
// this.dragging = false;
|
||||
// }
|
||||
|
||||
public boolean canHover() {
|
||||
return false;
|
||||
}
|
||||
|
@ -289,8 +223,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
public static final GuiChar INSTANCE = new GuiChar();
|
||||
|
||||
// private ActButton convertButton1;
|
||||
// private ActButton convertButton2;
|
||||
private ActButton templateButton;
|
||||
private DragAdjust adjust;
|
||||
private ActButton dimButton;
|
||||
|
@ -377,12 +309,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
this.add(new Label(width - 396, 36, 392, 20, this.gm.thePlayer == null ? "<?>" : this.gm.thePlayer.getSpecies().name, true));
|
||||
this.add(new NavButton(width - 396, 56, 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;
|
||||
// }
|
||||
|
||||
final ActButton[] alignBtns = new ActButton[Alignment.values().length];
|
||||
for (int z = 0; z < Alignment.values().length; z++)
|
||||
|
@ -419,8 +345,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
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);
|
||||
Dimension dim = 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()));
|
||||
}
|
||||
|
@ -439,8 +364,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
}
|
||||
}, Player.VALID_NICK, this.gm.thePlayer == null ? "" : this.gm.thePlayer.getCustomNameTag()));
|
||||
// this.convertButton1.enabled = false;
|
||||
// this.convertButton2.enabled = false;
|
||||
this.templateButton.enabled = false;
|
||||
this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size());
|
||||
EntityEggInfo egg = EntityRegistry.SPAWN_EGGS.get(this.gm.thePlayer == null ? EntityRegistry.getEntityString(EntityHuman.class) : EntityRegistry.getEntityString(this.gm.thePlayer));
|
||||
|
@ -460,11 +383,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
if(mode == Mode.TERTIARY) {
|
||||
GuiChar.this.dimension = new Random().zrange(UniverseRegistry.getBaseDimensions().size());
|
||||
}
|
||||
// else if(GuiChar.this.dimension == Integer.MAX_VALUE) {
|
||||
// GuiChar.this.dimension = mode == Mode.SECONDARY ? UniverseRegistry.getBaseDimensions().size() - 1 : 0;
|
||||
// }
|
||||
// else {
|
||||
if(mode == Mode.SECONDARY) {
|
||||
else if(mode == Mode.SECONDARY) {
|
||||
if(--GuiChar.this.dimension < 0)
|
||||
GuiChar.this.dimension = UniverseRegistry.getBaseDimensions().size() - 1;
|
||||
}
|
||||
|
@ -472,7 +391,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
if(++GuiChar.this.dimension >= UniverseRegistry.getBaseDimensions().size())
|
||||
GuiChar.this.dimension = 0;
|
||||
}
|
||||
// }
|
||||
GuiChar.this.setDimButton();
|
||||
}
|
||||
}, ""));
|
||||
|
@ -486,12 +404,8 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
|
||||
private void setDimButton() {
|
||||
Dimension dim = /* this.dimension == Integer.MAX_VALUE ? Space.INSTANCE : */ UniverseRegistry.getBaseDimensions().get(this.dimension);
|
||||
this.dimButton.setText( // (dim == Space.INSTANCE ? "" :
|
||||
// ((dim.getDimensionId() >= UniverseRegistry.MORE_DIM_ID ?
|
||||
/* "Vorlage" : */ (dim.getType() == DimType.PLANET ? "Heimplanet" : "Heimdimension") + ": " +
|
||||
// (dim.getDimensionId() >= UniverseRegistry.MORE_DIM_ID ? dim.getCustomName() :
|
||||
dim.getFormattedName(false));
|
||||
Dimension dim = UniverseRegistry.getBaseDimensions().get(this.dimension);
|
||||
this.dimButton.setText((dim.getType() == DimType.PLANET ? "Heimplanet" : "Heimdimension") + ": " + dim.getFormattedName(false));
|
||||
String name = dim.getFormattedName(true);
|
||||
int index = name.indexOf(" / ");
|
||||
this.descLines.setText(index >= 0 ? Util.buildLines(name.substring(index + " / ".length()).split(" / ")) : "");
|
||||
|
@ -508,7 +422,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
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);
|
||||
, this.yaw, this.pitch, this.gm.thePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,9 +454,6 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
if(img == null) {
|
||||
return null;
|
||||
}
|
||||
// if(img.getWidth() != 64 || img.getHeight() != 64) { // || img.getType() != BufferedImage.TYPE_INT_ARGB) {
|
||||
// return null;
|
||||
// }
|
||||
return img;
|
||||
}
|
||||
|
||||
|
@ -555,33 +466,28 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}
|
||||
});
|
||||
int pos = 0;
|
||||
// for(ModelType model : ModelType.values()) {
|
||||
this.elements.add(new SkinEntry("default", null, null, null, model));
|
||||
if("default".equals(currentSkin))
|
||||
this.setSelected(pos);
|
||||
pos++;
|
||||
// }
|
||||
if(files != null) {
|
||||
Arrays.sort(files);
|
||||
for(File file : files)
|
||||
{
|
||||
BufferedImage img = loadSkin(file);
|
||||
if(img != null) {
|
||||
// for(ModelType model : ModelType.values()) {
|
||||
if(img.getWidth() == model.texWidth && img.getHeight() == model.texHeight) {
|
||||
this.elements.add(new SkinEntry(file.getName(), file, null, img, model));
|
||||
if(file.getName().equals(currentSkin))
|
||||
this.setSelected(pos);
|
||||
pos++;
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||
for(CharacterInfo charinfo : species.chars) {
|
||||
if(charinfo.species.renderer == model) {
|
||||
// for(Entry<String, ModelType> entry : SpeciesRegistry.SKINS.entrySet()) {
|
||||
this.elements.add(new SkinEntry(charinfo.skin, null, charinfo, null, charinfo.species.renderer));
|
||||
if(charinfo.skin.equals(currentSkin))
|
||||
this.setSelected(pos);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue