//****************** Helper Methods *********************// public void ResetSelectedCard() { if (selectedCard != null) { selectedCard.OnSelected(false); selectedCard = null; selectedRank = 0; } }
//****************** User Interaction *********************// public void OnCardSelected(Card card) { if (gameState == GameState.TurnSelectingDroppingCard && currentTurnPlayer == localPlayer) { if (card.OwnerId == currentTurnPlayer.PlayerId) { if (ConditionsForCardSelection(card)) { selectedCard = card; card.OnSelected(true); selectedCards.Add(card); selectedRank = selectedCard.Rank; } SetMessage($"{currentTurnPlayer.PlayerName} ,do you want to drop {selectedCard.Rank} ?"); } } }
//****************** User Interaction *********************// public void OnCardSelected(Card card) { if (gameState == GameState.TurnSelectingNumber) { if (card.OwnerId == currentTurnPlayer.PlayerId) { if (selectedCard != null) { selectedCard.OnSelected(false); selectedRank = 0; } selectedCard = card; selectedRank = selectedCard.Rank; selectedCard.OnSelected(true); SetMessage($"Ask {currentTurnTargetPlayer.PlayerName} for {selectedCard.Rank}s ?"); } } }
//****************** User Interaction *********************// public void OnCardSelected(Card card) { if (gameState == GameState.TurnSelectingNumber) { if (card.isInStack) { takeButton.gameObject.active = !takeButton.gameObject.active; cardAnimator.openLast3CardsFromStack(takeButton.gameObject.active); //OnTakeStackCards(); } else if (card.isTouchable) { if (card.OwnerId == currentTurnPlayer.PlayerId) { List <Card> newSelectedCards = new List <Card>(); if (selectedCards.Count > 0) { newSelectedCards.AddRange(selectedCards); if (card.Rank == selectedRank && !newSelectedCards.Contains(card)) //newSelectedCards[0].Rank { newSelectedCards.Add(card); } else { newSelectedCards.Clear(); //foreach (Card c in selectedCards) //{ // c.OnSelected(false); //} //selectedRank = 0; //selectedCardValue = Card.NO_VALUE; //selectedCardValues.Clear(); if (selectedCards.Count > 0) { foreach (Card c in selectedCards) { c.OnSelected(false); } selectedRank = 0; //TODO REMOvE? selectedCards.Clear(); selectedCardValues.Clear(); } } } else { newSelectedCards.Add(card); } selectedCards = newSelectedCards; selectedCardValues = GetSelectedCardValues(); selectedRank = card.Rank; //selectedCardValue = card.GetCardValue(); if (selectedCards.Count > 0) { foreach (Card c in selectedCards) { c.OnSelected(true); } } else { card.OnSelected(true); } SetMessage($"Throw {card.Rank} for {currentTurnTargetPlayer.PlayerName}?"); } } } }