//-------------------------------------------------------------------------------------------------------------- #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); }
/// <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])); } }
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); } } } }
void NotifyCardSelected() => OnCardSelected?.Invoke(SelectedCard);
private void Card_OnWeaponSelected(Weapon weapon) => OnCardSelected?.Invoke(weapon);