private void MainGrid_Loaded(object sender, RoutedEventArgs e)
        {
            worldCup = new WorldCup();
            worldCup.TeamProvider = new FootballLib.DataProviders.SqlProvider();
            PreRound   preRound   = new PreRound();
            PlayOff    playOff    = new PlayOff();
            OctRound   octRound   = new OctRound();
            QuadRound  quadRound  = new QuadRound();
            FinalRound finalRound = new FinalRound();

            preRound.InputTeams = worldCup.TeamList;

            playOff.InputTeams = preRound.Play();
            resultPlayOff      = playOff.Play();
            matchesPlayOff     = playOff.MatchList;

            octRound.InputTeams = new List <Team>(resultPlayOff);
            resultOct           = octRound.Play();
            matchesOct          = octRound.MatchList;

            quadRound.InputTeams = new List <Team>(resultOct);
            resultQuad           = quadRound.Play();
            matchesQuad          = quadRound.MatchList;

            finalRound.InputTeams = new List <Team>(resultQuad);
            Team championship = finalRound.Play()[0];

            matchesFinal = finalRound.MatchList;

            groupA.OnClick += Group_OnClick;
            groupB.OnClick += Group_OnClick;
            groupC.OnClick += Group_OnClick;
            groupD.OnClick += Group_OnClick;
            groupE.OnClick += Group_OnClick;
            groupF.OnClick += Group_OnClick;
            groupG.OnClick += Group_OnClick;
            groupH.OnClick += Group_OnClick;

            sc1.OnClick += Sc_Playoff;
            sc2.OnClick += Sc_Playoff;
            sc3.OnClick += Sc_Playoff;
            sc4.OnClick += Sc_Playoff;
            sc5.OnClick += Sc_Playoff;
            sc6.OnClick += Sc_Playoff;
            sc7.OnClick += Sc_Playoff;
            sc8.OnClick += Sc_Playoff;

            groupQuad1.OnClick += GroupQuad_OnClick;
            groupQuad2.OnClick += GroupQuad_OnClick;
            groupQuad3.OnClick += GroupQuad_OnClick;
            groupQuad4.OnClick += GroupQuad_OnClick;

            scQ1.OnClick += ScQ_OnClick;
            scQ2.OnClick += ScQ_OnClick;
            scQ3.OnClick += ScQ_OnClick;
            scQ4.OnClick += ScQ_OnClick;
        }
Ejemplo n.º 2
0
        public void Play(out Team Winner)
        {
            Start?.Invoke();
            Jingle?.Invoke("/Opening.mp3");
            RequestIn("Готовы к следующему раунду?");

            foreach (Round round in Rounds)
            {
                CurrentRound = round;
                RequestOut($"== {round.Name} ==");
                Jingle?.Invoke(round.Jingle);
                RefreshBoard?.Invoke();

                int score = round.Play(out Winner);
                Winner.Score += score;
                SetScore();

                RequestOut("-- Открываем табло --");
                round.Reveal();
                RequestIn("Готовы к следующему раунду?");
            }

            CurrentRound = FinalRound;
            RequestOut($"== {FinalRound.Name} ==");
            Jingle?.Invoke(FinalRound.Jingle);
            ShowTitle();
            FinalRound.Play(out Winner);

            Winner = Teams.OrderByDescending(team => team.Score)
                     .Take(1)
                     .Single();

            Jingle?.Invoke("/Closing.mp3");
            RequestIn("Нажмите для завершения игры");
            ShowTitle();
            TheEnd?.Invoke();
        }
Ejemplo n.º 3
0
 public void HasChampionTeam()
 {
     Init(new TextProvider());
     Assert.AreEqual(1, finalRound.Play().Count);
 }