character sizes, ..
This commit is contained in:
parent
74f730e450
commit
517e7d74f9
42 changed files with 405 additions and 209 deletions
|
@ -72,7 +72,7 @@ import game.gui.GuiGameOver;
|
|||
import game.gui.GuiInfo;
|
||||
import game.gui.GuiLoading;
|
||||
import game.gui.GuiMenu;
|
||||
import game.gui.GuiSkin;
|
||||
import game.gui.GuiChar;
|
||||
import game.gui.Style;
|
||||
import game.gui.container.GuiContainer;
|
||||
import game.gui.container.GuiInventory;
|
||||
|
@ -986,7 +986,7 @@ public class Game implements IThreadListener {
|
|||
}
|
||||
if(this.open != null)
|
||||
this.open.render();
|
||||
else if(this.theWorld == null || this.theWorld.hasNoChunks())
|
||||
else if(this.theWorld == null || this.theWorld.hasNoChunks() || this.charEditor)
|
||||
Drawing.drawScaled(this, Gui.DIRT_BACKGROUND);
|
||||
if(Bind.INFO.isDown() && (this.open == null || !(this.open.selected instanceof Textbox)))
|
||||
this.drawInfo();
|
||||
|
@ -2226,8 +2226,8 @@ public class Game implements IThreadListener {
|
|||
// this.displayGuiScreen(GuiChat.INSTANCE);
|
||||
// }
|
||||
if(this.theWorld != null && Bind.MENU.isPressed()) {
|
||||
if(this.open != (this.charEditor ? GuiSkin.INSTANCE : null))
|
||||
this.displayGuiScreen(this.charEditor ? GuiSkin.INSTANCE : null);
|
||||
if(this.open != (this.charEditor ? GuiChar.INSTANCE : null))
|
||||
this.displayGuiScreen(this.charEditor ? GuiChar.INSTANCE : null);
|
||||
else
|
||||
this.displayGuiScreen(GuiMenu.INSTANCE);
|
||||
}
|
||||
|
@ -3315,13 +3315,42 @@ public class Game implements IThreadListener {
|
|||
// GlState.enableDepth();
|
||||
}
|
||||
|
||||
public void showDirDialog(final String title, final String def, final FileCallback callback) {
|
||||
public static enum FileMode {
|
||||
DIRECTORY_LOAD,
|
||||
DIRECTORY_SAVE,
|
||||
FILE_LOAD,
|
||||
FILE_LOAD_MULTI,
|
||||
FILE_SAVE;
|
||||
}
|
||||
|
||||
public void showDirDialog(final FileMode mode, final String title, final File def, final FileCallback callback) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
String output;
|
||||
try {
|
||||
Process proc = Runtime.getRuntime().exec(new String[] {"zenity", "--file-selection", "--directory", "--title", title, "--filename", def + File.separator +
|
||||
"__THISFILEDOESNOTEXIST__"});
|
||||
List<String> list = Lists.newArrayList("zenity", "--file-selection");
|
||||
switch(mode) {
|
||||
case DIRECTORY_SAVE:
|
||||
list.add("--save");
|
||||
case DIRECTORY_LOAD:
|
||||
list.add("--directory");
|
||||
break;
|
||||
case FILE_SAVE:
|
||||
list.add("--save");
|
||||
break;
|
||||
case FILE_LOAD_MULTI:
|
||||
list.add("--multiple");
|
||||
list.add("--separator");
|
||||
list.add(":");
|
||||
break;
|
||||
}
|
||||
list.add("--title");
|
||||
list.add(title);
|
||||
if(def != null) {
|
||||
list.add("--filename");
|
||||
list.add(def.isDirectory() ? def.getAbsolutePath() + File.separator + "__THISFILEDOESNOTEXIST__" : def.getAbsolutePath());
|
||||
}
|
||||
Process proc = Runtime.getRuntime().exec(list.toArray(new String[list.size()]));
|
||||
BufferedReader buf = new BufferedReader(new InputStreamReader(new BufferedInputStream(proc.getInputStream())));
|
||||
proc.waitFor();
|
||||
output = buf.readLine();
|
||||
|
@ -3335,8 +3364,43 @@ public class Game implements IThreadListener {
|
|||
return;
|
||||
}
|
||||
if(output != null) {
|
||||
File file = new File(output);
|
||||
if(file.isDirectory()) {
|
||||
if(mode == FileMode.FILE_LOAD_MULTI) {
|
||||
final List<File> files = Lists.newArrayList();
|
||||
for(String out : output.split(":")) {
|
||||
File file = new File(out);
|
||||
if(file.isFile())
|
||||
files.add(file);
|
||||
}
|
||||
if(files.isEmpty())
|
||||
return;
|
||||
Game.this.schedule(new Runnable() {
|
||||
public void run() {
|
||||
for(File file : files) {
|
||||
callback.selected(file);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
File file = new File(output);
|
||||
switch(mode) {
|
||||
case DIRECTORY_LOAD:
|
||||
if(!file.isDirectory())
|
||||
return;
|
||||
break;
|
||||
case DIRECTORY_SAVE:
|
||||
if(file.exists() && !file.isDirectory())
|
||||
return;
|
||||
break;
|
||||
case FILE_LOAD:
|
||||
if(!file.isFile())
|
||||
return;
|
||||
break;
|
||||
case FILE_SAVE:
|
||||
if(file.exists() && !file.isFile())
|
||||
return;
|
||||
break;
|
||||
}
|
||||
Game.this.schedule(new Runnable() {
|
||||
public void run() {
|
||||
callback.selected(file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue