예제 #1
0
 private void OnCardSelected(Card card)
 {
     if (_isMovingCards != true)
     {
         CardSelected?.Invoke(card);
     }
 }
예제 #2
0
        public override void Click(MouseButtonEventArgs e)
        {
            //Find the card (if any) that the player has clicked
            Card card = null;

            for (int i = 0; i < Children.Count; i++)
            {
                if (Children[i].Hovered && Children[i] is Single)
                {
                    card = ((Single)Children[i]).Card;
                    break;
                }
            }

            //Trigger events based on the mouse button
            if (card != null)
            {
                if (e.Button == MouseButton.Left)
                {
                    CardSelected?.Invoke(new CardSelectionArgs(card, new Vector2(e.X, e.Y), e.Button));
                }
                else if (e.Button == MouseButton.Right)
                {
                    CardContextSelected?.Invoke(new CardSelectionArgs(card, new Vector2(e.X, e.Y), e.Button));
                }
            }

            base.Click(e);
        }
예제 #3
0
        public override void OnCardSelected(BoardUnit unit)
        {
            if (unit.CurrentHp <= 0)
            {
                return;
            }

            if (PossibleTargets.Contains(Enumerators.AbilityTargetType.PLAYER_CARD) &&
                unit.GameObject.CompareTag(SRTags.PlayerOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.OPPONENT_CARD) &&
                unit.GameObject.CompareTag(SRTags.OpponentOwned) ||
                PossibleTargets.Contains(Enumerators.AbilityTargetType.ALL))
            {
                if (TargetUnitType == Enumerators.CardType.NONE || unit.InitialUnitType == TargetUnitType)
                {
                    if (TargetUnitStatusType == Enumerators.UnitStatusType.NONE ||
                        unit.UnitStatus == TargetUnitStatusType)
                    {
                        if (SelfBoardCreature != unit)
                        {
                            SelectedCard?.SetSelectedUnit(false);

                            SelectedCard = unit;
                            SelectedPlayer?.SetGlowStatus(false);

                            SelectedPlayer = null;
                            SelectedCard.SetSelectedUnit(true);

                            CardSelected?.Invoke(unit);
                        }
                    }
                }
            }
        }
예제 #4
0
        protected override void OnClick(EventArgs e)
        {
            var coords = PointToClient(Control.MousePosition);

            var switchLocation = GetLocationButton(coords);

            if (switchLocation != default)
            {
                CurrentLocation = switchLocation;
                Invalidate();
                return;
            }

            if (options.Length == 0)
            {
                return;
            }

            var card = GetCardAt(coords);

            if (card != null)
            {
                CardSelected?.Invoke(card);
            }
        }
예제 #5
0
 protected virtual void OnCardClicked(int cardPosition)
 {
     CardSelected?.Invoke(cardPosition);
 }
예제 #6
0
 private void handleCardSelect(Card card)
 {
     cardSelected.Invoke(card);
 }
예제 #7
0
 private void OnCardSelected(CardSelectedEventArgs args)
 {
     CardSelected?.Invoke(this, args);
 }