Example #1
0
 private void button3_Click(object sender, EventArgs e)
 {
     MonopolyDealServiceReference.Card        card           = (MonopolyDealServiceReference.Card)listBox1.SelectedValue;
     MonopolyDealServiceReference.ActionCard  actionCard     = card as MonopolyDealServiceReference.ActionCard;
     MonopolyDealServiceReference.PlayerModel playerTargeted = (MonopolyDealServiceReference.PlayerModel)listBoxPlayers.SelectedItem;
     if (actionCard != null)
     {
         if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.PassGo) == 0)
         {
             //card is a pass go card
             MessageBox.Show("Playing A Pass Go Action Card");
             bool result = requestHandler.passGo(card.cardID);
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.DebtCollector) == 0)
         {
             MessageBox.Show("Playing a Debt Collector Card");
             //card is a Debt Collector card
             if (playerTargeted.guid.CompareTo(requestHandlerMD.thisClientGuid) == 0)
             {
                 MessageBox.Show("You can not play a Debt Collector card against yourself. Action canceled");
             }
             else
             {
                 MessageBox.Show("Playing A Debt Collector Action Card against " + playerTargeted.name);
                 bool result = requestHandler.debtCollector(card.cardID, playerTargeted.guid);
                 if (result)
                 {
                     MessageBox.Show("Action Performed");
                 }
                 else
                 {
                     MessageBox.Show("Action not performed");
                 }
             }
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.ItsMyBirthday) == 0)
         {
             MessageBox.Show("Playing a It's My Birthday Card");
             bool result = requestHandler.itsMyBirthday(card.cardID);
             if (result)
             {
                 MessageBox.Show("Action Performed");
             }
             else
             {
                 MessageBox.Show("Action not performed");
             }
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.RentMultiColor) == 0)
         {
             MessageBox.Show("Playing a wild rent card");
             if (playerTargeted.guid.CompareTo(requestHandlerMD.thisClientGuid) == 0)
             {
                 MessageBox.Show("Can not rent yourself");
             }
             else
             {
                 PickSetToRentOn rent = new PickSetToRentOn(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, card, playerTargeted.guid);
                 rent.ShowDialog();
             }
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.RentStandard) == 0)
         {
             MessageBox.Show("Playing a standard rent card");
             PickSetToRentOn rent = new PickSetToRentOn(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, card, new Guid());
             rent.ShowDialog();
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.DealBreaker) == 0)
         {
             MessageBox.Show("Playing a DealBreaker card");
             UseActionCardForm dealBreak = new UseActionCardForm(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, (MonopolyDealServiceReference.ActionCard)card);
             dealBreak.ShowDialog();
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.ForcedDeal) == 0)
         {
             MessageBox.Show("Playing a Forced Deal card");
             UseActionCardForm forcedDeal = new UseActionCardForm(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, (MonopolyDealServiceReference.ActionCard)card);
             forcedDeal.ShowDialog();
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.SlyDeal) == 0)
         {
             MessageBox.Show("Playing a Sly Deal card");
             UseActionCardForm slyDeal = new UseActionCardForm(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, (MonopolyDealServiceReference.ActionCard)card);
             slyDeal.ShowDialog();
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.House) == 0)
         {
             MessageBox.Show("Playing a House card");
             UseActionCardForm house = new UseActionCardForm(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, (MonopolyDealServiceReference.ActionCard)card);
             house.ShowDialog();
         }
         else if (actionCard.actionType.CompareTo(MonopolyDealServiceReference.ActionCardAction.Hotel) == 0)
         {
             MessageBox.Show("Playing a Hotel card");
             UseActionCardForm hotel = new UseActionCardForm(requestHandlerMD.CurrentPlayFieldModel, requestHandlerMD.thisClientGuid, requestHandlerMD, (MonopolyDealServiceReference.ActionCard)card);
             hotel.ShowDialog();
         }
     }
     //Update State
     buttonPollMD_Click(null, null);
     timerForPollingState.Start();
 }