/// <summary> /// 直接添加一张手牌 /// </summary> /// <param name="value"></param> /// <param name="show"></param> private void DirectAddOneHandCard(int seatId, int index, string value, bool show = false) { GameObject obj = obj = NGUITools.AddChild(mHandCardGid.gameObject, mHandCardItem); TenHandCard card = obj.GetComponent <TenHandCard>(); obj.gameObject.SetActive(true); if (seatId == TenModel.Inst.mMySeatId) { obj.transform.localScale = new Vector3(2f, 2f, 2f); } if (value != "0" && !string.IsNullOrEmpty(value)) { card.SetCard(value); } if (show) { card.ShowCardNum(value); } else { card.ShowCardBg(); } mHandCard.Add(value); mHandCardGid.Reposition(); }
/// <summary> /// 发牌 /// </summary> /// <param name="seatId"></param> /// <param name="cards"></param> /// <param name="show"></param> /// <param name="type"></param> /// <returns></returns> private IEnumerator IECastCardWithAnim(int seatId, List <string> cards, bool show, eNNCardsType type = eNNCardsType.Nil) { if (cards != null) { for (int i = 0; i < cards.Count; i++) { GameObject obj = NGUITools.AddChild(mHandCardGid.gameObject, mHandCardItem); obj.transform.localScale = Vector3.one; obj.SetActive(true); TenHandCard card = obj.GetComponent <TenHandCard>(); if (show) { card.ShowCardNum(cards[i]); //显示牌正面 card.SetCardDeepsByIndex(GetCardsIndex()); ////设置牌背层级 } else { card.ShowCardBg(); //显示牌背 card.SetCardBgDeepsByIndex(GetCardsIndex()); ////设置牌背层级 } obj.transform.position = mDealCardStartPos.position; Vector3 dpos = new Vector3(mHandCardGid.cellWidth * GetCardsIndex(), 0, 0); bool large = seatId == TenModel.Inst.mMySeatId ? true : false; DealCardMove(card, dpos, 0.2f, large); mHandCard.Add(cards[i]); yield return(new WaitForSeconds(0.1f)); } } }