more iOS fixes
This commit is contained in:
@@ -43,7 +43,7 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
void setup(){
|
void setup(){
|
||||||
buttons.clearChildren();
|
buttons.clearChildren();
|
||||||
|
|
||||||
if(Core.graphics.isPortrait()){
|
if(Core.graphics.isPortrait() && !ios){
|
||||||
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f*2f, 64f).colspan(2);
|
buttons.addImageTextButton("$back", "icon-arrow-left", iconsize, this::hide).size(210f*2f, 64f).colspan(2);
|
||||||
buttons.row();
|
buttons.row();
|
||||||
}else{
|
}else{
|
||||||
@@ -60,54 +60,56 @@ public class MapsDialog extends FloatingDialog{
|
|||||||
});
|
});
|
||||||
}).size(210f, 64f);
|
}).size(210f, 64f);
|
||||||
|
|
||||||
buttons.addImageTextButton("$editor.importmap", "icon-load", iconsize, () -> {
|
if(!ios){
|
||||||
Platform.instance.showFileChooser("$editor.importmap", "Map File", file -> {
|
buttons.addImageTextButton("$editor.importmap", "icon-load", iconsize, () -> {
|
||||||
world.maps.tryCatchMapError(() -> {
|
Platform.instance.showFileChooser("$editor.importmap", "Map File", file -> {
|
||||||
if(MapIO.isImage(file)){
|
world.maps.tryCatchMapError(() -> {
|
||||||
ui.showError("$editor.errorimage");
|
if(MapIO.isImage(file)){
|
||||||
return;
|
ui.showError("$editor.errorimage");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Map map;
|
Map map;
|
||||||
if(file.extension().equalsIgnoreCase(mapExtension)){
|
if(file.extension().equalsIgnoreCase(mapExtension)){
|
||||||
map = MapIO.createMap(file, true);
|
map = MapIO.createMap(file, true);
|
||||||
}else{
|
}else{
|
||||||
map = world.maps.makeLegacyMap(file);
|
map = world.maps.makeLegacyMap(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
//when you attempt to import a save, it will have no name, so generate one
|
//when you attempt to import a save, it will have no name, so generate one
|
||||||
String name = map.tags.getOr("name", () -> {
|
String name = map.tags.getOr("name", () -> {
|
||||||
String result = "unknown";
|
String result = "unknown";
|
||||||
int number = 0;
|
int number = 0;
|
||||||
while(world.maps.byName(result + number++) != null);
|
while(world.maps.byName(result + number++) != null) ;
|
||||||
return result + number;
|
return result + number;
|
||||||
});
|
|
||||||
|
|
||||||
//this will never actually get called, but it remains just in case
|
|
||||||
if(name == null){
|
|
||||||
ui.showError("$editor.errorname");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map conflict = world.maps.all().find(m -> m.name().equals(name));
|
|
||||||
|
|
||||||
if(conflict != null && !conflict.custom){
|
|
||||||
ui.showInfo(Core.bundle.format("editor.import.exists", name));
|
|
||||||
}else if(conflict != null){
|
|
||||||
ui.showConfirm("$confirm", "$editor.overwrite.confirm", () -> {
|
|
||||||
world.maps.tryCatchMapError(() -> {
|
|
||||||
world.maps.importMap(file);
|
|
||||||
setup();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}else{
|
|
||||||
world.maps.importMap(map.file);
|
|
||||||
setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
//this will never actually get called, but it remains just in case
|
||||||
}, true, FileChooser.anyMapFiles);
|
if(name == null){
|
||||||
}).size(210f, 64f);
|
ui.showError("$editor.errorname");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map conflict = world.maps.all().find(m -> m.name().equals(name));
|
||||||
|
|
||||||
|
if(conflict != null && !conflict.custom){
|
||||||
|
ui.showInfo(Core.bundle.format("editor.import.exists", name));
|
||||||
|
}else if(conflict != null){
|
||||||
|
ui.showConfirm("$confirm", "$editor.overwrite.confirm", () -> {
|
||||||
|
world.maps.tryCatchMapError(() -> {
|
||||||
|
world.maps.importMap(file);
|
||||||
|
setup();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
world.maps.importMap(map.file);
|
||||||
|
setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}, true, FileChooser.anyMapFiles);
|
||||||
|
}).size(210f, 64f);
|
||||||
|
}
|
||||||
|
|
||||||
cont.clear();
|
cont.clear();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user