public object GenerateBracketObject()
        {
            List <dynamic> Rounds       = new List <dynamic>();
            List <dynamic> PlayedGames  = new List <dynamic>();
            List <dynamic> RoundResults = new List <dynamic>();


            int currentRound = 0;

            foreach (var item in _gameFixture)
            {
                if (currentRound != item.RoundNumber || currentRound == 0) // new Round
                {
                    /*PlayedGames = new List<dynamic>();*/
                    RoundResults = new List <dynamic>();
                }

                List <dynamic> Game = new List <dynamic>();
                if (item.HomeTeam != null)
                {
                    Game.Add(item.HomeTeam.Tag);
                }

                if (item.AwayTeam != null)
                {
                    Game.Add(item.AwayTeam?.Tag);
                }

                if ((item.HomeTeam == null && item.AwayTeam != null) || (item.HomeTeam != null && item.AwayTeam == null))
                {
                    Game.Add(null);
                }

                if ((item.HomeTeam != null || item.AwayTeam != null) && item.RoundNumber == 1)
                {
                    PlayedGames.Add(Game);
                }


                List <dynamic> Scores = new List <dynamic>();
                Scores.Add(item != null && item.IsFinished  ?  item.HomeTeamScore : null);
                Scores.Add(item != null && item.IsFinished  ?  item.AwayTeamScore : null);
                RoundResults.Add(Scores);

                if (currentRound != item.RoundNumber)
                {
                    Rounds.Add(RoundResults);
                    currentRound = item.RoundNumber;
                }
            }


            var result = new { teams = PlayedGames.ToArray(), results = Rounds.ToArray() };

            return(result);
        }
Exemplo n.º 2
0
        public void RecordRoundsResult()
        {
            string        round   = string.Format("Results after round {0} ballot count", Round.ToWords());
            List <string> results = new List <string>();

            CompetingKingdom.ForEach(Kingdom =>
            {
                results.Add(string.Format("Allies for {0} : {1}", Kingdom.Name, Kingdom.GetAlliesCount()));
            });
            RoundResults.Add(round, results);
        }
Exemplo n.º 3
0
    private void ResetMatch()
    {
        CurrentRound = -1;

        RoundResults.Clear();
        for (int i = 0; i < TotalRound; i++)
        {
            RoundResults.Add(new RoundResultData());
        }

        CurrentMatchState = MatchState.Null;
    }