Esempio n. 1
0
        /// <summary>
        /// 检测扑克个数
        /// </summary>
        protected override void InitPokerList()
        {
            if (CardsList.Count == CardCount)
            {
                return;
            }

            if (CardsList.Count > CardCount)
            {
                //删除多余的牌
                int count = CardsList.Count - CardCount;
                for (int i = 0; i < count; i++)
                {
                    var temp = CardsList[i];
                    CardsList.Remove(temp);
                    Destroy(temp);
                }
            }
            else
            {
                int count = CardCount - CardsList.Count;
                for (int i = 0; i < count; i++)
                {
                    PokerCard clone = Instantiate(CardPrefab);
                    clone.transform.parent     = PokerParent;
                    clone.name                 = "poker " + i;
                    clone.transform.localScale = Vector3.one * .6f;
                    clone.GetComponent <PokerCard>().SetCardDepth(130 + i * 3);

                    CardsList.Add(clone);
                    AddPokerEvent(clone);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 从已经生成的一幅牌里删除牌
 /// </summary>
 /// <param name="color_"></param>
 /// <param name="name_"></param>
 /// <param name="count_"></param>
 protected void DeleteCards(string color_, string name_, int count_ = 1)
 {
     for (int i = 0; i < CardsList.Count && count_ > 0; i++)
     {
         if (CardsList[i].CardColor == color_ && CardsList[i].Name == name_)
         {
             CardsList.Remove(CardsList[i]);
             count_--;
         }
     }
 }
Esempio n. 3
0
 private void LastProccess()
 {
     try
     {
         int limitDie = 1;
         int num      = 0;
         while (num < CardsList.Count())
         {
             List <string> list = CardsList[num].Split('|').ToList();
             if (CardsList.Count() > 1)
             {
                 CardsList[num] = CardsList[num].Replace("\r", "");
             }
             string text  = CardsList[num];
             string cards = CardsList[num].ToString();
             if (CardsList.Count() > 1)
             {
                 string text3 = CardsList[num] = (CardsList[num] += "\r");
                 cards = string.Join("", CardsList.ToArray());
                 text += "\r";
             }
             CheckoutPayment(list[0], list[1], list[2], list[3]);
             if (Confirmation())
             {
                 ExecuteReduceCardsThread(cards);
                 ExecuteLiveCardThread(text);
                 CardsList.Remove(CardsList[num]);
                 if (CardsList.Count() > 0)
                 {
                     Restart();
                 }
             }
             else
             {
                 ExecuteReduceCardsThread(cards);
                 ExecuteDieCardThread(text);
                 CardsList.Remove(CardsList[num]);
                 if (limitDie < 5)
                 {
                     limitDie++;
                 }
                 else
                 {
                     Restart();
                 }
             }
         }
     }
     catch (ArgumentOutOfRangeException)
     {
     }
 }