|
- using System;
- using System.Collections.Generic;
- using SUISS.Storage;
-
- namespace SUISS.Cloud
- {
- public class LeaderboardEntry : IStorable, ILeaderboardEntry
- {
- public LeaderboardEntry(string sagid, string username, int primaryScore, int secondaryScore, int tertiaryScore, int quaternaryScore, int votes, bool islandReady)
- {
- this.Sagid = sagid;
- this.Username = username;
- this.PrimaryScore = primaryScore;
- this.SecondaryScore = secondaryScore;
- this.TertiaryScore = tertiaryScore;
- this.QuaternaryScore = quaternaryScore;
- this.Votes = votes;
- this.IslandReady = islandReady;
- }
-
- public LeaderboardEntry()
- {
- }
-
- public string Playername
- {
- get
- {
- return this.Username;
- }
- }
-
- public string InstallUuid
- {
- get
- {
- return this.Sagid;
- }
- }
-
- public int Votes { get; set; }
-
- public bool IslandReady { get; set; }
-
- public string Username { get; set; }
-
- public string Sagid { get; set; }
-
- public int PrimaryScore { get; set; }
-
- public int SecondaryScore { get; set; }
-
- public int TertiaryScore { get; set; }
-
- public int QuaternaryScore { get; set; }
-
- [Obsolete("Use Leaderboard.GetRank(LeaderboardEntry myEntry)")]
- public int Rank { get; private set; }
-
- public void SetRank(int rank)
- {
- this.Rank = rank;
- }
-
- void IStorable.FromStorage(IDictionary<string, object> dict)
- {
- if (dict.ContainsKey("Username"))
- {
- this.Username = (string)dict["Username"];
- }
- if (dict.ContainsKey("PrimaryScore"))
- {
- this.PrimaryScore = (int)dict["PrimaryScore"];
- }
- if (dict.ContainsKey("SecondaryScore"))
- {
- this.SecondaryScore = (int)dict["SecondaryScore"];
- }
- if (dict.ContainsKey("TertiaryScore"))
- {
- this.TertiaryScore = (int)dict["TertiaryScore"];
- }
- if (dict.ContainsKey("QuaternaryScore"))
- {
- this.QuaternaryScore = (int)dict["QuaternaryScore"];
- }
- if (dict.ContainsKey("SagId"))
- {
- this.Sagid = (string)dict["SagId"];
- }
- if (dict.ContainsKey("Votes"))
- {
- this.Votes = (int)dict["Votes"];
- }
- if (dict.ContainsKey("IslandReady"))
- {
- this.IslandReady = (bool)dict["IslandReady"];
- }
- }
-
- IDictionary<string, object> IStorable.ToStorage()
- {
- Dictionary<string, object> dictionary = new Dictionary<string, object>();
- dictionary["Username"] = this.Username;
- dictionary["PrimaryScore"] = this.PrimaryScore;
- dictionary["SecondaryScore"] = this.SecondaryScore;
- dictionary["TertiaryScore"] = this.TertiaryScore;
- dictionary["QuaternaryScore"] = this.QuaternaryScore;
- dictionary["SagId"] = this.Sagid;
- dictionary["Votes"] = this.Votes;
- dictionary["IslandReady"] = this.IslandReady;
- return dictionary;
- }
-
- private const string UsernameKey = "Username";
-
- private const string PrimaryScoreKey = "PrimaryScore";
-
- private const string SecondaryScoreKey = "SecondaryScore";
-
- private const string TertiaryScoreKey = "TertiaryScore";
-
- private const string QuaternaryScoreKey = "QuaternaryScore";
-
- private const string SagidKey = "SagId";
-
- private const string VotesKey = "Votes";
-
- private const string IslandReadyKey = "IslandReady";
- }
- }
|