Beispiel #1
0
 private void on_DeckDealerOkay_clicked(System.Object obj, EventArgs e)
 {
     if (cardsFlipped > 0) {
     Orig_ChargeMoney cmd = new Orig_ChargeMoney(cardsFlipped*costPerCard, Game.GetInstance().State.CurrentPlayer);
     Game.GetInstance().State.Execute(cmd);
     }
     DeckDealerWindow.Hide();
 }
Beispiel #2
0
 private void on_DeckDealer_delete_event(System.Object obj, DeleteEventArgs e)
 {
     e.RetVal = true; // True == do not allow delete
     if (cardsFlipped > 0) {
     Orig_ChargeMoney cmd = new Orig_ChargeMoney(cardsFlipped*costPerCard, Game.GetInstance().State.CurrentPlayer);
     Game.GetInstance().State.Execute(cmd);
     }
     DeckDealerWindow.Hide();
 }
Beispiel #3
0
        private void on_DeckDealerFlip_clicked(System.Object obj, EventArgs e)
        {
            cardsFlipped++;

            if (Game.GetInstance().JustShuffledResourceCards)
            Game.GetInstance().JustShuffledResourceCards = false;
            else
            Game.GetInstance().NextResourceCard();

            ResourceCard card = Game.GetInstance().CurrentResourceCard;
            if (card.isResource() && targetIsResource())
            {
            Console.WriteLine("Both Are Resources: " + card.Good.Name + " and " + targetResource.Name);
            if (card.Good.Name == targetResource.Name)
            {
                Console.WriteLine("Found Target Resource");
                finished = true;
                DeckDealerFlip.Sensitive = false;
                DeckDealerStatus.Text = "Charging " + cardsFlipped*costPerCard;

                /* Purchase this card */
                Orig_ChargeMoney cmd3 = new Orig_ChargeMoney(cardsFlipped*costPerCard, Game.GetInstance().State.CurrentPlayer);
                Game.GetInstance().State.Execute(cmd3);
                cardsFlipped = 0; // don't make them double-pay

                DeckDealerFlip.Sensitive = false; // stop their clicking manias

                /* Add this card to the player's hand, marked unopened */
                card.Active = false;
                Orig_AddResourceCard cmd4 = new Orig_AddResourceCard(card, Game.GetInstance().State.CurrentPlayer);
                Game.GetInstance().State.Execute(cmd4);
            }
            } else if (!card.isResource() && !targetIsResource()) {
            Console.WriteLine("Both Are Units");
            if (card.Knowledge.Name == targetUnit.Name)
            {
                Unit nu = targetUnit.Clone(Game.GetInstance().State.CurrentPlayer); // copy that, rogue two.

                finished = true;
                Console.WriteLine("Found Target Unit");
                DeckDealerStatus.Text = "Charging " + cardsFlipped*costPerCard;
                /* Set available */
                Game.GetInstance().State.CurrentPlayer.makeUnitAvailable(nu);

                /* Make an immediate purchase */
                Orig_PurchaseUnit cmd = new Orig_PurchaseUnit(nu, Game.GetInstance().State.CurrentPlayer);
                Game.GetInstance().State.Execute(cmd);
                Orig_BuildUnit cmd2 = new Orig_BuildUnit(nu, null, Game.GetInstance().State.CurrentPlayer);
                Game.GetInstance().State.Execute(cmd2);

                /* Pay for flipped cards */
                Orig_ChargeMoney cmd3 = new Orig_ChargeMoney(cardsFlipped*costPerCard, Game.GetInstance().State.CurrentPlayer);
                Game.GetInstance().State.Execute(cmd3);
                cardsFlipped = 0; // don't make them double-pay

                DeckDealerFlip.Sensitive = false; // stop their clicking manias
            }
            }

            on_DeckDealer_exposed(null,null); // evil! Update screen
            updateStatusBoxes();
            //DeckDealer.SendExpose(null); // less evil, but crashes
        }