Ejemplo n.º 1
0
 public frm_gameBoard()
 {
     InitializeComponent();
     _gameController = new GameController();
     _board = _gameController.Board;
     UpdateUILanguage();
 }
Ejemplo n.º 2
0
        public frm_Trade(GameController g)
        {
            GameController = g;
            InitializeComponent();
            UpdateUILanguage();
            foreach (Player p in GameController.Players)
            {
                if (p != GameController.CurrentPlayer)
                {
                    cBox_tradePlayer.Items.Add(p.Name);
                }
            }
            foreach (var t in _ports)
            {
                cBox_tradePort.Items.Add(t);
            }
            _labels.Add(lbl_tradeBrickOffer);
            _labels.Add(lbl_tradeGrainOffer);
            _labels.Add(lbl_tradeLumberOffer);
            _labels.Add(lbl_tradeOreOffer);
            _labels.Add(lbl_tradeWoolOffer);

            Dictionary<CardType, int> resources = new Dictionary<CardType, int>();
            if (GameController.CurrentPlayer != null)
            {
                resources = GameController.CurrentPlayer.GetNumberOfResources();
            }
            lbl_tradeBrickHave.Text = resources[CardType.Brick].ToString();
            lbl_tradeWoolHave.Text = resources[CardType.Wool].ToString();
            lbl_tradeLumberHave.Text = resources[CardType.Lumber].ToString();
            lbl_tradeGrainHave.Text = resources[CardType.Grain].ToString();
            lbl_tradeOreHave.Text = resources[CardType.Ore].ToString();
        }
Ejemplo n.º 3
0
 public void setColors(GameController myGC, int h)
 {
     var dim = h/myGC.Players.Count;
     Height = h-2;
     Width = dim;
     var y = 0;
     foreach (var p in myGC.Players)
     {
         var temp = new Label
                        {Size = new Size(dim, dim), BackColor = p.GetDrawColor(), Location = new Point(0, y)};
         this.Controls.Add(temp);
         y += dim;
     }
 }
Ejemplo n.º 4
0
        public frm_gameBoard(GameController controller)
        {
            InitializeComponent();
            _gameController = controller;
            _board = _gameController.Board;
            UpdateUILanguage();
            sp_PlayerScores.gc = controller;
            sp_PlayerScores.UpdateScores();
            cp_PlayerColors.Location = new Point(sp_PlayerScores.Location.X + sp_PlayerScores.Width, sp_PlayerScores.Location.Y+1);
            cp_PlayerColors.setColors(_gameController,sp_PlayerScores.Height);

            _context = Context.PlaceVillageSetup;

            pnl_playerData.Enabled = false;
            _firstPlayer = _gameController.CurrentPlayer;
        }
Ejemplo n.º 5
0
        public void SetUp()
        {
            _board = new Board();

            _player1 = new Player();
            _player2 = new Player();
            _player3 = new Player();
            _player4 = new Player();

            _controller = new GameController();
            _controller.Board = _board;

            _controller.Players.Add(_player1);
            _controller.Players.Add(_player2);
            _controller.Players.Add(_player3);
            _controller.Players.Add(_player4);
        }
Ejemplo n.º 6
0
 public void SetUp()
 {
     _controller = new GameController();
 }
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            if (
                txt_Name1.Text == ""
                || txt_Name2.Text == ""
                || txt_Name3.Text == ""
                || (txt_Name4.Text == "" && NumPlayers > 3)
                || cbox_Color1.SelectedItem.ToString() == Resources.None
                || cbox_Color2.SelectedItem.ToString() == Resources.None
                || cbox_Color3.SelectedItem.ToString() == Resources.None
                || (cbox_Color4.SelectedItem.ToString() == Resources.None && NumPlayers > 3)
                )
            {
                MessageBox.Show(
                    "You have not completed all of the required fields.",
                    "Incomplete Field",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation,
                    MessageBoxDefaultButton.Button1);
                return;
            }
            else
            {
                Player1Name = txt_Name1.Text;
                Player1Color = (Colors)Enum.Parse(typeof(Colors), getColor(cbox_Color1.SelectedItem.ToString()));
                var player1 = new Player(Player1Name) {PlayerColor = Player1Color};

                Player2Name = txt_Name2.Text;
                Player2Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color2.SelectedItem.ToString()));
                var player2 = new Player(Player2Name) { PlayerColor = Player2Color };

                Player3Name = txt_Name3.Text;
                Player3Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color3.SelectedItem.ToString()));
                var player3 = new Player(Player3Name) { PlayerColor = Player3Color };

                var players = new List<Player> { player1, player2, player3 };

                if (NumPlayers > 3)
                {
                    Player4Name = txt_Name4.Text;
                    Player4Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color4.SelectedItem.ToString()));
                    players.Add(new Player(Player4Name) { PlayerColor = Player4Color });
                }

                Controller = new GameController(players);

                this.DialogResult = DialogResult.OK;
                return;
            }
        }
Ejemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     var players = new List<Player> {new Player("Barry") {PlayerColor = Colors.Orange},
                                     new Player("Alice") {PlayerColor = Colors.Blue},
                                     new Player("Pat") {PlayerColor = Colors.White}};
     var controller = new GameController(players);
     var gameBoard = new frm_gameBoard(controller);
     this.Hide();
     gameBoard.Show();
 }