Made Android files external
This commit is contained in:
@@ -148,6 +148,30 @@ public class AndroidLauncher extends AndroidApplication{
|
|||||||
//errorHandler = ModCrashHandler::handle;
|
//errorHandler = ModCrashHandler::handle;
|
||||||
}});
|
}});
|
||||||
checkFiles(getIntent());
|
checkFiles(getIntent());
|
||||||
|
|
||||||
|
//new external folder
|
||||||
|
Fi data = Core.files.absolute(getContext().getExternalFilesDir(null).getAbsolutePath());
|
||||||
|
|
||||||
|
//moved to internal storage if there's no file indicating that it moved
|
||||||
|
if(!Core.files.local("files_moved").exists()){
|
||||||
|
Log.info("Moving files to external storage...");
|
||||||
|
|
||||||
|
try{
|
||||||
|
//current local storage folder
|
||||||
|
Fi src = Core.files.absolute(Core.files.getLocalStoragePath());
|
||||||
|
for(Fi fi : src.list()){
|
||||||
|
fi.copyTo(data.child(fi.name()));
|
||||||
|
}
|
||||||
|
//create marker
|
||||||
|
Core.files.local("files_moved").writeString("files moved to " + data);
|
||||||
|
Log.info("Files moved.");
|
||||||
|
}catch(Throwable t){
|
||||||
|
Log.err("Failed to move files!");
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Core.settings.setDataDirectory(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -251,6 +251,7 @@ copylink = Copy Link
|
|||||||
back = Back
|
back = Back
|
||||||
data.export = Export Data
|
data.export = Export Data
|
||||||
data.import = Import Data
|
data.import = Import Data
|
||||||
|
data.openfolder = Open Data Folder
|
||||||
data.exported = Data exported.
|
data.exported = Data exported.
|
||||||
data.invalid = This isn't valid game data.
|
data.invalid = This isn't valid game data.
|
||||||
data.import.confirm = Importing external data will overwrite[scarlet] all[] your current game data.\n[accent]This cannot be undone![]\n\nOnce the data is imported, your game will exit immediately.
|
data.import.confirm = Importing external data will overwrite[scarlet] all[] your current game data.\n[accent]This cannot be undone![]\n\nOnce the data is imported, your game will exit immediately.
|
||||||
|
|||||||
@@ -20,15 +20,8 @@ public class ModsDialog extends FloatingDialog{
|
|||||||
super("$mods");
|
super("$mods");
|
||||||
addCloseButton();
|
addCloseButton();
|
||||||
|
|
||||||
buttons.addImageTextButton(mobile ? "$mods.report" : "$mods.openfolder", Icon.link,
|
buttons.addImageTextButton("$mods.openfolder", Icon.link,
|
||||||
() -> {
|
() -> Core.app.openFolder(modDirectory.absolutePath())).size(250f, 64f);
|
||||||
if(mobile){
|
|
||||||
Core.net.openURI(reportIssueURL);
|
|
||||||
}else{
|
|
||||||
Core.net.openFolder(modDirectory.absolutePath());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.size(250f, 64f);
|
|
||||||
|
|
||||||
buttons.row();
|
buttons.row();
|
||||||
|
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
dataDialog.addCloseButton();
|
dataDialog.addCloseButton();
|
||||||
|
|
||||||
dataDialog.cont.table(Tex.button, t -> {
|
dataDialog.cont.table(Tex.button, t -> {
|
||||||
t.defaults().size(240f, 60f).left();
|
t.defaults().size(270f, 60f).left();
|
||||||
TextButtonStyle style = Styles.cleart;
|
TextButtonStyle style = Styles.cleart;
|
||||||
|
|
||||||
t.addButton("$settings.cleardata", style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
t.addImageTextButton("$settings.cleardata", Icon.trash16Small, style, () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||||
for(String value : Core.settings.keys()){
|
for(String value : Core.settings.keys()){
|
||||||
if(value.contains("usid") || value.contains("uuid")){
|
if(value.contains("usid") || value.contains("uuid")){
|
||||||
@@ -104,7 +104,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
t.addButton("$data.export", style, () -> {
|
t.addImageTextButton("$data.export", Icon.loadMapSmall, style, () -> {
|
||||||
if(ios){
|
if(ios){
|
||||||
Fi file = Core.files.local("mindustry-data-export.zip");
|
Fi file = Core.files.local("mindustry-data-export.zip");
|
||||||
try{
|
try{
|
||||||
@@ -128,7 +128,7 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
|
|
||||||
t.row();
|
t.row();
|
||||||
|
|
||||||
t.addButton("$data.import", style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
t.addImageTextButton("$data.import", Icon.saveMapSmall, style, () -> ui.showConfirm("$confirm", "$data.import.confirm", () -> platform.showFileChooser(true, "zip", file -> {
|
||||||
try{
|
try{
|
||||||
data.importData(file);
|
data.importData(file);
|
||||||
Core.app.exit();
|
Core.app.exit();
|
||||||
@@ -143,6 +143,12 @@ public class SettingsMenuDialog extends SettingsDialog{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
|
|
||||||
|
t.row();
|
||||||
|
|
||||||
|
if(!ios){
|
||||||
|
t.addImageTextButton("$data.openfolder", Icon.folderSmall, style, () -> Core.app.openFolder(Core.settings.getDataDirectory().absolutePath()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(prefs);
|
ScrollPane pane = new ScrollPane(prefs);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package mindustry.world.blocks.liquid;
|
package mindustry.world.blocks.liquid;
|
||||||
|
|
||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.struct.*;
|
|
||||||
import arc.func.*;
|
import arc.func.*;
|
||||||
import arc.graphics.g2d.*;
|
import arc.graphics.g2d.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.traits.BuilderTrait.*;
|
import mindustry.entities.traits.BuilderTrait.*;
|
||||||
@@ -13,7 +13,6 @@ import mindustry.entities.type.*;
|
|||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.modules.*;
|
|
||||||
|
|
||||||
public class Conduit extends LiquidBlock implements Autotiler{
|
public class Conduit extends LiquidBlock implements Autotiler{
|
||||||
public final int timerFlow = timers++;
|
public final int timerFlow = timers++;
|
||||||
@@ -92,13 +91,12 @@ public class Conduit extends LiquidBlock implements Autotiler{
|
|||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
ConduitEntity entity = tile.ent();
|
ConduitEntity entity = tile.ent();
|
||||||
LiquidModule mod = tile.entity.liquids;
|
|
||||||
int rotation = tile.rotation() * 90;
|
int rotation = tile.rotation() * 90;
|
||||||
|
|
||||||
Draw.colorl(0.34f);
|
Draw.colorl(0.34f);
|
||||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
||||||
|
|
||||||
Draw.color(mod.current().color);
|
Draw.color(tile.entity.liquids.current().color);
|
||||||
Draw.alpha(entity.smoothLiquid);
|
Draw.alpha(entity.smoothLiquid);
|
||||||
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
Draw.rect(botRegions[entity.blendbits], tile.drawx(), tile.drawy(), rotation);
|
||||||
Draw.color();
|
Draw.color();
|
||||||
|
|||||||
Reference in New Issue
Block a user