/* * This will allow the player to choose what resources they loose when * the dice land on a "7" while the player has more than 7 resources on hand. */ public void loadPlayerResourceLoss(Player pl) { //Load the player's resource selectors for (int i = 0; i < 5; i++) { Board.ResourceType resType = (Board.ResourceType)i; ResourceSelector playerSelector = new ResourceSelector(resType); playerResourceSelectors.Add(playerSelector); pnlPlayer.Controls.Add(playerSelector); playerSelector.Location = new Point(5, i * playerSelector.Height + 1); playerSelector.hideControls(); playerSelector.Click += playerClickResourceSelectorRobber; } lblInstructions.Visible = true; btnAccept.Enabled = false; initiatingPlayer = pl; lblPlayerTitle.Text = pl.getName(); lblPlayerTitle.BackColor = pl.getColor(); //Disable the cancel button btnCancel.Visible = false; int numToGive = pl.getTotalResourceCount() / 2; //Since this is an integer, VS will automatically drop the decimal which is essentailly the same as floor(count/2) minimumPlayerInput = numToGive; //Hide the other section lblTradeName.Text = ""; pnlOther.Visible = false; //Show the player some instructions. lblInstructions.Text = "Please select " + numToGive + " resource to give up."; btnClearSelection.Click += playerClickResourceSelectorRobber; }