コード例 #1
0
 private void Callbacks_EndRace(object sender, EndRaceEventArgs e)
 {
     if (Settings.HidOnFinish)
     {
         RunCatchLog(() => SendEmptyManiaLinkPage(Settings.ManiaLinkPageID), "Error in Callbacks_EndRace Method.", true);
     }
 }
コード例 #2
0
        private void Callbacks_EndRace(object sender, EndRaceEventArgs e)
        {
            RunCatchLog(() =>
            {
                int top = Convert.ToInt32(Settings.SaveGhostReplayOfTop);

                if (top < 100)
                {
                    foreach (PlayerRank rank in e.Rankings.Take(top).Where(x => x.BestTime > 0))
                    {
                        Context.RPCClient.Methods.SaveBestGhostsReplay(rank.Login, string.Empty);
                    }
                }
                else
                {
                    Context.RPCClient.Methods.SaveBestGhostsReplay(string.Empty, string.Empty);
                }
            }, "Errror in Callbacks_EndRace", true);
        }
コード例 #3
0
        private void Callbacks_EndRace(object sender, EndRaceEventArgs e)
        {
            RunCatchLog(() =>
            {
                if (e.Rankings.Count == 0 || !e.Rankings.Exists(ranking => ranking.BestTime != -1))
                {
                    return;
                }

                List <DedimaniaTime> times = new List <DedimaniaTime>();

                foreach (PlayerRank ranking in e.Rankings)
                {
                    if (ranking.BestTime >= 6 * 1000 && CheckpointsValid(ranking.BestCheckpoints))
                    {
                        times.Add(new DedimaniaTime(ranking.Login, ranking.BestTime, ranking.BestCheckpoints));
                    }
                }

                if (times.Count == 0)
                {
                    return;
                }

                GameMode?currentGameMode = GetCurrentGameModeCached(this);
                if (!currentGameMode.HasValue)
                {
                    return;
                }

                ResetUpdateServerPlayersTimer();
                DedimaniaChallengeRaceTimesReply challengeRaceTimesReply = DedimaniaClient.ChallengeRaceTimes(e.Challenge.UId, e.Challenge.Name, e.Challenge.Environnement, e.Challenge.Author, Context.ServerInfo.Version.GetShortName(), (int)currentGameMode.Value, e.Challenge.NumberOfCheckpoints, (int)DedimaniaSettings.MAX_RECORDS_TO_REPORT, times.ToArray());

                if (challengeRaceTimesReply == null)
                {
                    Logger.WarnToUI("Error while calling ChallengeRaceTimes!");
                }
            }, "Error in Callbacks_EndChallenge Method.", true);
        }
コード例 #4
0
        private void Callbacks_EndRace(object sender, EndRaceEventArgs e)
        {
            RunCatchLog(() =>
            {
                if (e.Rankings.Count > 0)
                {
                    // this may take a while, so run it async on the thread pool
                    ThreadPool.QueueUserWorkItem(UpdateRankingForChallenge, e.Challenge.UId);
                }

                if (e.Rankings.Count > 1)
                {
                    // there must be at least 2 players to increase the wins for the first player
                    if (e.Rankings[0].BestTime > 0)
                    {
                        uint wins = PlayerAdapter.IncreaseWins(e.Rankings[0].Login);
                        OnPlayerWins(e.Rankings[0], wins);
                        int maxRank = e.Rankings.Max(playerRank => playerRank.Rank);

                        foreach (PlayerRank playerRank in e.Rankings)
                        {
                            if (playerRank.Rank <= 0)
                            {
                                continue;
                            }

                            if (!CheckpointsValid(playerRank.BestCheckpoints))
                            {
                                HandleCheater(playerRank.Login, false);
                            }
                            else
                            {
                                PositionAdapter.AddPosition(playerRank.Login, e.Challenge.UId, Convert.ToUInt16(playerRank.Rank), Convert.ToUInt16(maxRank));
                            }
                        }
                    }
                }
            }, "Error in Callbacks_EndRace Method.", true);
        }
コード例 #5
0
        private void Callbacks_EndRace(object sender, EndRaceEventArgs e)
        {
            RunCatchLog(() =>
            {
                UpdateListTimer.Clear();
                UpdateLocalRecordTimer.Clear();

                if (Settings.ShowPBUserInterface)
                {
                    SendEmptyManiaLinkPage(_pbManiaLinkPageID);
                }

                if (Settings.ShowLocalRecordUserInterface)
                {
                    SendEmptyManiaLinkPage(_localRecordManiaLinkPageID);
                }

                if (Settings.ShowLocalRecordListUserInterface && Settings.HideRecordListUIOnFinish)
                {
                    SendEmptyManiaLinkPage(_localRecordListManiaLinkPageID);
                }
            }, "Error in Callbacks_EndRace Method.", true);
        }