Exemplo n.º 1
0
        internal static LeaderboardUpdate From(LeaderboardScoreUploaded_t e)
        {
            LeaderboardUpdate leaderboardUpdate = new LeaderboardUpdate()
            {
                Score         = e.Score,
                Changed       = e.ScoreChanged == 1,
                NewGlobalRank = e.GlobalRankNew,
                OldGlobalRank = e.GlobalRankPrevious
            };

            return(leaderboardUpdate);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Submit your new score, but won't replace your high score if it's lower
        /// </summary>
        public async Task <LeaderboardUpdate?> SubmitScoreAsync(int score, int[] details = null)
        {
            if (details == null)
            {
                details = noDetails;
            }

            var r = await SteamUserStats.Internal.UploadLeaderboardScore(this.Id, LeaderboardUploadScoreMethod.KeepBest, score, details, details.Length);

            if (!r.HasValue)
            {
                return(null);
            }

            return(LeaderboardUpdate.From(r.Value));
        }
        /// <summary>
        /// Submit your score and replace your old score even if it was better
        /// </summary>
        public async Task <LeaderboardUpdate?> ReplaceScore(int score, int[] details = null)
        {
            if (details == null)
            {
                details = noDetails;
            }

            var r = await SteamUserStats.Internal.UploadLeaderboardScore(Id, LeaderboardUploadScoreMethod.ForceUpdate, score, details, details.Length);

            if (!r.HasValue)
            {
                return(null);
            }

            return(LeaderboardUpdate.From(r.Value));
        }
Exemplo n.º 4
0
        public async Task <LeaderboardUpdate?> SubmitScoreAsync(int score, int[] details = null)
        {
            LeaderboardUpdate?nullable;

            if (details == null)
            {
                details = Leaderboard.noDetails;
            }
            LeaderboardScoreUploaded_t?nullable1 = await SteamUserStats.Internal.UploadLeaderboardScore(this.Id, LeaderboardUploadScoreMethod.KeepBest, score, details, (int)details.Length);

            LeaderboardScoreUploaded_t?nullable2 = nullable1;

            nullable1 = null;
            if (nullable2.HasValue)
            {
                nullable = new LeaderboardUpdate?(LeaderboardUpdate.From(nullable2.Value));
            }
            else
            {
                nullable = null;
            }
            return(nullable);
        }