Exemple #1
0
        public void AddOrUpdate(string id, ScoreboardEntry entry)
        {
            bool rebuild = false;

            if (Entries.TryGetValue(id, out var value))
            {
                if (value.Score != entry.Score)
                {
                    value.Score = entry.Score;
                    rebuild     = true;
                }

                value.DisplayName = entry.DisplayName;
            }
            else
            {
                Entries.TryAdd(id, entry);
                rebuild = true;
            }

            if (rebuild)
            {
                Rebuild();
            }

            /*Entries.AddOrUpdate(id, entry, (oldId, oldValue) => entry);
             *
             * Rebuild();*/
        }
Exemple #2
0
        public bool TryGetByScore(uint score, out ScoreboardEntry entry)
        {
            foreach (var e in Entries.Values.ToArray())
            {
                if (e.Score == score)
                {
                    entry = e;

                    return(true);
                }
            }

            entry = null;
            return(false);
        }
Exemple #3
0
 public bool TryGet(string id, out ScoreboardEntry entry)
 {
     return(Entries.TryGetValue(id, out entry));
 }