v0.4.1a: fixed problems with rankings ids, implemented UUIDs for them as well
This commit is contained in:
parent
7dc2f24eda
commit
cdb13146eb
|
@ -48,7 +48,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||||
import com.watabou.noosa.Game;
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.utils.Bundlable;
|
import com.watabou.utils.Bundlable;
|
||||||
import com.watabou.utils.Bundle;
|
import com.watabou.utils.Bundle;
|
||||||
import com.watabou.utils.SystemTime;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -57,6 +56,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public enum Rankings {
|
public enum Rankings {
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public enum Rankings {
|
||||||
|
|
||||||
INSTANCE.saveGameData(rec);
|
INSTANCE.saveGameData(rec);
|
||||||
|
|
||||||
rec.gameID = String.valueOf(SystemTime.now);
|
rec.gameID = UUID.randomUUID().toString();
|
||||||
|
|
||||||
records.add( rec );
|
records.add( rec );
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ import com.watabou.noosa.Image;
|
||||||
import com.watabou.noosa.audio.Sample;
|
import com.watabou.noosa.audio.Sample;
|
||||||
|
|
||||||
import javax.microedition.khronos.opengles.GL10;
|
import javax.microedition.khronos.opengles.GL10;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class WelcomeScene extends PixelScene {
|
public class WelcomeScene extends PixelScene {
|
||||||
|
|
||||||
|
@ -148,22 +150,26 @@ public class WelcomeScene extends PixelScene {
|
||||||
|
|
||||||
private void updateVersion(int previousVersion){
|
private void updateVersion(int previousVersion){
|
||||||
//rankings conversion
|
//rankings conversion
|
||||||
if (previousVersion < 108){
|
if (previousVersion <= 114){
|
||||||
Rankings.INSTANCE.load();
|
Rankings.INSTANCE.load();
|
||||||
for (Rankings.Record rec : Rankings.INSTANCE.records){
|
for (Rankings.Record rec : Rankings.INSTANCE.records){
|
||||||
try{
|
if (rec.gameFile != null) {
|
||||||
Dungeon.loadGame(rec.gameFile, false);
|
try {
|
||||||
rec.gameID = rec.gameFile.replaceAll("\\D", "");
|
Dungeon.loadGame(rec.gameFile, false);
|
||||||
|
rec.gameID = rec.gameFile.replaceAll("\\D", "");
|
||||||
|
|
||||||
Rankings.INSTANCE.saveGameData(rec);
|
Rankings.INSTANCE.saveGameData(rec);
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
rec.gameID = rec.gameFile.replaceAll("\\D", "");
|
rec.gameID = rec.gameFile.replaceAll("\\D", "");
|
||||||
rec.gameData = null;
|
rec.gameData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String file = rec.gameFile;
|
||||||
|
rec.gameFile = "";
|
||||||
|
Game.instance.deleteFile(file);
|
||||||
|
} else if (rec.gameID == null){
|
||||||
|
rec.gameID = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
String file = rec.gameFile;
|
|
||||||
rec.gameFile = "";
|
|
||||||
Game.instance.deleteFile(file);
|
|
||||||
}
|
}
|
||||||
Rankings.INSTANCE.save();
|
Rankings.INSTANCE.save();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user