private void ComboBoxSelectPlayer_SelectionChanged(object sender, SelectionChangedEventArgs e) { Reset(); CardHolderPlayer1.ClearDeeds(); index = ComboBoxSelectPlayer.SelectedIndex; if (index >= monopolyGame.currentPlayerID - 1) { index++; } foreach (var prop in monopolyGame.GetPropertiesOwnedByPlayer(index)) { if (monopolyGame.HasAnyBuildingsOnIt(prop)) { continue; } CardHolderPlayer1.Add_Deed(prop); } if (monopolyGame.GetBalanceOfPlayer(index) < 0) { MoneySlider.Minimum = 0; } else { MoneySlider.Minimum = -1 * monopolyGame.GetBalanceOfPlayer(index); } if (monopolyGame.currentPlayerBalance < 0) { MoneySlider.Maximum = 0; } else { MoneySlider.Maximum = monopolyGame.currentPlayerBalance; } MoneySlider.Value = 0; }
private void BidForProperty(int highestBid = -1, int highestBider = -1, int playerid = 0) { playerid++; if (playerid < monopolyGame.amountOfPlayers + 1) { if (playerid == monopolyGame.currentPlayerID || monopolyGame.GetBalanceOfPlayer(playerid - 1) < monopolyGame.GetPriceOfProperty(monopolyGame.currentsPlayerLocation)) { BidForProperty(highestBid, highestBider, playerid); return; } ShowDialogBoxBidding($"Player {playerid} ({PA3BackEnd.src.Monopoly.MonopolyGame.GetUserTokenName(playerid)}) you can bid for a Property!\n Please Enter your bid!", monopolyGame.GetPriceOfProperty(monopolyGame.currentsPlayerLocation), monopolyGame.GetBalanceOfPlayer(playerid - 1), (object sender, RoutedEventArgs args) => { var dialog = (Dialog)sender; if (dialog.yes) { if (dialog.amount > highestBid) { highestBid = dialog.amount; highestBider = playerid; } } BidForProperty(highestBid, highestBider, playerid); }); return; } if (highestBider == -1) { ShowDialogBoxOK("Nobody bid for the property !", null); } else { monopolyGame.CompleteBid(highestBider - 1, highestBid); ShowDialogBoxOK($"Player {highestBider + 1} ({PA3BackEnd.src.Monopoly.MonopolyGame.GetUserTokenName(highestBider)}) won the biding with a bid of ${highestBid}!", null); } }