/// <summary> /// 设置一张牌,包括大小,显示层级等信息 /// </summary> /// <param name="card"></param> public void SetOneCard(PokerCard card) { card.name = "line"; card.transform.parent = PokerParent.transform; card.transform.localScale = Vector3.one * 0.6f; card.SetCardDepth(BaseDepth + CardList.Count * 4); CardList.Add(card); //不可点击 card.gameObject.SetActive(false); }
/// <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)); }
IEnumerator HideHandPoker(int line, int beginIndex, int count) { yield return(new WaitForSeconds(1.5f)); 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 * _scale; poker.SetCardDepth((beginIndex + i) * 2); } StopAllCoroutines(); }