コード例 #1
0
        public void Can_Create_Game_With_CardPlayers()
        {
            _deckersMeeting.CreateCardPlayers(4);
            var _cardPlayers = _deckersMeeting.GetPlayers();

            Assert.IsTrue(_cardPlayers.Any());
        }
コード例 #2
0
        private void StartGame()
        {
            _gameService.ClearPlayers();

            _gameService.CreateCardPlayers((int)CardPlayersInput.Value);
            _gameService.CreateDicePlayers((int)DicePlayersInput.Value, _rollResultChances);
            _gameService.CreateCardDicePlayers((int)CardDicePlayersInput.Value, _rollResultChances);

            if (_gameService.CanStartGame())
            {
                _players = _gameService.GetPlayers();
                var counter = 0;

                var x = 196;
                var y = 60;

                foreach (var player in _players)
                {
                    counter++;

                    PictureBox picture = new PictureBox
                    {
                        Name     = player.FullName,
                        Size     = new Size(100, 150),
                        SizeMode = PictureBoxSizeMode.StretchImage,
                        Location = new Point(x, y),
                        Visible  = true,
                    };

                    picture.MouseClick += new MouseEventHandler(player_Click);

                    Label lbl = new Label
                    {
                        Text      = player.FullName,
                        ForeColor = Color.Black,
                        Location  = new Point(x, picture.Height + y),
                        Height    = 50,
                        Width     = 100,
                        TextAlign = ContentAlignment.MiddleCenter
                    };

                    picture.ImageLocation = @"Content\Images\player.jpg";
                    Controls.Add(picture);
                    Controls.Add(lbl);

                    if (counter % 5 == 0)
                    {
                        x  = 196;
                        y += 210;
                    }
                    else
                    {
                        x += 108;
                    }
                }
            }
            else
            {
                MessageBox.Show("Ανώτατο όριο 15 παικτών. Παρακαλώ μειώστε το σύνολο των παικτών.");
            }
        }