Beispiel #1
0
        /// <summary>
        /// Assumes well-formatted.
        /// </summary>
        public static SavedLeaderboard CreateLeaderboardObject(string key, short fortnightNo = -1, ulong teamspecific = 0)
        {
            string path;

            if (fortnightNo == -1)
            {
                path = LEADERBOARD_DIRECTORY + "\\" + key + ".txt";
            }
            else
            {
                path = LEADERBOARD_DIRECTORY + "\\" + "FN" + fortnightNo.ToString() + "_" + key + ".txt";
            }
            if (!File.Exists(path))
            {
                if (!CreateLeaderboardFile(key, fortnightNo))
                {
                    return(null);
                }
            }
            string[] result = File.ReadAllLines(path);

            SavedLeaderboard.Scoring type = SavedLeaderboard.Scoring.Points;
            if (key.StartsWith("ITER") || key.StartsWith("FIRST"))
            {
                type = SavedLeaderboard.Scoring.Wins;
            }
            if (key.StartsWith("HIGH"))
            {
                type = SavedLeaderboard.Scoring.Highscore;
            }
            SavedLeaderboard leaderboard = new SavedLeaderboard(key, result, type, fortnightNo, teamspecific);

            return(leaderboard);
        }
Beispiel #2
0
        public static string GetUserScore(string gameAbbreviation, ulong soughtID, string name = "ITER", string humanName = "",
                                          short fortnight = -1, bool local = false)
        {
            string           key    = name + "-" + gameAbbreviation; //ITER-UNO example
            SavedLeaderboard lb     = SaveFiles_Mapped.CreateLeaderboardObject(key, fortnight);
            string           result = lb.GetHumanReadableScore(soughtID, humanName, local);

            return(result);
        }
Beispiel #3
0
        public static string GetLeaderboard(string gameAbbreviation, string name = "ITER", string humanName = "",
                                            short fortnight = -1, short startIndex = 0, byte noOfEntries = 10, ulong teamspecific = 0)
        {
            string           key    = name + "-" + gameAbbreviation; //ITER-UNO example
            SavedLeaderboard lb     = SaveFiles_Mapped.CreateLeaderboardObject(key, fortnight, teamspecific);
            string           result = lb.MakeHumanReadable(humanName, startIndex, noOfEntries);

            return(result);
        }