Changes to save importing, player sync fix, autosave on death fix

This commit is contained in:
Anuken
2018-01-09 13:19:36 -05:00
parent 4c16011480
commit 8e676494e3
19 changed files with 77 additions and 53 deletions

View File

@@ -65,6 +65,11 @@ public class LevelDialog extends FloatingDialog{
if(i % maxwidth == 0){
maps.row();
}
//TODO this is a hack
if(!Settings.has("hiscore" + map.name)){
Settings.defaults("hiscore" + map.name, 1);
}
Table inset = new Table("pane-button");
inset.add("[accent]" + Bundles.get("map."+map.name+".name", map.name)).pad(3f);

View File

@@ -89,24 +89,6 @@ public class LoadDialog extends FloatingDialog{
dialog.content().row();
dialog.content().addImageTextButton("$text.save.import", "icon-save", 14*3, () -> {
new FileChooser("$text.save.import", f -> f.extension().equals("mins"), true, file -> {
if(SaveIO.isSaveValid(file)){
try{
slot.importFile(file);
setup();
}catch (IOException e){
Vars.ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e, false)));
}
}else{
Vars.ui.showError("$text.save.import.invalid");
}
dialog.hide();
}).show();
});
dialog.content().row();
dialog.content().addImageTextButton("$text.save.export", "icon-load", 14*3, () -> {
new FileChooser("$text.save.export", false, file -> {
try{
@@ -151,11 +133,29 @@ public class LoadDialog extends FloatingDialog{
}
public void addSetup(){
if(Vars.control.getSaves().getSaveSlots().size != 0) return;
if(Vars.control.getSaves().getSaveSlots().size == 0) {
slots.row();
slots.addButton("$text.save.none", "clear", () -> {
}).disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
}
slots.row();
slots.addButton("$text.save.none", "clear", ()->{})
.disabled(true).fillX().margin(20f).minWidth(340f).height(80f).pad(4f);
slots.addImageTextButton("$text.save.import", "icon-add", "clear", 14*3, () -> {
new FileChooser("$text.save.import", f -> f.extension().equals("mins"), true, file -> {
if(SaveIO.isSaveValid(file)){
try{
Vars.control.getSaves().importSave(file);
setup();
}catch (IOException e){
Vars.ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e, false)));
}
}else{
Vars.ui.showError("$text.save.import.invalid");
}
}).show();
}).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
}
public void modifyButton(TextButton button, SaveSlot slot){

View File

@@ -11,14 +11,14 @@ public class RestartDialog extends Dialog {
public RestartDialog(){
super("$text.gameover", "dialog");
shown(()->{
shown(() -> {
content().clearChildren();
if(control.isHighScore()){
content().add("$text.highscore").pad(6);
content().row();
}
content().add("$text.lasted").pad(12).get();
content().add("[GREEN]" + control.getWave());
content().add("[accent]" + control.getWave());
pack();
});
@@ -26,6 +26,6 @@ public class RestartDialog extends Dialog {
hide();
GameState.set(State.menu);
control.reset();
});
}).size(130f, 60f);
}
}