示例#1
0
    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();
    }
示例#2
0
 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;
 }
示例#3
0
 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;
 }
示例#4
0
 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();
 }
示例#5
0
 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();
     }
 }