world gui, ...
This commit is contained in:
parent
517e7d74f9
commit
6a6a820963
7 changed files with 87 additions and 29 deletions
|
@ -188,14 +188,12 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
if(this.charinfo != null) {
|
||||
try {
|
||||
img = TextureUtil.readImage(FileUtils.getResource(
|
||||
EntityNPC.getSkinTexture(this.charinfo.skin.startsWith("~") ? this.charinfo.skin.substring(1) :
|
||||
this.charinfo.skin)));
|
||||
EntityNPC.getSkinTexture(this.charinfo.skin)));
|
||||
}
|
||||
catch(IOException e) {
|
||||
if(e instanceof FileNotFoundException)
|
||||
Log.JNI.warn("Textur für Skin ist nicht vorhanden: " +
|
||||
EntityNPC.getSkinTexture(this.charinfo.skin.startsWith("~") ? this.charinfo.skin.substring(1) :
|
||||
this.charinfo.skin));
|
||||
EntityNPC.getSkinTexture(this.charinfo.skin));
|
||||
else
|
||||
Log.JNI.error(e, "Konnte Textur nicht laden");
|
||||
return;
|
||||
|
@ -228,7 +226,7 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
|
||||
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()
|
||||
|
@ -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.add(new ActButton(4, 4, 194, 24, new ActButton.Callback() {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
@ -316,9 +314,9 @@ public class GuiChar extends GuiList<GuiChar.SkinEntry>
|
|||
}, "Importieren: Standard"));
|
||||
this.add(new ActButton(202, 4, 194, 24, new ActButton.Callback() {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -222,14 +222,39 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
public void use(ActButton elem, ActButton.Mode action) {
|
||||
if(GuiWorlds.this.gm.theWorld != null)
|
||||
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) {
|
||||
if(GuiWorlds.this.gm.theWorld == null && GuiWorlds.this.gm.open instanceof GuiWorlds)
|
||||
GuiWorlds.this.gm.startServer(file, "sen");
|
||||
File parent = file.getParentFile();
|
||||
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.deleteButton.enabled = false;
|
||||
|
@ -241,6 +266,16 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
this.dupeButton.enabled = false;
|
||||
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() {
|
||||
return "Welt auswählen";
|
||||
|
@ -419,6 +454,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
this.warningTimer = 120;
|
||||
this.warningMessage = "Fehler beim Kopieren der Welt, diese könnte unvollständig sein!";
|
||||
}
|
||||
else
|
||||
this.displayInfo("Welt wurde kopiert");
|
||||
// try
|
||||
// {
|
||||
// this.loadLevelList();
|
||||
|
@ -443,6 +480,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
this.warningTimer = 120;
|
||||
this.warningMessage = "Fehler beim Löschen der Welt!";
|
||||
}
|
||||
else
|
||||
this.displayInfo("Welt wurde verschoben");
|
||||
this.gm.displayGuiScreen(this);
|
||||
}
|
||||
|
||||
|
@ -456,7 +495,10 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
}
|
||||
catch(Exception 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);
|
||||
}
|
||||
|
@ -631,6 +673,8 @@ public class GuiWorlds extends GuiList<GuiWorlds.SaveInfo> implements ActButton.
|
|||
selectWorld.warningTimer = 120;
|
||||
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);
|
||||
}
|
||||
}, s, s1, s2, s3);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue