Exemplo n.º 1
0
        public void Handle(endMatchEvent message)
        {
            _matchScores.Clear();
            foreach (Player player in message.players)
            {
                dynamic dynamicScore = new System.Dynamic.ExpandoObject();
                dynamicScore.position = 0;
                dynamicScore.name     = player.Username;
                dynamicScore.score    = player.score.scoreTotal;
                _matchScores.Add(dynamicScore);
            }

            _matchScores = new BindableCollection <dynamic>(_matchScores.OrderByDescending(i => i.score));

            if (this._userData.matchMode == Models.MatchMode.sprintSolo || this._userData.matchMode == Models.MatchMode.sprintCoop)
            {
                foreach (dynamic score in _matchScores)
                {
                    score.position = "";
                    score.score    = ": " + score.score + " points";
                }
            }
            else
            {
                int rank = 1;
                foreach (dynamic score in _matchScores)
                {
                    score.position = rank + ".";
                    score.score    = ": " + score.score + " points";
                    rank++;
                }
            }

            // _matchScores = new BindableCollection<dynamic>(_matchScores.OrderBy(i => i.position));

            endTurn.players = new BindableCollection <Player>();
            NotifyOfPropertyChange(() => joueurs);


            _winnerMessage = "The winner is " + _matchScores[0].name;
            if (this._userData.matchMode == Models.MatchMode.sprintSolo || this._userData.matchMode == Models.MatchMode.sprintCoop)
            {
                _winnerMessage = "";
            }
            NotifyOfPropertyChange(() => winnerMessage);
            matchScores.Refresh();
            NotifyOfPropertyChange(() => matchScores);
            this._timer.Stop();
        }
Exemplo n.º 2
0
 public void Handle(endMatchEvent message)
 {
     endMatchBox.Visibility = Visibility.Visible;
 }