/// <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); } } }
/// <summary> /// 设置一张牌,包括大小,显示层级等信息 /// </summary> /// <param name="card"></param> public void SetOneCard(PokerCard card) { card.name = "line"; card.transform.parent = PokerParent.transform; card.transform.localScale = Vector3.one * BaseScale; card.SetCardDepth(BaseDepth * (LineIndex + 1) + CardList.Count * 4); CardList.Add(card); //不可点击 card.gameObject.SetActive(false); }
IEnumerator HideHandPoker(int line, int beginIndex, int count) { yield return(new WaitForSeconds(1f)); HandCardsType.HideType(line); for (int i = 0; i < count; i++) { int index = beginIndex + i; if (index >= UserCardList.Count || UserCardList[index] == null) { break; } GameObject obj = UserCardList[index]; PokerCard poker = obj.GetComponent <PokerCard>(); poker.transform.localScale = Vector3.one * HandCardsTargetPosPar.Scale; poker.SetCardDepth((beginIndex + i) * 2); } }