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.utils.Bundlable;
|
||||
import com.watabou.utils.Bundle;
|
||||
import com.watabou.utils.SystemTime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -57,6 +56,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
public enum Rankings {
|
||||
|
||||
|
@ -87,7 +87,7 @@ public enum Rankings {
|
|||
|
||||
INSTANCE.saveGameData(rec);
|
||||
|
||||
rec.gameID = String.valueOf(SystemTime.now);
|
||||
rec.gameID = UUID.randomUUID().toString();
|
||||
|
||||
records.add( rec );
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ import com.watabou.noosa.Image;
|
|||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
public class WelcomeScene extends PixelScene {
|
||||
|
||||
|
@ -148,9 +150,10 @@ public class WelcomeScene extends PixelScene {
|
|||
|
||||
private void updateVersion(int previousVersion){
|
||||
//rankings conversion
|
||||
if (previousVersion < 108){
|
||||
if (previousVersion <= 114){
|
||||
Rankings.INSTANCE.load();
|
||||
for (Rankings.Record rec : Rankings.INSTANCE.records){
|
||||
if (rec.gameFile != null) {
|
||||
try {
|
||||
Dungeon.loadGame(rec.gameFile, false);
|
||||
rec.gameID = rec.gameFile.replaceAll("\\D", "");
|
||||
|
@ -164,6 +167,9 @@ public class WelcomeScene extends PixelScene {
|
|||
String file = rec.gameFile;
|
||||
rec.gameFile = "";
|
||||
Game.instance.deleteFile(file);
|
||||
} else if (rec.gameID == null){
|
||||
rec.gameID = UUID.randomUUID().toString();
|
||||
}
|
||||
}
|
||||
Rankings.INSTANCE.save();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user