public void UpdateLeaderboards() { long[] times = new long[this.racers.Count]; List <RacePlayer> sortRacers = new List <RacePlayer>(this.racers); sortRacers.Sort((RacePlayer a, RacePlayer b) => { return((int)(a.CheckpointScore - b.CheckpointScore)); }); RacePlayer[] players = sortRacers.ToArray(); for (int i = 0; i < players.Length; i++) { RacePlayer player = players[i]; times[i] = player.LastCheckpointHit == null ? startTicks : player.CheckpointTimes[player.LastCheckpointHit]; } LeaderboardRPC rpc = new LeaderboardRPC(players, times); foreach (RacePlayer player in this.racers) { RpcManager.Instance.TriggerRPC(player, "SlipeRace.UpdateLeaderboard", rpc); } }
private void UpdateLeaderboard(LeaderboardRPC rpc) { this.players = rpc.players; this.times = new Dictionary <Player, long>(); for (int i = 0; i < players.Length; i++) { this.times[this.players[i]] = rpc.times[i]; } DrawToRenderTarget(); }