public static DeckBuilderCard CreateCard( DeckBuilderCardSlot hiddenCards, AvailableCards availableCards, SelectedCards selectedCards, Toggle doubleClickToggle, String id, IList <CombatType> combatTypes, IList <CardAttribute> attributes, int?basePower, String faction) { GameObject cardObject = Instantiate((GameObject)Resources.Load("DeckBuilderCard"), hiddenCards.transform); DeckBuilderCard card = cardObject.GetComponent <DeckBuilderCard>(); card.cardObject = cardObject; card.id = id; card.combatTypes = new List <CombatType>(combatTypes); card.attributes = new List <CardAttribute>(attributes); card.basePower = basePower; card.faction = faction; card.hiddenCards = hiddenCards; card.availableCards = availableCards; card.selectedCards = selectedCards; card.cardSlot = hiddenCards; card.doubleClickToggle = doubleClickToggle; card.image = Resources.Load <Sprite>("CardImages/" + id); return(card); }
public void UpdateAvailableCards(bool i_IsAMatch, params Cell[] i_PairOfCards) { // in case there's a match- we'll erase the matching pair from the storage if (i_IsAMatch == true) { AvailableCards.Remove(i_PairOfCards[0]); AvailableCards.Remove(i_PairOfCards[1]); } }
protected override void OnDisconnect(ISubscription source, Exception error) { this.BeginInvoke(() => { AvailableCards.Clear(); Players.Clear(); }); base.OnDisconnect(source, error); }
/// <summary> /// Deals a Card by returning it and removing it from the available Cards in the Deck. /// </summary> /// <returns>A Card from the beginning of the AvailableCards List.</returns> public Card DealCard() { // Deal a card from the top of the deck. Card c = AvailableCards[0]; AvailableCards.RemoveAt(0); return(c); }
public void ClearSelectedCards(List <CardPlay> cards) { if (!cards.Any()) { return; } lock (_lockAvailableCards) { AvailableCards.AddRange(cards); } cards.Clear(); }
public Card DealCard() { Card dealtCard = null; if (AvailableCards.Count > 0) { int topIndex = AvailableCards.Count - 1; dealtCard = AvailableCards[topIndex]; AvailableCards.RemoveAt(topIndex); } return(dealtCard); }
public override bool ViewFilter(Room room, List <WrappedCard> selected, WrappedCard to_select, Player player) { if (selected.Count + Reserved.Count >= Num || !AvailableCards.Contains(to_select.Id)) { return(false); } if (RoomLogic.IsCardLimited(room, player, to_select, HandlingMethod.MethodDiscard) || Reserved.Contains(to_select.Id)) { return(false); } return(true); }
public CardPlay GetCardPlay(string cardGameString) { var cardPlay = new CardPlay(); cardPlay.SetSuitAndValue(cardGameString); lock (_lockAvailableCards) { cardPlay = AvailableCards.FirstOrDefault(c => c.Suit == cardPlay.Suit && c.Value == cardPlay.Value); if (cardPlay != null) { AvailableCards.Remove(cardPlay); } } return(cardPlay); }
private void OnSelected() { ChosenCards.Add(SelectedAvailableCard); AvailableCards.Remove(SelectedAvailableCard); SelectedCard = null; if (AvailableCards.Count() == 0) { _eventAggregator.GetEvent <PlayerDoneEvent>().Publish(new PlayerDoneEventArgs { ResultDeck = ChosenCards }); } else { _eventAggregator.GetEvent <PlayerDoneEvent>().Publish(null); } }
public IList <DeckBuilderCard> ToDeckBuilderCards( HiddenCards hiddenCards, AvailableCards availableCards, SelectedCards selectedCards, Toggle doubleClickToggle ) { return(this.cards.Select(dCard => dCard.ToDeckBuilderCard( hiddenCards, availableCards, selectedCards, doubleClickToggle ) ).ToList()); }
public DeckBuilderCard ToDeckBuilderCard( HiddenCards hiddenCards, AvailableCards availableCards, SelectedCards selectedCards, Toggle doubleClickToggle) { return(DeckBuilderCard.CreateCard( hiddenCards, availableCards, selectedCards, doubleClickToggle, id, ParseCombatTypes(this.combatTypes), ParseCardAttributes(this.attributes), basePower, faction)); }
private static GameObject InstansiateCard(GameObject cardPrefab) { var card = UnityEngine.Object.Instantiate(cardPrefab); var cardInstance = card.GetComponent <CardInstance>(); var cardIndex = UnityEngine.Random.Range(0, AvailableCards.Count); cardInstance.Card = AvailableCards[cardIndex]; AvailableCards.RemoveAt(cardIndex); cardInstance.GetComponent <Image>().sprite = Resources.Load <Sprite>(Path.Combine(Constants.CardSprites, cardInstance.Card.SpriteName)); card.transform.SetParent(GameController.Instance.Hand.transform); card.transform.localScale = cardPrefab.transform.localScale; return(card); }
public void Shuffle(bool returnDealtCards = false) { if (returnDealtCards) { AvailableCards.AddRange(DealtCards); } int numCardsLeft = AvailableCards.Count; int maxCardIndex = numCardsLeft - 1; for (int i = 0; i < numCardsLeft; ++i) { Card thisCard = AvailableCards[i]; int randomCardIndex = Random.Range(0, maxCardIndex); AvailableCards[i] = AvailableCards[randomCardIndex]; AvailableCards[randomCardIndex] = thisCard; } }
private void DealCards() { CurrentCards.Clear(); int numberOfCards = Random.Range(1, 4); for (int x = 0; x < numberOfCards; x++) { for (int y = 0; y < 7; y++) // It will try to add a unique keyed card 7 times, until it fails. { var nextCard = AvailableCards.RandomElement(); if (!ContainsKey(nextCard.Key)) { CurrentCards.Add(nextCard); break; } } } }
protected override void OnConnect(ISubscription source) { base.OnConnect(source); Channel.UpdatePlayer(Me.ModifiedObject); foreach (ScrumPokerCard card in Channel.GetAvailableCards()) { BeginInvoke(() => AvailableCards.Add(card)); } ScrumPokerStory story = Channel.GetStoryInfo(); BeginInvoke(() => Story.UpdateFrom(story)); foreach (ScrumPokerPlayer player in Channel.GetPlayers()) { BeginInvoke(() => PlayerUpdated(player)); } }
void Awake() { AC = this; availableCards = allCards; }