Implemented catching of settings flush exception

This commit is contained in:
Anuken 2017-10-08 19:44:38 -04:00
parent 60a13742cd
commit 0decc18d76
6 changed files with 26 additions and 11 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.anuke.mindustry"
android:versionCode="11"
android:versionName="2.1" >
android:versionCode="12"
android:versionName="2.2" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25" />

View File

@ -79,7 +79,7 @@ project(":core") {
apply plugin: "java"
dependencies {
compile 'com.github.anuken:ucore:77506a62ac'
compile 'com.github.anuken:ucore:fa05e4e0d1'
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-ai:1.8.1"
}

View File

@ -94,6 +94,10 @@ public class Renderer extends RendererModule{
if(Gdx.graphics.getHeight() / Core.cameraScale % 2 == 1){
camera.position.add(0, -0.5f, 0);
}
if(Gdx.graphics.getWidth() / Core.cameraScale % 2 == 1){
camera.position.add(-0.5f, 0, 0);
}
drawDefault();

View File

@ -17,9 +17,7 @@ import io.anuke.mindustry.input.AndroidInput;
import io.anuke.mindustry.input.PlaceMode;
import io.anuke.mindustry.resource.*;
import io.anuke.mindustry.ui.*;
import io.anuke.ucore.core.Core;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.*;
import io.anuke.ucore.function.VisibilityProvider;
import io.anuke.ucore.modules.SceneModule;
import io.anuke.ucore.scene.actions.Actions;
@ -34,7 +32,7 @@ public class UI extends SceneModule{
Table itemtable, weapontable, tools, loadingtable, desctable, respawntable;
SettingsDialog prefs;
KeybindDialog keys;
Dialog about, menu, restart, tutorial, levels, upgrades, load;
Dialog about, menu, restart, tutorial, levels, upgrades, load, settingserror;
Tooltip tooltip;
VisibilityProvider play = () -> !GameState.is(State.menu);
@ -58,6 +56,12 @@ public class UI extends SceneModule{
TooltipManager.getInstance().animations = false;
Settings.setErrorHandler(()->{
Timers.run(1f, ()->{
settingserror.show();
});
});
Dialog.closePadR = -1;
Dialog.closePadT = 5;
@ -109,6 +113,13 @@ public class UI extends SceneModule{
@Override
public void init(){
settingserror = new Dialog("Warning", "dialog");
settingserror.content().add("[crimson]Failed to access local storage.\nSettings will not be saved.");
settingserror.content().pad(10f);
settingserror.getButtonTable().addButton("OK", ()->{
settingserror.hide();
}).size(80f, 55f).pad(4);
load = new LoadDialog();
upgrades = new UpgradeDialog();

View File

@ -66,7 +66,7 @@ public class AndroidInput extends InputAdapter{
}
Effects.effect("break", tile.worldx(), tile.worldy());
Effects.shake(3f, 1f);
Effects.shake(3f, 1f, player);
tile.setBlock(Blocks.air);
player.breaktime = 0f;
Sounds.play("break");
@ -91,7 +91,7 @@ public class AndroidInput extends InputAdapter{
tile.rotation = (byte)player.rotation;
Effects.effect("place", tilex*tilesize, tiley*tilesize);
Effects.shake(2f, 2f);
Effects.shake(2f, 2f, player);
Sounds.play("place");
for(ItemStack stack : player.recipe.requirements){

View File

@ -61,7 +61,7 @@ public class Input{
tile.rotation = (byte)player.rotation;
Effects.effect("place", World.roundx(), World.roundy());
Effects.shake(2f, 2f);
Effects.shake(2f, 2f, player);
Sounds.play("place");
for(ItemStack stack : player.recipe.requirements){
@ -91,7 +91,7 @@ public class Input{
}
Effects.effect("break", tile.worldx(), tile.worldy());
Effects.shake(3f, 1f);
Effects.shake(3f, 1f, player);
tile.setBlock(Blocks.air);
player.breaktime = 0f;
Sounds.play("break");