public void ExchangeCards() { int temp = NumberOfChanges; for (int i = 0; i < CurrentDeck.Count; i++) { if (SelectedCards.Contains(CurrentDeck[i])) { GameObject card = CurrentDeck[i].gameObject; dealer.ExchangeCards[0].transform.position = card.transform.position; Destroy(card); CurrentDeck[i] = dealer.ExchangeCards[0]; dealer.ExchangeCards.RemoveAt(0); } } if (temp > 0) { if (temp - SelectedCards.Count <= 0) { noMoreChanges.Raise(); } } NumberOfChanges -= SelectedCards.Count; SelectedCards.Clear(); }
internal void ResetSelection() { DetachAll(); foreach (var c in SelectableCards) { c.Selectable = false; c.Selected = false; c.SelectionParam = 0; } SelectableCards.Clear(); SelectedCards.ForEach((c) => c.Selected = false); SelectedCards.Clear(); Finishable = false; Cancelabel = false; }
public void Init() { Players.Clear(); SelectedCards.Clear(); HandCards.Clear(); CurrentDiscards.Clear(); BaseCards.Clear(); CurrentStatus = GameStatus.CallLandlord; ClaimCount = 4; CurrentTurn = 0; RestCardNum = 17; Mutiple = 1; CurrentMode = GameMode.MutiPlayer; LastPlayer = ""; Landlord = ""; BaseScore = 1000; }
public void Reward(int winner) { // for (int i = 0; i < Players.Length; i++) // { // if (Players[i].Active) // { // Players[winner].Deck.Add(Players[i].Deck[CallCards[i]]); // Players[i].Deck.RemoveAt(CallCards[i]); // } // } for (int i = 0; i < SelectedCards.Count; i++) { SelectedCards[i].PreviousOwnerID = SelectedCards[i].CurrentOwnerID; SelectedCards[i].CurrentOwnerID = winner; } Table.Clear(); Table.AddRange(SelectedCards); Players[winner].Deck.AddRange(SelectedCards); SelectedCards.Clear(); }
protected override void card_Click(object sender, EventArgs e) { if (CanSelectCards) { var card = (Card)sender; if (SelectedCards.Count != 0) { SelectedCards.Clear(); } int index = Cards.IndexOf(card); // Integer division will return the index of the first location divided by GroupNumber. // Then we multiply by GroupNumber to get the index of the first location. int start = (index / GroupNumber) * GroupNumber; // After this, we can simply select the card for every next index. for (int i = start; i < start + GroupNumber; i++) { SelectedCards.Add(Cards[i]); } RecalculateSelectionIndices(); } }