diff --git a/source/Trek-12/Models/Game/BestScore.cs b/source/Trek-12/Models/Game/BestScore.cs
index c2c5ca4..cbe2923 100644
--- a/source/Trek-12/Models/Game/BestScore.cs
+++ b/source/Trek-12/Models/Game/BestScore.cs
@@ -13,42 +13,46 @@ namespace Models.Game
public class BestScore
{
///
- /// Initialize a new instance of the BestScore class.
+ /// Number of games played by the user (on a specific map).
///
- /// Number of games played by the new user
- /// Best score
- public BestScore(int gamesPlayed, int score)
+ private int _gamesPlayed;
+ public int GamesPlayed
{
- GamesPlayed = gamesPlayed;
- Score = score;
- if (GamesPlayed < 0)
- GamesPlayed = 0;
- if (Score < 0)
- Score = 0;
+ get => _gamesPlayed;
+ private set
+ {
+ if (value >= 0)
+ _gamesPlayed = value;
+ else _gamesPlayed = 0;
+ }
}
-
+
///
- /// Number of games played by the user.
- ///
- public int GamesPlayed { get; private set; }
-
- ///
- /// Best score of the player.
+ /// Best score of the player (on a specific map).
///
private int _score;
- public int Score
- {
- get
- {
- return _score;
- }
+ public int Score
+ {
+ get => _score;
private set
{
- if (value > _score)
+ if (value >= 0)
_score = value;
+ else _score = 0;
}
}
+ ///
+ /// Initialize a new instance of the BestScore class.
+ ///
+ /// Number of games played by the new user
+ /// Best score
+ public BestScore(int gamesPlayed, int score)
+ {
+ GamesPlayed = gamesPlayed;
+ Score = score;
+ }
+
///
/// Increment the number of games played by the user.
///
diff --git a/source/Trek-12/Models/Game/Player.cs b/source/Trek-12/Models/Game/Player.cs
index cb8f095..71bdc9f 100644
--- a/source/Trek-12/Models/Game/Player.cs
+++ b/source/Trek-12/Models/Game/Player.cs
@@ -17,6 +17,12 @@ namespace Models.Game
void OnPropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ ///
+ /// The best score of the player on a specific map.
+ ///
+ [DataMember]
+ public Dictionary