mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-31 15:09:07 +07:00
Some more sharing revisions
This commit is contained in:
@ -105,7 +105,7 @@ text.savefail=Failed to save game!
|
||||
text.save.delete.confirm=Are you sure you want to delete this save?
|
||||
text.save.delete=Delete
|
||||
text.save.export=Export Save
|
||||
text.save.import.invalid=[orange]This save is invalid!
|
||||
text.save.import.invalid=[orange]This save is invalid!\n\nNote that[scarlet]importing saves with custom maps[orange]\nfrom other devices does not work!
|
||||
text.save.import.fail=[crimson]Failed to import save: [orange]{0}
|
||||
text.save.export.fail=[crimson]Failed to export save: [orange]{0}
|
||||
text.save.import=Import Save
|
||||
|
@ -86,7 +86,7 @@ public class Saves {
|
||||
current = slot;
|
||||
}
|
||||
|
||||
public void importSave(FileHandle file) throws IOException{
|
||||
public SaveSlot importSave(FileHandle file) throws IOException{
|
||||
SaveSlot slot = new SaveSlot(nextSlot);
|
||||
slot.importFile(file);
|
||||
nextSlot ++;
|
||||
@ -94,6 +94,7 @@ public class Saves {
|
||||
saves.add(slot);
|
||||
slot.meta = SaveIO.getData(slot.index);
|
||||
current = slot;
|
||||
return slot;
|
||||
}
|
||||
|
||||
public Array<SaveSlot> getSaveSlots(){
|
||||
|
@ -165,26 +165,30 @@ public class LoadDialog extends FloatingDialog{
|
||||
}).fillX().margin(10f).minWidth(300f).height(70f).pad(4f).padRight(-4);
|
||||
}
|
||||
|
||||
public void runLoadSave(SaveSlot slot){
|
||||
ui.loadfrag.show();
|
||||
|
||||
Timers.runTask(3f, () -> {
|
||||
ui.loadfrag.hide();
|
||||
hide();
|
||||
try{
|
||||
slot.load();
|
||||
state.set(State.playing);
|
||||
ui.paused.hide();
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
ui.paused.hide();
|
||||
state.set(State.menu);
|
||||
logic.reset();
|
||||
ui.showError("$text.save.corrupted");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void modifyButton(TextButton button, SaveSlot slot){
|
||||
button.clicked(() -> {
|
||||
if(!button.childrenPressed()){
|
||||
ui.loadfrag.show();
|
||||
|
||||
Timers.runTask(3f, () -> {
|
||||
ui.loadfrag.hide();
|
||||
hide();
|
||||
try{
|
||||
slot.load();
|
||||
state.set(State.playing);
|
||||
ui.paused.hide();
|
||||
}catch(Exception e){
|
||||
Log.err(e);
|
||||
ui.paused.hide();
|
||||
state.set(State.menu);
|
||||
logic.reset();
|
||||
ui.showError("$text.save.corrupted");
|
||||
}
|
||||
});
|
||||
runLoadSave(slot);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user