public StorageDemo.SaveGame.SavePlayer convertToSave() { StorageDemo.SaveGame.SavePlayer saveT = SaveGame.getInstance().player; StorageDemo.SaveGame.SavePlayerBean saveBean = new SaveGame.SavePlayerBean(); saveBean.name = completer(Gamer.SignedInGamers[PlayerIndex.One].Gamertag, 10, " "); saveBean.score = score; DateTime dt = System.DateTime.Now; saveBean.date = completer(dt.Day + "", 2, "0") + "/" + completer(dt.Month + "", 2, "0") + "/" + dt.Year; StorageDemo.SaveGame.SavePlayerBean temp; if (saveT.score == null) { saveT.score = new SaveGame.SavePlayerBean[10]; saveT.score[0] = saveBean; StorageDemo.SaveGame.SavePlayerBean saveBeanZ = new SaveGame.SavePlayerBean(); saveBeanZ.name = completer("---", 10, " "); saveBeanZ.date = " / / "; saveBeanZ.score = 0; saveT.score[1] = saveT.score[2] = saveT.score[3] = saveT.score[4] = saveT.score[5] = saveT.score[6] = saveT.score[7] = saveT.score[8] = saveT.score[9] = saveBeanZ; } else { for (int i = 0; i < 10; i++) { if (saveT.score[i].score <= saveBean.score) { temp = saveT.score[i]; saveT.score[i] = saveBean; saveBean = temp; } } } return(saveT); }
public static StorageDemo.SaveGame.SavePlayer getMockPlayerSave() { StorageDemo.SaveGame.SavePlayer saveT = SaveGame.getInstance().player; saveT.score = new SaveGame.SavePlayerBean[10]; StorageDemo.SaveGame.SavePlayerBean saveBeanZ = new SaveGame.SavePlayerBean(); saveBeanZ.name = completer("---", 10, " "); saveBeanZ.date = " / / "; saveBeanZ.score = 0; saveT.score[0] = saveT.score[1] = saveT.score[2] = saveT.score[3] = saveT.score[4] = saveT.score[5] = saveT.score[6] = saveT.score[7] = saveT.score[8] = saveT.score[9] = saveBeanZ; return(saveT); }