world gui, ...
This commit is contained in:
parent
517e7d74f9
commit
6a6a820963
7 changed files with 87 additions and 29 deletions
|
@ -426,6 +426,7 @@ public class Game implements IThreadListener {
|
||||||
private boolean cfgDirty;
|
private boolean cfgDirty;
|
||||||
private String buffer = "";
|
private String buffer = "";
|
||||||
private boolean crashed;
|
private boolean crashed;
|
||||||
|
private boolean waitingForFile;
|
||||||
|
|
||||||
private final int[] tickTimes = new int[240];
|
private final int[] tickTimes = new int[240];
|
||||||
private final long[] frames = new long[240];
|
private final long[] frames = new long[240];
|
||||||
|
@ -1151,6 +1152,7 @@ public class Game implements IThreadListener {
|
||||||
|
|
||||||
public void displayGuiScreen(Gui gui)
|
public void displayGuiScreen(Gui gui)
|
||||||
{
|
{
|
||||||
|
this.waitingForFile = false;
|
||||||
if(this.thePlayer != null)
|
if(this.thePlayer != null)
|
||||||
this.thePlayer.setScreenClosed();
|
this.thePlayer.setScreenClosed();
|
||||||
if (this.open != null)
|
if (this.open != null)
|
||||||
|
@ -1867,8 +1869,11 @@ public class Game implements IThreadListener {
|
||||||
GL11.glViewport(0, 0, x, y);
|
GL11.glViewport(0, 0, x, y);
|
||||||
fb_x = x;
|
fb_x = x;
|
||||||
fb_y = y;
|
fb_y = y;
|
||||||
if(this.open != null)
|
if(this.open != null) {
|
||||||
|
boolean flag = this.waitingForFile;
|
||||||
this.displayGuiScreen(this.open);
|
this.displayGuiScreen(this.open);
|
||||||
|
this.waitingForFile = flag;
|
||||||
|
}
|
||||||
if(!fullscreen) {
|
if(!fullscreen) {
|
||||||
xsize = x;
|
xsize = x;
|
||||||
ysize = y;
|
ysize = y;
|
||||||
|
@ -1970,8 +1975,11 @@ public class Game implements IThreadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void redraw() {
|
private void redraw() {
|
||||||
if(this.open != null)
|
if(this.open != null) {
|
||||||
|
boolean flag = this.waitingForFile;
|
||||||
this.displayGuiScreen(this.open);
|
this.displayGuiScreen(this.open);
|
||||||
|
this.waitingForFile = flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void closed() {
|
private void closed() {
|
||||||
|
@ -3324,6 +3332,9 @@ public class Game implements IThreadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDirDialog(final FileMode mode, final String title, final File def, final FileCallback callback) {
|
public void showDirDialog(final FileMode mode, final String title, final File def, final FileCallback callback) {
|
||||||
|
if(this.waitingForFile)
|
||||||
|
return;
|
||||||
|
this.waitingForFile = true;
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
String output;
|
String output;
|
||||||
|
@ -3375,10 +3386,13 @@ public class Game implements IThreadListener {
|
||||||
return;
|
return;
|
||||||
Game.this.schedule(new Runnable() {
|
Game.this.schedule(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(Game.this.waitingForFile) {
|
||||||
for(File file : files) {
|
for(File file : files) {
|
||||||
callback.selected(file);
|
callback.selected(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Game.this.waitingForFile = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3403,7 +3417,9 @@ public class Game implements IThreadListener {
|
||||||
}
|
}
|
||||||
Game.this.schedule(new Runnable() {
|
Game.this.schedule(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(Game.this.waitingForFile)
|
||||||
callback.selected(file);
|
callback.selected(file);
|
||||||
|
Game.this.waitingForFile = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1073,10 +1073,10 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
// return ;
|
// return ;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
protected boolean hasSlimSkin()
|
// protected boolean hasSlimSkin()
|
||||||
{
|
// {
|
||||||
return this.getChar().startsWith("~");
|
// return this.getChar().startsWith("~");
|
||||||
}
|
// }
|
||||||
|
|
||||||
public String getLocationCape()
|
public String getLocationCape()
|
||||||
{
|
{
|
||||||
|
@ -4670,7 +4670,7 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
public Item getItem() {
|
public Item getItem() {
|
||||||
for(int z = 0; z < this.species.chars.length; z++) {
|
for(int z = 0; z < this.species.chars.length; z++) {
|
||||||
if(this.species.chars[z].spawner && this.species.chars[z].skin.equals(this.getChar())) {
|
if(this.species.chars[z].spawner && this.species.chars[z].skin.equals(this.getChar())) {
|
||||||
return ItemRegistry.getRegisteredItem(this.species.chars[z].skin.replace("~", "") + "_spawner");
|
return ItemRegistry.getRegisteredItem(this.species.chars[z].skin + "_spawner");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getItem();
|
return super.getItem();
|
||||||
|
|
|
@ -188,14 +188,12 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||||
if(this.charinfo != null) {
|
if(this.charinfo != null) {
|
||||||
try {
|
try {
|
||||||
img = TextureUtil.readImage(FileUtils.getResource(
|
img = TextureUtil.readImage(FileUtils.getResource(
|
||||||
EntityNPC.getSkinTexture(this.charinfo.skin.startsWith("~") ? this.charinfo.skin.substring(1) :
|
EntityNPC.getSkinTexture(this.charinfo.skin)));
|
||||||
this.charinfo.skin)));
|
|
||||||
}
|
}
|
||||||
catch(IOException e) {
|
catch(IOException e) {
|
||||||
if(e instanceof FileNotFoundException)
|
if(e instanceof FileNotFoundException)
|
||||||
Log.JNI.warn("Textur für Skin ist nicht vorhanden: " +
|
Log.JNI.warn("Textur für Skin ist nicht vorhanden: " +
|
||||||
EntityNPC.getSkinTexture(this.charinfo.skin.startsWith("~") ? this.charinfo.skin.substring(1) :
|
EntityNPC.getSkinTexture(this.charinfo.skin));
|
||||||
this.charinfo.skin));
|
|
||||||
else
|
else
|
||||||
Log.JNI.error(e, "Konnte Textur nicht laden");
|
Log.JNI.error(e, "Konnte Textur nicht laden");
|
||||||
return;
|
return;
|
||||||
|
@ -228,7 +226,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||||
|
|
||||||
public String getLocation()
|
public String getLocation()
|
||||||
{
|
{
|
||||||
return this.charinfo == null ? null : (this.charinfo.skin.startsWith("~") ? this.charinfo.skin.substring(1) : this.charinfo.skin);
|
return this.charinfo == null ? null : this.charinfo.skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canCopy()
|
public boolean canCopy()
|
||||||
|
@ -306,9 +304,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||||
this.load(null, this.gm.thePlayer == null ? ModelType.HUMANOID : this.gm.thePlayer.getModel());
|
this.load(null, this.gm.thePlayer == null ? ModelType.HUMANOID : this.gm.thePlayer.getModel());
|
||||||
this.add(new ActButton(4, 4, 194, 24, new ActButton.Callback() {
|
this.add(new ActButton(4, 4, 194, 24, new ActButton.Callback() {
|
||||||
public void use(ActButton elem, Mode action) {
|
public void use(ActButton elem, Mode action) {
|
||||||
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren", new File("skins"), new FileCallback() {
|
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren", new File("skins"), new FileCallback() {
|
||||||
public void selected(File file) {
|
public void selected(File file) {
|
||||||
if(SkinConverter.convertSkin(file, new File("skins"), false) && GuiChar.this.gm.open == GuiChar.this)
|
if(SkinConverter.convertSkin(file, new File("skins"), false))
|
||||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -316,9 +314,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
||||||
}, "Importieren: Standard"));
|
}, "Importieren: Standard"));
|
||||||
this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() {
|
this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() {
|
||||||
public void use(ActButton elem, Mode action) {
|
public void use(ActButton elem, Mode action) {
|
||||||
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD, "Skin konvertieren (schlank)", new File("skins"), new FileCallback() {
|
GuiChar.this.gm.showDirDialog(FileMode.FILE_LOAD_MULTI, "Skin konvertieren (schlank)", new File("skins"), new FileCallback() {
|
||||||
public void selected(File file) {
|
public void selected(File file) {
|
||||||
if(SkinConverter.convertSkin(file, new File("skins"), true) && GuiChar.this.gm.open == GuiChar.this)
|
if(SkinConverter.convertSkin(file, new File("skins"), true))
|
||||||
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
GuiChar.this.gm.displayGuiScreen(GuiChar.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -222,14 +222,39 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
public void use(ActButton elem, ActButton.Mode action) {
|
public void use(ActButton elem, ActButton.Mode action) {
|
||||||
if(GuiWorlds.this.gm.theWorld != null)
|
if(GuiWorlds.this.gm.theWorld != null)
|
||||||
return;
|
return;
|
||||||
GuiWorlds.this.gm.showDirDialog(FileMode.DIRECTORY_LOAD, "Welt öffnen", Region.SAVE_DIR, new FileCallback() {
|
GuiWorlds.this.gm.showDirDialog(FileMode.DIRECTORY_LOAD, "Welt importieren", Region.SAVE_DIR, new FileCallback() {
|
||||||
public void selected(File file) {
|
public void selected(File file) {
|
||||||
if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds)
|
File parent = file.getParentFile();
|
||||||
GuiWorlds.this.gm.startServer(file, "sen");
|
if(parent != null && Region.SAVE_DIR.getAbsoluteFile().equals(parent.getAbsoluteFile())) {
|
||||||
|
GuiWorlds.this.warningTimer = 120;
|
||||||
|
GuiWorlds.this.warningMessage = "Ordner befindet sich bereits im Weltenorder";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FolderInfo info = Region.loadWorldInfo(file);
|
||||||
|
if(info == null)
|
||||||
|
info = Converter.convertMapFormat(file, null);
|
||||||
|
if(info == null || info.legacy == SaveVersion.RELEASE_1_13) {
|
||||||
|
GuiWorlds.this.warningTimer = 120;
|
||||||
|
GuiWorlds.this.warningMessage = info == null ? "Keine Weltdaten gefunden" : "Weltdaten haben inkompatible Version";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int n = 0;
|
||||||
|
File newDir;
|
||||||
|
do {
|
||||||
|
newDir = new File(Region.SAVE_DIR, file.getName() + (n > 0 ? "_" + n : ""));
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
while(newDir.exists());
|
||||||
|
Log.IO.info("Kopiere Welt " + file + " nach " + newDir);
|
||||||
|
if(!copyFiles(file, newDir, file.listFiles()))
|
||||||
|
GuiWorlds.this.displayWarning("Fehler beim Kopieren der Welt, diese könnte unvollständig sein!");
|
||||||
|
else
|
||||||
|
GuiWorlds.this.displayInfo("Welt wurde in den Weltenordner kopiert");
|
||||||
|
GuiWorlds.this.gm.displayGuiScreen(GuiWorlds.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, "Welt laden"));
|
}, "Welt importieren"));
|
||||||
|
|
||||||
this.selectButton.enabled = false;
|
this.selectButton.enabled = false;
|
||||||
this.deleteButton.enabled = false;
|
this.deleteButton.enabled = false;
|
||||||
|
@ -242,6 +267,16 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
this.createButton.enabled = create;
|
this.createButton.enabled = create;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void displayWarning(String msg) {
|
||||||
|
this.warningTimer = 120;
|
||||||
|
this.warningMessage = TextColor.DRED + msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayInfo(String msg) {
|
||||||
|
this.warningTimer = 40;
|
||||||
|
this.warningMessage = TextColor.DGREEN + msg;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return "Welt auswählen";
|
return "Welt auswählen";
|
||||||
}
|
}
|
||||||
|
@ -419,6 +454,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
this.warningTimer = 120;
|
this.warningTimer = 120;
|
||||||
this.warningMessage = "Fehler beim Kopieren der Welt, diese könnte unvollständig sein!";
|
this.warningMessage = "Fehler beim Kopieren der Welt, diese könnte unvollständig sein!";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
this.displayInfo("Welt wurde kopiert");
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// this.loadLevelList();
|
// this.loadLevelList();
|
||||||
|
@ -443,6 +480,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
this.warningTimer = 120;
|
this.warningTimer = 120;
|
||||||
this.warningMessage = "Fehler beim Löschen der Welt!";
|
this.warningMessage = "Fehler beim Löschen der Welt!";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
this.displayInfo("Welt wurde verschoben");
|
||||||
this.gm.displayGuiScreen(this);
|
this.gm.displayGuiScreen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +495,10 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
}
|
}
|
||||||
catch(Exception e) {
|
catch(Exception e) {
|
||||||
Log.IO.error("Fehler beim Verarbeiten von " + file, e);
|
Log.IO.error("Fehler beim Verarbeiten von " + file, e);
|
||||||
|
this.displayWarning("Konnte Spielernamen nicht ändern");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
this.displayInfo("Spielername wurde geändert");
|
||||||
}
|
}
|
||||||
// this.gm.displayGuiScreen(this);
|
// this.gm.displayGuiScreen(this);
|
||||||
}
|
}
|
||||||
|
@ -631,6 +673,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
||||||
selectWorld.warningTimer = 120;
|
selectWorld.warningTimer = 120;
|
||||||
selectWorld.warningMessage = "Fehler beim " + (prune ? "Leeren" : "Löschen") + " der Welt!";
|
selectWorld.warningMessage = "Fehler beim " + (prune ? "Leeren" : "Löschen") + " der Welt!";
|
||||||
}
|
}
|
||||||
|
else if(confirmed)
|
||||||
|
selectWorld.displayInfo("Welt wurde " + (prune ? "geleert" : "gelöscht"));
|
||||||
selectWorld.gm.displayGuiScreen(selectWorld);
|
selectWorld.gm.displayGuiScreen(selectWorld);
|
||||||
}
|
}
|
||||||
}, s, s1, s2, s3);
|
}, s, s1, s2, s3);
|
||||||
|
|
|
@ -378,7 +378,7 @@ public abstract class ItemRegistry {
|
||||||
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
for(SpeciesInfo species : SpeciesRegistry.SPECIMEN) {
|
||||||
for(CharacterInfo charinfo : species.chars) {
|
for(CharacterInfo charinfo : species.chars) {
|
||||||
if(charinfo.spawner)
|
if(charinfo.spawner)
|
||||||
registerItem(charinfo.skin.replace("~", "") + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
|
registerItem(charinfo.skin + "_spawner", (new ItemNpcSpawner(charinfo)).setDisplay("NSC-Spawner")
|
||||||
.setMaxStackSize(ItemStack.MAX_SIZE));
|
.setMaxStackSize(ItemStack.MAX_SIZE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public abstract class SpeciesRegistry {
|
||||||
":knight_1", ":knight_2", ":knight_3",
|
":knight_1", ":knight_2", ":knight_3",
|
||||||
":knight_4", ":knight_5", ":knight_6", ":knight_7", ":knight_8", EntityHuman.ClassType.PEASANT,
|
":knight_4", ":knight_5", ":knight_6", ":knight_7", ":knight_8", EntityHuman.ClassType.PEASANT,
|
||||||
":peasant_1", ":peasant_2", ":peasant_3",
|
":peasant_1", ":peasant_2", ":peasant_3",
|
||||||
":peasant_4", ":~peasant_5", ":peasant_6");
|
":peasant_4", ":peasant_5", ":peasant_6");
|
||||||
registerSpecies("Spirit", EntitySpirit.class, "yrdinath", "Geist", 1.65f, 0xdfdfff, 0xbfbfff);
|
registerSpecies("Spirit", EntitySpirit.class, "yrdinath", "Geist", 1.65f, 0xdfdfff, 0xbfbfff);
|
||||||
registerSpecies("Haunter", EntityHaunter.class, "warp", "Verfolger", 1.55f, 0xffdfdf, 0xffbfbf);
|
registerSpecies("Haunter", EntityHaunter.class, "warp", "Verfolger", 1.55f, 0xffdfdf, 0xffbfbf);
|
||||||
registerSpecies("FireDemon", EntityFireDemon.class, "ahrd", "Feuerdämon", 2.55f, 0xff0000, 0xff7f00);
|
registerSpecies("FireDemon", EntityFireDemon.class, "ahrd", "Feuerdämon", 2.55f, 0xff0000, 0xff7f00);
|
||||||
|
|
|
@ -41,7 +41,7 @@ public abstract class EntityTexManager
|
||||||
TextureManager manager = Game.getGame().getTextureManager();
|
TextureManager manager = Game.getGame().getTextureManager();
|
||||||
for(Entry<String, ModelType> entry : SpeciesRegistry.SKINS.entrySet()) {
|
for(Entry<String, ModelType> entry : SpeciesRegistry.SKINS.entrySet()) {
|
||||||
String skin = entry.getKey();
|
String skin = entry.getKey();
|
||||||
skin = skin.startsWith("~") ? skin.substring(1) : skin;
|
// skin = skin.startsWith("~") ? skin.substring(1) : skin;
|
||||||
String loc = EntityNPC.getSkinTexture(skin);
|
String loc = EntityNPC.getSkinTexture(skin);
|
||||||
BufferedImage image;
|
BufferedImage image;
|
||||||
try {
|
try {
|
||||||
|
@ -156,8 +156,8 @@ public abstract class EntityTexManager
|
||||||
|
|
||||||
public static LayerExtra getNpcLayer(String skin, ModelType model)
|
public static LayerExtra getNpcLayer(String skin, ModelType model)
|
||||||
{
|
{
|
||||||
return Game.getGame().getTextureManager().getTexture(getNpcSkinLocation(skin.startsWith("~") ? skin.substring(1) : skin)) != null ?
|
return Game.getGame().getTextureManager().getTexture(getNpcSkinLocation(skin)) != null ?
|
||||||
NPC_LAYERS.get((skin.startsWith("~") ? skin.substring(1) : skin).toLowerCase()) : DEF_LAYERS.get(model);
|
NPC_LAYERS.get(skin.toLowerCase()) : DEF_LAYERS.get(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSkin(int id, ModelType model)
|
public static String getSkin(int id, ModelType model)
|
||||||
|
@ -168,7 +168,7 @@ public abstract class EntityTexManager
|
||||||
|
|
||||||
public static String getNpcSkin(String skin, ModelType model)
|
public static String getNpcSkin(String skin, ModelType model)
|
||||||
{
|
{
|
||||||
String loc = getNpcSkinLocation(skin.startsWith("~") ? skin.substring(1) : skin);
|
String loc = getNpcSkinLocation(skin);
|
||||||
return Game.getGame().getTextureManager().getTexture(loc) != null ? loc : getDefault(model);
|
return Game.getGame().getTextureManager().getTexture(loc) != null ? loc : getDefault(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue