Made save difficulty display in dialog

This commit is contained in:
Anuken 2018-02-01 18:42:10 -05:00
parent 714965329c
commit 83ce2329f4
8 changed files with 33 additions and 8 deletions

View File

@ -78,6 +78,7 @@ text.off=Off
text.save.autosave=Autosave: {0}
text.save.map=Map: {0}
text.save.wave=Wave {0}
text.save.difficulty=Difficulty: {0}
text.save.date=Last Saved: {0}
text.confirm=Confirm
text.delete=Delete

View File

@ -12,7 +12,7 @@ import java.util.Locale;
import static io.anuke.mindustry.Vars.headless;
public class BundleLoader {
private static boolean externalBundle = false;
private static final boolean externalBundle = false;
public static void load(){
Settings.defaults("locale", "default");

View File

@ -1,5 +1,7 @@
package io.anuke.mindustry.io;
import io.anuke.mindustry.game.Difficulty;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@ -16,7 +18,7 @@ public abstract class SaveFileVersion {
byte mode = stream.readByte(); //read the gamemode
byte map = stream.readByte(); //read the map
int wave = stream.readInt(); //read the wave
return new SaveMeta(version, time, mode, map, wave);
return new SaveMeta(version, time, mode, map, wave, Difficulty.normal);
}
public abstract void read(DataInputStream stream) throws IOException;

View File

@ -1,23 +1,27 @@
package io.anuke.mindustry.io;
import static io.anuke.mindustry.Vars.*;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.world.Map;
import java.util.Date;
import static io.anuke.mindustry.Vars.world;
public class SaveMeta {
public int version;
public String date;
public GameMode mode;
public Map map;
public int wave;
public Difficulty difficulty;
public SaveMeta(int version, long date, int mode, int map, int wave){
public SaveMeta(int version, long date, int mode, int map, int wave, Difficulty difficulty){
this.version = version;
this.date = Platform.instance.format(new Date(date));
this.mode = GameMode.values()[mode];
this.map = world.maps().getMap(map);
this.wave = wave;
this.difficulty = difficulty;
}
}

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.async.AsyncExecutor;
import io.anuke.mindustry.core.GameState.State;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.world.Map;
import io.anuke.ucore.core.Settings;
@ -139,6 +140,10 @@ public class Saves {
return meta.wave;
}
public Difficulty getDifficulty(){
return meta.difficulty;
}
public GameMode getMode(){
return meta.mode;
}

View File

@ -8,6 +8,7 @@ import io.anuke.mindustry.entities.enemies.EnemyType;
import io.anuke.mindustry.game.Difficulty;
import io.anuke.mindustry.game.GameMode;
import io.anuke.mindustry.io.SaveFileVersion;
import io.anuke.mindustry.io.SaveMeta;
import io.anuke.mindustry.resource.Item;
import io.anuke.mindustry.resource.Upgrade;
import io.anuke.mindustry.resource.Weapon;
@ -32,6 +33,16 @@ public class Save15 extends SaveFileVersion {
super(15);
}
public SaveMeta getData(DataInputStream stream) throws IOException{
long time = stream.readLong(); //read last saved time
byte mode = stream.readByte(); //read the gamemode
byte map = stream.readByte(); //read the map
int wave = stream.readInt(); //read the wave
stream.readFloat(); //wave time
byte difficulty = stream.readByte();
return new SaveMeta(version, time, mode, map, wave, Difficulty.values()[difficulty]);
}
@Override
public void read(DataInputStream stream) throws IOException {
/*long loadTime = */
@ -240,9 +251,9 @@ public class Save15 extends SaveFileVersion {
stream.writeByte(control.upgrades().getWeapons().get(i).id); //weapon ordinal
}
}else{
stream.writeFloat(0);
stream.writeFloat(0);
stream.writeInt(0);
stream.writeFloat(world.getSpawnX());
stream.writeFloat(world.getSpawnY());
stream.writeInt(150);
stream.writeByte(0);
}

View File

@ -13,7 +13,7 @@ import java.util.Locale;
import static io.anuke.mindustry.Vars.ui;
public class LanguageDialog extends FloatingDialog{
private Locale[] locales = {Locale.ENGLISH, new Locale("fr", "FR"), new Locale("ru"), new Locale("pl", "PL"),
private Locale[] locales = {new Locale("en"), new Locale("fr", "FR"), new Locale("ru"), new Locale("pl", "PL"),
new Locale("es", "LA"), new Locale("pt", "BR"), new Locale("ko"), new Locale("in", "ID")};
public LanguageDialog(){

View File

@ -106,6 +106,8 @@ public class LoadDialog extends FloatingDialog{
button.row();
button.add(Bundles.format("text.save.wave", color+slot.getWave()));
button.row();
button.add(Bundles.format("text.save.difficulty", color+slot.getDifficulty()));
button.row();
button.label(() -> Bundles.format("text.save.autosave", color + Bundles.get(slot.isAutosave() ? "text.on" : "text.off")));
button.row();
button.add();