public void AddScore(BasePlayer player, int score) { BaseArcadeMachine.ScoreEntry scoreEntry = new BaseArcadeMachine.ScoreEntry() { displayName = player.displayName, score = score, playerID = player.userID }; this.scores.Add(scoreEntry); this.scores.Sort((BaseArcadeMachine.ScoreEntry a, BaseArcadeMachine.ScoreEntry b) => b.score.CompareTo(a.score)); this.scores.TrimExcess(); base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); }
public override void Load(BaseNetworkable.LoadInfo info) { base.Load(info); if (info.msg.arcadeMachine != null && info.msg.arcadeMachine.scores != null) { this.scores.Clear(); for (int i = 0; i < info.msg.arcadeMachine.scores.Count; i++) { BaseArcadeMachine.ScoreEntry scoreEntry = new BaseArcadeMachine.ScoreEntry() { displayName = info.msg.arcadeMachine.scores[i].displayName, score = info.msg.arcadeMachine.scores[i].score, playerID = info.msg.arcadeMachine.scores[i].playerID }; this.scores.Add(scoreEntry); } } }