예제 #1
0
 public void UpdateScores(string initials, int score)
 {
     for (int i = 0; i < _highScores.PlayerScores.Count; i++)
     {
         if (score > _highScores.PlayerScores[i].PlayerScore)
         {
             PlayerScoreModel playerScore = new PlayerScoreModel(initials, score);
             _highScores.PlayerScores.Insert(i, playerScore);
             _highScores.PlayerScores.RemoveAt(_highScores.PlayerScores.Count - 1);
             SaveHighScores();
             break;
         }
     }
 }
예제 #2
0
    public void GenerateTestScores()
    {
        List <PlayerScoreModel> playerScores = new List <PlayerScoreModel>();

        PlayerScoreModel playerScore1 = new PlayerScoreModel("RCW", 500);
        PlayerScoreModel playerScore2 = new PlayerScoreModel("TPB", 400);
        PlayerScoreModel playerScore3 = new PlayerScoreModel("ACR", 300);
        PlayerScoreModel playerScore4 = new PlayerScoreModel("BTR", 200);
        PlayerScoreModel playerScore5 = new PlayerScoreModel("JMS", 100);

        playerScores.Add(playerScore1);
        playerScores.Add(playerScore2);
        playerScores.Add(playerScore3);
        playerScores.Add(playerScore4);
        playerScores.Add(playerScore5);

        _highScores = new HighScoresModel(playerScores);

        SaveHighScores();
    }
예제 #3
0
 internal void SetValue(PlayerScoreModel ps)
 {
     detail.Name_Text.text  = ps.playerName;
     detail.Score_Text.text = ps.score.ToString();
 }