Exemplo n.º 1
0
        /// <summary>
        /// 将牌变为选择的方案牌型
        /// </summary>
        /// <param name="intList"></param>
        void ChoisePlane(List <int> intList)
        {
            //第一次选择的时候不用换牌,直接赋值
            if (_lastList == null || _lastList.Count == 0)
            {
                for (int i = 0; i < intList.Count; i++)
                {
                    PokerCard ca = CardsList[i].GetComponent <PokerCard>();
                    ca.SetCardId(intList[i]);
                    ca.SetCardFront();
                }
                return;
            }

            List <int> tempList = _lastList.GetRange(0, 13);

            if (intList.Count != tempList.Count)
            {
                YxDebug.LogError("码牌数据错误");
                return;
            }

            bool change = false;

            for (int i = 0; i < tempList.Count; i++)
            {
                int index   = i;
                var tempObj = CardsList[i];
                if (intList[i] != tempList[i])
                {
                    index = tempList.IndexOf(intList[i]);

                    CardsList[i]     = CardsList[index];
                    CardsList[index] = tempObj;

                    int tempInt = tempList[i];
                    tempList[i]     = tempList[index];
                    tempList[index] = tempInt;
                    --i;
                    change = true;
                }
                PokerCard card = tempObj.GetComponent <PokerCard>();
                card.MoveTo(CardsList[index].transform.localPosition, RepositionCard(index));
            }
            if (change)
            {
                Facade.Instance <MusicManager>().Play("select");
            }

            _lastList = tempList;
            ResetSelectedCards();
        }
Exemplo n.º 2
0
 public void Reset()
 {
     _dealing = false;
     foreach (GameObject poker in _pokerList)
     {
         poker.SetActive(false);
         PokerCard pokerCard = poker.GetComponent <PokerCard>();
         pokerCard.SetCardId(0);
         pokerCard.SetCardFront();
     }
     _pokerCounter = 0;
     ShootItemList.Clear();
     StopAllCoroutines();
 }
Exemplo n.º 3
0
        /// <summary>
        /// 逐行展示手牌
        /// </summary>
        /// <param name="line">行数</param>
        /// <param name="cardValueList">牌</param>
        /// <param name="type">牌型</param>
        public void ShowHandPoker(int line, List <int> cardValueList, CardType type)
        {
            int beginIndex = 0;
            int count      = 0;

            InitRange(line, ref beginIndex, ref count);

            List <PokerCard> curShowCards = new List <PokerCard>();

            //设置显示手牌
            for (int i = 0; i < UserCardList.Count; i++)
            {
                GameObject obj = UserCardList[i];
                if (i >= beginIndex && i < beginIndex + count)
                {
                    obj.transform.localScale = Vector3.one * (_scale + .1f);
                    PokerCard card = obj.GetComponent <PokerCard>();
                    card.SetCardDepth(100 + i * 2);
                    card.SetCardId(cardValueList[i]);
                    card.SetCardFront();
                    curShowCards.Add(card);
                }
                else
                {
                    obj.transform.localScale = Vector3.one * _scale;
                    obj.GetComponent <PokerCard>().SetCardDepth(i * 2);
                }
            }

            string typeName;

            if (line == 0 && type == CardType.santiao)
            {
                typeName = "chongsan";
            }
            else if (line == 1 && type == CardType.hulu)
            {
                typeName = "zhongdunhulu";
            }
            else
            {
                typeName = type.ToString();
            }

            App.GetGameManager <SssGameManager>().PlayOnesSound(typeName, Info.Seat);
            HandCardsType.ShowType(line, typeName); //显示手牌牌型

            StartCoroutine(HideHandPoker(line, beginIndex, count));
        }