コード例 #1
0
        private void contextMenuStripPickCard_Opened(object sender, EventArgs e)
        {
            toolStripComboBoxPick.BeginUpdate();

            PlayerSettingsDB playerDB = PlayerSettingsDB.Get();
            TriadCardDB      cardsDB  = TriadCardDB.Get();
            int numExpected           = toolStripMenuOnlyOwned.Checked ? playerDB.ownedCards.Count : cardsDB.cards.Count;

            if (numExpected != toolStripComboBoxPick.Items.Count)
            {
                toolStripComboBoxPick.Items.Clear();
                foreach (TriadCard card in cardsDB.cards)
                {
                    if (card != null && (!toolStripMenuOnlyOwned.Checked || playerDB.ownedCards.Contains(card)))
                    {
                        toolStripComboBoxPick.Items.Add(new DeckCardPicker(card));
                    }
                }
            }

            for (int Idx = 0; Idx < toolStripComboBoxPick.Items.Count; Idx++)
            {
                DeckCardPicker cardOb = (DeckCardPicker)toolStripComboBoxPick.Items[Idx];
                if (cardOb.Card == cardClickOwner.GetCard())
                {
                    toolStripComboBoxPick.SelectedIndex = Idx;
                    break;
                }
            }

            toolStripComboBoxPick.EndUpdate();
            toolStripComboBoxPick.Focus();
        }
コード例 #2
0
        private void CardGridCtrl_Click(object sender, EventArgs e)
        {
            CardCtrl       cardControl = sender as CardCtrl;
            MouseEventArgs mouseArgs   = e as MouseEventArgs;

            if (cardControl != null && cardControl.GetCard() != null &&
                (mouseArgs == null || mouseArgs.Button == MouseButtons.Left))
            {
                OnCardClicked(cardControl.GetCard());
            }
        }
コード例 #3
0
        private void setDeckCard(int Idx, TriadCard card, bool previewOnly)
        {
            if (deck != null)
            {
                deck.SetCard(Idx, card);
            }

            CardCtrl updatedCtrl = cardCtrls[Idx];

            if (updatedCtrl.GetCard() != card)
            {
                updatedCtrl.SetCard(new TriadCardInstance(card, deckOwner));
            }

            if (OnCardChanged != null)
            {
                OnCardChanged.Invoke(cardCtrls[Idx].GetCardInst(), Idx, previewOnly);
            }

            updatedCtrl.UpdateBackColor();
            updatedCtrl.Invalidate();
        }