Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -38,7 +38,7 @@ allprojects{
|
|||||||
}
|
}
|
||||||
|
|
||||||
getArcHash = {
|
getArcHash = {
|
||||||
return new Properties().with{ p -> p.load(new File((File)projectDir, 'gradle.properties').newReader()); return p }["archash"]
|
return new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]
|
||||||
}
|
}
|
||||||
|
|
||||||
arcModule = { String name ->
|
arcModule = { String name ->
|
||||||
@@ -200,7 +200,7 @@ project(":core"){
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies{
|
dependencies{
|
||||||
if(System.properties["user.name"] == "anuke"){
|
if(System.properties["user.name"] == "anuke2"){
|
||||||
task cleanGen{
|
task cleanGen{
|
||||||
doFirst{
|
doFirst{
|
||||||
delete{
|
delete{
|
||||||
|
|||||||
@@ -85,37 +85,35 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
if(!ios){
|
t.addImageTextButton("$editor.import", Icon.loadMapSmall, () ->
|
||||||
t.addImageTextButton("$editor.import", Icon.loadMapSmall, () ->
|
createDialog("$editor.import",
|
||||||
createDialog("$editor.import",
|
"$editor.importmap", "$editor.importmap.description", Icon.loadMap, (Runnable)loadDialog::show,
|
||||||
"$editor.importmap", "$editor.importmap.description", Icon.loadMap, (Runnable)loadDialog::show,
|
"$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
|
||||||
"$editor.importfile", "$editor.importfile.description", Icon.file, (Runnable)() ->
|
platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
|
||||||
platform.showFileChooser(true, mapExtension, file -> ui.loadAnd(() -> {
|
maps.tryCatchMapError(() -> {
|
||||||
maps.tryCatchMapError(() -> {
|
if(MapIO.isImage(file)){
|
||||||
if(MapIO.isImage(file)){
|
ui.showInfo("$editor.errorimage");
|
||||||
ui.showInfo("$editor.errorimage");
|
}else{
|
||||||
}else{
|
editor.beginEdit(MapIO.createMap(file, true));
|
||||||
editor.beginEdit(MapIO.createMap(file, true));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})),
|
|
||||||
|
|
||||||
"$editor.importimage", "$editor.importimage.description", Icon.fileImage, (Runnable)() ->
|
|
||||||
platform.showFileChooser(true, "png", file ->
|
|
||||||
ui.loadAnd(() -> {
|
|
||||||
try{
|
|
||||||
Pixmap pixmap = new Pixmap(file);
|
|
||||||
editor.beginEdit(pixmap);
|
|
||||||
pixmap.dispose();
|
|
||||||
}catch(Exception e){
|
|
||||||
ui.showException("$editor.errorload", e);
|
|
||||||
Log.err(e);
|
|
||||||
}
|
}
|
||||||
})))
|
});
|
||||||
);
|
})),
|
||||||
}
|
|
||||||
|
|
||||||
Cell cell = t.addImageTextButton("$editor.export", Icon.saveMapSmall, () -> {
|
"$editor.importimage", "$editor.importimage.description", Icon.fileImage, (Runnable)() ->
|
||||||
|
platform.showFileChooser(true, "png", file ->
|
||||||
|
ui.loadAnd(() -> {
|
||||||
|
try{
|
||||||
|
Pixmap pixmap = new Pixmap(file);
|
||||||
|
editor.beginEdit(pixmap);
|
||||||
|
pixmap.dispose();
|
||||||
|
}catch(Exception e){
|
||||||
|
ui.showException("$editor.errorload", e);
|
||||||
|
Log.err(e);
|
||||||
|
}
|
||||||
|
})))
|
||||||
|
);
|
||||||
|
|
||||||
|
t.addImageTextButton("$editor.export", Icon.saveMapSmall, () -> {
|
||||||
if(!ios){
|
if(!ios){
|
||||||
platform.showFileChooser(false, mapExtension, file -> {
|
platform.showFileChooser(false, mapExtension, file -> {
|
||||||
ui.loadAnd(() -> {
|
ui.loadAnd(() -> {
|
||||||
@@ -143,10 +141,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(ios){
|
|
||||||
cell.size(swidth * 2f + 10, 60f).colspan(2);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.cont.row();
|
menu.cont.row();
|
||||||
|
|||||||
@@ -126,24 +126,21 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
//iOS doesn't have a file chooser.
|
t.addButton("$data.import", style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||||
//if(!ios){
|
try{
|
||||||
t.addButton("$data.import", style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
data.importData(file);
|
||||||
try{
|
Core.app.exit();
|
||||||
data.importData(file);
|
}catch(IllegalArgumentException e){
|
||||||
Core.app.exit();
|
ui.showErrorMessage("$data.invalid");
|
||||||
}catch(IllegalArgumentException e){
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
if(e.getMessage() == null || !e.getMessage().contains("too short")){
|
||||||
|
ui.showException(e);
|
||||||
|
}else{
|
||||||
ui.showErrorMessage("$data.invalid");
|
ui.showErrorMessage("$data.invalid");
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
if(e.getMessage() == null || !e.getMessage().contains("too short")){
|
|
||||||
ui.showException(e);
|
|
||||||
}else{
|
|
||||||
ui.showErrorMessage("$data.invalid");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})));
|
}
|
||||||
//}
|
})));
|
||||||
});
|
});
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(prefs);
|
ScrollPane pane = new ScrollPane(prefs);
|
||||||
|
|||||||
@@ -74,22 +74,22 @@
|
|||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
||||||
<array>
|
<dict>
|
||||||
<dict>
|
<key>CFBundleTypeIconFiles</key>
|
||||||
<key>CFBundleTypeIconFiles</key>
|
<array>
|
||||||
<array>
|
<string>icon-72.png</string>
|
||||||
<string>icon-72.png</string>
|
</array>
|
||||||
</array>
|
<key>CFBundleTypeName</key>
|
||||||
<key>CFBundleTypeName</key>
|
<string>Zip Game Data</string>
|
||||||
<string>Zip Data File</string>
|
<key>CFBundleTypeRole</key>
|
||||||
<key>LSHandlerRank</key>
|
<string>Editor</string>
|
||||||
<string>Alternate</string>
|
<key>LSHandlerRank</key>
|
||||||
<key>LSItemContentTypes</key>
|
<string>Owner</string>
|
||||||
<array>
|
<key>LSItemContentTypes</key>
|
||||||
<string>public.archive</string>
|
<array>
|
||||||
</array>
|
<string>public.archive</string>
|
||||||
</dict>
|
</array>
|
||||||
</array>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
<key>UTExportedTypeDeclarations</key>
|
<key>UTExportedTypeDeclarations</key>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import io.anuke.mindustry.io.*;
|
|||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
import org.robovm.apple.foundation.*;
|
import org.robovm.apple.foundation.*;
|
||||||
import org.robovm.apple.uikit.*;
|
import org.robovm.apple.uikit.*;
|
||||||
|
import org.robovm.apple.uikit.UIBarButtonItem.*;
|
||||||
import org.robovm.objc.block.*;
|
import org.robovm.objc.block.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -39,10 +40,15 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showFileChooser(boolean open, String extension, Consumer<FileHandle> cons){
|
public void showFileChooser(boolean open, String extension, Consumer<FileHandle> cons){
|
||||||
UIDocumentBrowserViewController cont = new UIDocumentBrowserViewController(NSArray.fromStrings("public.archive"));
|
UIDocumentBrowserViewController cont = new UIDocumentBrowserViewController((NSArray)null);
|
||||||
|
|
||||||
cont.setAllowsDocumentCreation(false);
|
NSArray<UIBarButtonItem> arr = new NSArray<>(new UIBarButtonItem(Core.bundle.get("cancel"), UIBarButtonItemStyle.Plain,
|
||||||
cont.setDelegate(new UIDocumentBrowserViewControllerDelegate(){
|
uiBarButtonItem -> cont.dismissViewController(true, () -> {})));
|
||||||
|
|
||||||
|
cont.setAllowsDocumentCreation(!open);
|
||||||
|
cont.setAdditionalLeadingNavigationBarButtonItems(arr);
|
||||||
|
|
||||||
|
class ChooserDelegate extends NSObject implements UIDocumentBrowserViewControllerDelegate{
|
||||||
@Override
|
@Override
|
||||||
public void didPickDocumentURLs(UIDocumentBrowserViewController controller, NSArray<NSURL> documentURLs){
|
public void didPickDocumentURLs(UIDocumentBrowserViewController controller, NSArray<NSURL> documentURLs){
|
||||||
|
|
||||||
@@ -50,7 +56,10 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didPickDocumentsAtURLs(UIDocumentBrowserViewController controller, NSArray<NSURL> documentURLs){
|
public void didPickDocumentsAtURLs(UIDocumentBrowserViewController controller, NSArray<NSURL> documentURLs){
|
||||||
|
if(documentURLs.size() < 1) return;
|
||||||
|
|
||||||
|
cont.dismissViewController(true, () -> {});
|
||||||
|
cons.accept(Core.files.absolute(documentURLs.get(0).getPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,7 +86,9 @@ public class IOSLauncher extends IOSApplication.Delegate{
|
|||||||
public void willPresentActivityViewController(UIDocumentBrowserViewController controller, UIActivityViewController activityViewController){
|
public void willPresentActivityViewController(UIDocumentBrowserViewController controller, UIActivityViewController activityViewController){
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
cont.setDelegate(new ChooserDelegate());
|
||||||
UIApplication.getSharedApplication().getKeyWindow().getRootViewController().presentViewController(cont, true, () -> {
|
UIApplication.getSharedApplication().getKeyWindow().getRootViewController().presentViewController(cont, true, () -> {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user