/// <summary> /// This method the response should determine which buttons need to be shown, for each button the text and width /// are set and the button click handler is set. /// </summary> public void SetupButtons() { // If the PlayerResponseControl object exists if ((this.HasPlayerResponseControl) && (this.HasAllowedResponseTypes)) { // Create the ButtonDescriptors List <ButtonDescriptor> buttonDescriptors = PlayerResponseFactory.CreateButtonDescriptors(this.AllowedResponseTypes); // Setup the Buttons and the width of the control based upon the ButtonDescriptors this.PlayerResponseControl.SetupButtons(buttonDescriptors); // Tell it what button click handler to use this.PlayerResponseControl.ButtonClickHandler = this.ButtonClickHandler; } }
/// <summary> /// This method returns the For Bet /// </summary> internal void PromptForBet(PlayerResponseControl responseControl, Hand hand, Options houseRules) { // locals PlaceBetResponseRequest placeBetResponseRequest = null; PlayerResponse playerResponse = null; double amountWagered = 0; // If the responseControl object exists if ((NullHelper.Exists(responseControl)) && (responseControl.HasResponseRequest)) { // get a local copy so the type is shorter placeBetResponseRequest = responseControl.ResponseRequest as PlaceBetResponseRequest; // if the responseRequest exists if (NullHelper.Exists(placeBetResponseRequest)) { // if this is a computer player if (this.IsComputerPlayer) { // if the SendResponseCallBack exists if (responseControl.HasSendResponseCallBack) { // To Do: Create a computer logic, this is just a stub for now amountWagered = placeBetResponseRequest.TableMinimum * 7; // If the PlayerControl object exists if (this.HasPlayerControl) { // Show the amount the computer player bet this.PlayerControl.ShowAmountWagered(amountWagered); } // Create the PlayerResponse playerResponse = new PlayerResponse(ResponseTypeEnum.PlaceBet, amountWagered); // Set the responseCallBack responseControl.SendResponseCallBack(playerResponse); } } else { // not a computer player, this is a human the dealer must interact with // If the PlayerControl object exists if ((this.HasPlayerControl) && (NullHelper.Exists(responseControl))) { // Create a new hand hand.Player = this; // Show the Chip Selector and the Amount Bet TextBox this.PlayerControl.PromptForBet(); // Create the response and cast it as a PlaceBetResponse PlaceBetResponseRequest request = PlayerResponseFactory.CreatePlayerResponseRequest(ResponseRequestTypeEnum.PlaceBet, responseControl, this.PlayerControl, houseRules) as PlaceBetResponseRequest; // if the request exists if (NullHelper.Exists(request)) { // Setup the Response before showing responseControl.ResponseRequest = request; // Prompt the user for a response playerResponse = request.Start(responseControl, this.PlayerControl); } } else { // this must be sitting out hand.SittingOut = true; hand.Player.SittingOut = true; } } } else { // Without a ResponseRequest they are sitting out this.SittingOut = true; hand.Player.SittingOut = true; } } // Change the status of this player if it changed this.SittingOut = hand.SittingOut; }