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); }
public ScreenRecords(GameCore game, Vector2 animacao) : base(game) { this.animacao = animacao; bg = mygame.Content.Load <Texture2D>("bg"); int width = game.Window.ClientBounds.Right - game.Window.ClientBounds.Left; int height = game.Window.ClientBounds.Bottom - game.Window.ClientBounds.Top; Texture2D img = mygame.Content.Load <Texture2D>("labelRecordsTitle"); recordsSprite = new Sprite(mygame, img, 1, new Vector3(width / 2 - img.Width / 2, 20, 0), 1); while (width > 0) { width -= 200; int htemp = height; while (htemp > -200) { htemp -= 200; bgpos.Add(new Vector2(width, htemp)); } } szbg = bgpos.Count; while (SaveGame.getInstance().GameLoadRequested) { Console.WriteLine("waiting....."); SaveGame.getInstance().Update(); } int y = 150; SaveGame.SavePlayer save = SaveGame.getInstance().player; if (save.score == null) { Console.WriteLine("sem registro"); } else { for (int i = 0; i < 10; i++) { SaveGame.SavePlayerBean bean = save.score[i]; Label lb = new Label(Player.completer((i + 1) + "", 2, "0") + " " + bean.date + " " + bean.name + " " + Player.completer(bean.score + "", 7, "0"), new Vector3(i * -20, y, 0), mygame); lb.interChar = 0; ranks.Add(lb); y += 30; } } }