Example #1
0
        /// <summary>
        /// 逐行展示手牌
        /// </summary>
        /// <param name="line">行数</param>
        /// <param name="matchInfo"></param>
        public void ShowHandPoker(int line, UserMatchInfo matchInfo)
        {
            int beginIndex = 0;
            int count      = 0;

            InitRange(line, ref beginIndex, ref count);

            List <int> cardValueList = matchInfo.Cards.GetRange(beginIndex, count);

            cardValueList = HelpLz.SortLineList(cardValueList, (CardType)matchInfo.DunTypeList[line]);

            //设置显示手牌
            for (int i = 0; i < UserCardList.Count; i++)
            {
                GameObject obj = UserCardList[i];
                if (i >= beginIndex && i < beginIndex + count)
                {
                    obj.transform.localScale = Vector3.one * (HandCardsTargetPosPar.Scale + .1f);
                    PokerCard card = obj.GetComponent <PokerCard>();
                    card.SetCardDepth(100 + i * 2);
                    card.SetCardId(cardValueList[i - beginIndex]);
                    card.SetCardFront();
                }
                else
                {
                    obj.transform.localScale = Vector3.one * HandCardsTargetPosPar.Scale;
                    obj.GetComponent <PokerCard>().SetCardDepth(i * 2);
                }
            }
        }
Example #2
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();
        }
Example #3
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();
 }