Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------------------

        #region Operations

        /// <summary>
        ///     Select the card in the parameter.
        /// </summary>
        /// <param name="card"></param>
        public void SelectCard(IUiCard card)
        {
            SelectedCard = card ?? throw new ArgumentNullException("Null is not a valid argument.");

            //disable all cards
            DisableCards();
            OnCardSelected?.Invoke(SelectedCard);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Overrides the mouse clicked event, this is where cards get actually played
        /// </summary>
        /// <param name="e">The mouse event arguments, with the mouse's information</param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            base.OnMouseClick(e);

            if (myCards != null && myHoverIndex > -1 && myHoverIndex < myCards.Count)
            {
                OnCardSelected?.Invoke(this, new CardEventArgs(myCards[myHoverIndex]));
            }
        }
Exemplo n.º 3
0
        private void CardCtrl_Click(object sender, EventArgs e)
        {
            CardCtrl prevOwner = cardClickOwner;

            ignoreDragOnContextClose = false;

            cardClickOwner = (CardCtrl)sender;
            if (cardClickOwner != null)
            {
                if (clickAction == EDeckCtrlAction.Pick)
                {
                    toolStripMenuLockOptimization.Checked = lockFlags[(int)cardClickOwner.Tag];
                    contextMenuStripPickCard.Show(cardClickOwner, new Point(0, 0), ToolStripDropDownDirection.AboveRight);
                }
                else if (clickAction == EDeckCtrlAction.Highlight)
                {
                    if (prevOwner != null)
                    {
                        prevOwner.SetHighlighted(false);
                    }

                    if (OnCardSelected != null)
                    {
                        OnCardSelected.Invoke(cardClickOwner.GetCardInst(), (int)cardClickOwner.Tag);
                    }

                    if (prevOwner == cardClickOwner)
                    {
                        cardClickOwner = null;
                    }
                    else
                    {
                        cardClickOwner.SetHighlighted(true);
                    }
                }
            }
        }
Exemplo n.º 4
0
 void NotifyCardSelected() => OnCardSelected?.Invoke(SelectedCard);
Exemplo n.º 5
0
 private void Card_OnWeaponSelected(Weapon weapon) => OnCardSelected?.Invoke(weapon);