Exemplo n.º 1
0
 public void FieldGoal_with_Assister()
 {
     _playFactory.NewPlay(_playerA, true);
     _playFactory.ChoosePlayType(PlayType.FieldGoal);
     _playFactory.SelectPoints("2");
     _playFactory.FGResult("Make");
     _playFactory.ConsecutivePlay(_playerB, true);
     Assert.Multiple(() =>
     {
         var _plays = _playFactory.GetPlays();
         Assert.AreEqual(2, _plays.Count);
         Assert.AreEqual(PlayType.FieldGoal, _plays.First().PlayType);
         Assert.AreEqual(_playerA, _plays.First().Player);
         Assert.AreEqual(PlayType.Assist, _plays.Last().PlayType);
         Assert.AreEqual(_playerB, _plays.Last().Player);
         Assert.AreEqual(2, _plays.Last().Points);
     });
 }
Exemplo n.º 2
0
        private void ChoosePlayer(int Id)
        {
            var _player = Players.First(p => p.Id == Id);

            if (!_playFactory.HasPlay)
            {
                SetZeroVisibility();
                SetDefaultButtonsVisibleOnly();
                //_play = NewPlayNow(Players.First(p => p.Id == Id), PossesionTeamB);
                _playFactory.NewPlay(_player, PossesionTeamB);
                InfoText = "Wybierz akcję:";
            }
            else
            {
                //_play.Player = Players.First(p => p.Id == Id);
                _playFactory.ConsecutivePlay(_player, TeamB.Contains(_player));
                foreach (var play in _playFactory.GetPlays())
                {
                    Plays.Add(play);

                    if (play.PlayType == PlayType.CheckIn)
                    {
                        if (TeamABench.Contains(play.Player))
                        {
                            TeamABench.Remove(play.Player);
                            TeamAOnCourt.Add(play.Player);
                        }
                        if (TeamBBench.Contains(play.Player))
                        {
                            TeamBBench.Remove(play.Player);
                            TeamBOnCourt.Add(play.Player);
                        }
                    }
                    if (play.PlayType == PlayType.CheckOut)
                    {
                        if (TeamAOnCourt.Contains(play.Player))
                        {
                            TeamAOnCourt.Remove(play.Player);
                            TeamABench.Add(play.Player);
                        }
                        if (TeamBOnCourt.Contains(play.Player))
                        {
                            TeamBOnCourt.Remove(play.Player);
                            TeamBBench.Add(play.Player);
                        }
                    }
                }
                ;

                if (Plays.Last().PlayType == PlayType.Rebound)
                {
                    PossesionTeamB = Plays.Last().TeamB;
                }
                _playFactory.Clear();

                //switch possesion dla zbiorki nieofensywnej
                InfoText = "Wybierz zawodnika";
                SetDefaultButtonsVisibleOnly();
                SetPlayersVisibility();
            }
        }