예제 #1
0
        void onAddCardToHand(object sender, MouseButtonEventArgs e)
        {
            string cardInfos = (((sender as GraphicObject).Parent.Parent.Parent as GraphicObject).
                                FindByName("cardEntries") as CardDataGrid).SelectedItem as string;
            MagicCard mc = null;

            MagicData.TryLoadCard(cardInfos, ref mc);

            CardInstance tmp = Players[0].Deck.AddCard(mc);

            tmp.CreateGLCard();

            tmp.Controler = Players[0];
            tmp.ResetPositionAndRotation();
            tmp.yAngle = MathHelper.Pi;
            tmp.Controler.Hand.AddCard(tmp, true);
        }
예제 #2
0
 public void LoadCards()
 {
     foreach (MainLine l in inputDck.CardEntries)
     {
         MagicCard c = null;
         if (!MagicData.TryLoadCard(l.name, ref c))
         {
             Debug.WriteLine("DCK: {0} => Card not found: {1}", inputDck.Name, l.name);
             continue;
         }
         for (int i = 0; i < l.count; i++)
         {
             AddCard(c, l.code);
         }
         Player.ProgressValue++;
     }
     inputDck = null;
 }
예제 #3
0
        void MainWin_KeyboardKeyDown(object sender, OpenTK.Input.KeyboardKeyEventArgs e)
        {
            switch (e.Key)
            {
            case OpenTK.Input.Key.KeypadEnter:
                engine.ip.PhaseDone = true;
//				if (engine.pp == engine.ip && engine.cp != engine.pp)
//					engine.GivePriorityToNextPlayer ();
                break;

            case OpenTK.Input.Key.Escape:
                closeCurrentGame();
                break;

                        #if DEBUG
            case OpenTK.Input.Key.F1:
                if (CardInstance.selectedCard == null)
                {
                    break;
                }
                loadWindow("#MagicCrow.ui.cardInstanceView.iml");
                NotifyValueChanged("SelectedCardInstance", null);
                NotifyValueChanged("SelectedCardInstance", SelectedCardInstance);
                break;

            case OpenTK.Input.Key.F2:
                if (CardInstance.selectedCard == null)
                {
                    break;
                }
                loadWindow("#MagicCrow.ui.cardView.iml");
                NotifyValueChanged("SelectedCardModel", SelectedCardModel);
                break;

            case OpenTK.Input.Key.F3:
                loadWindow("#MagicCrow.ui.MagicStackView.iml");
                break;

            case OpenTK.Input.Key.F4:
                loadWindow("#MagicCrow.ui.decks.iml");
                break;

            case OpenTK.Input.Key.F6:
                loadWindow("#MagicCrow.ui.MemberView.crow");
                break;

            case OpenTK.Input.Key.F7:
                loadWindow("#MagicCrow.ui.cardList.iml");
                break;

            case OpenTK.Input.Key.Space:
                Players [0].DrawOneCard();
                break;

            case OpenTK.Input.Key.H:
                if (e.Control)
                {
                }
                else
                {
                    CardInstance.selectedCard?.ChangeZone(CardGroupEnum.Hand);
                }
                break;

            case OpenTK.Input.Key.E:
                if (e.Control)
                {
                    foreach (CardInstance ci in Players[0].Deck.Cards.Where
                                 (c => c.CurrentGroup.GroupName == CardGroupEnum.Library && c.Effects?.Count > 0))
                    {
                        ci.ChangeZone(CardGroupEnum.Hand);
                    }
                }
                break;

            case OpenTK.Input.Key.D:
                if (e.Control)
                {
                    foreach (CardInstance ci in Players[0].Deck.Cards.Where(c => c.CurrentGroup.GroupName == CardGroupEnum.Hand))
                    {
                        ci.ChangeZone(CardGroupEnum.Library);
                    }
                }
                break;

            case OpenTK.Input.Key.L:
                if (e.Control)
                {
                    foreach (CardInstance ci in Players[0].Deck.Cards.Where(c => c.HasType(CardTypes.Land) && c.CurrentGroup.GroupName != CardGroupEnum.InPlay).Take(5))
                    {
                        ci.ChangeZone(CardGroupEnum.InPlay);
                    }
                }
                else
                {
                    Players [0].Library.RevealToUIPlayer();
                }
                break;

            case OpenTK.Input.Key.O:
                engine.ip.Opponent.Hand.RevealToUIPlayer();
                break;

            case OpenTK.Input.Key.U:
                if (e.Control)
                {
                    foreach (CardInstance ci in Players[0].Deck.Cards.Where(c => c.HasType(CardTypes.Land) && c.CurrentGroup.GroupName == CardGroupEnum.InPlay))
                    {
                        ci.tappedWithoutEvent = false;
                    }
                }
                if (CardInstance.selectedCard == null)
                {
                    return;
                }
                CardInstance.selectedCard.tappedWithoutEvent = false;
                break;

            case OpenTK.Input.Key.Delete:
                if (CardInstance.selectedCard == null)
                {
                    return;
                }
                CardInstance.selectedCard.Reset();
                CardInstance.selectedCard.ChangeZone(CardGroupEnum.Hand);
                break;

            case OpenTK.Input.Key.KeypadPlus:
                engine.ip.AllowedLandsToBePlayed++;
                break;

            case OpenTK.Input.Key.N:
                CardInstance nextInvalid = Players [0].Library.Cards.Where(c => !c.Model.IsOk).FirstOrDefault();
                Players [0].Library.RemoveCard(nextInvalid);
                Players [0].Hand.AddCard(nextInvalid);
                break;

            case OpenTK.Input.Key.T:
                foreach (CardInstance ci in Players[0].Library.Cards.Where(c => c.HasEffect(EffectType.Token)))
                {
                    ci.ChangeZone(CardGroupEnum.Hand);
                }
                break;

            case OpenTK.Input.Key.C:
                foreach (CardInstance ci in Players[0].Library.Cards.Where(c => c.HasType(CardTypes.Creature)))
                {
                    ci.ChangeZone(CardGroupEnum.InPlay);
                }
                break;

            case OpenTK.Input.Key.R:
                MagicCard mc = null;
                MagicData.TryLoadCard(Crow.Configuration.Get <String> ("LastPointedCardForDebug"), ref mc);
                mc.AddCardToHand();
                break;

            case OpenTK.Input.Key.M:
                Players[0].ManaPool += new Mana(10, ManaTypes.White);
                Players[0].ManaPool += new Mana(10, ManaTypes.Blue);
                Players[0].ManaPool += new Mana(10, ManaTypes.Red);
                Players[0].ManaPool += new Mana(10, ManaTypes.Black);
                Players[0].ManaPool += new Mana(10, ManaTypes.Green);

                break;
                        #endif
            }
        }