/// <summary> /// 同步玩家发牌 /// </summary> /// <param name="msg"></param> private void NetOnCastCard(MessageData msg) { TenonCastCard ack = msg.Read <TenonCastCard>(); if (ack.gamedSeatIdList != null) { TenModel.Inst.mGameedSeatIdList = ack.gamedSeatIdList; if (ack.gamedSeatIdList.Contains(TenModel.Inst.mMySeatId)) { TenModel.Inst.mGameed = true; } } mView.NetOnCastCard(ack); }
/// <summary> /// 协程延迟发牌 /// </summary> private IEnumerator IEOnCastCard(TenonCastCard data) { mCastDown = false; int cardNum = 0; yield return(new WaitUntil(() => { return mRandomZhuangDown == true; })); if (data.selfCards != null && TenModel.Inst.mGameedSeatIdList != null) { List <string> Othercards = new List <string>(); for (int i = 0; i < data.selfCards.Count; i++) { Othercards.Add("0"); } for (int i = 0; i < TenModel.Inst.mGameedSeatIdList.Count; i++) { TenPlayerUI player = null; if (TryGetPlayer(TenModel.Inst.mGameedSeatIdList[i], out player)) { if (TenModel.Inst.mGameedSeatIdList[i] == TenModel.Inst.mMySeatId) { if (data.cardsType != null) { player.SetCardsType(data.cardsType); } /*if (data.selfCards.Count == 4) * { * player.CastCardWithAnim(TenModel.Inst.mGameedSeatIdList[i], data.selfCards, true); * } * else*/ { player.CastCardWithAnim(TenModel.Inst.mGameedSeatIdList[i], data.selfCards, true); } cardNum = player.GetHandCardsNum(); } else { player.CastCardWithAnim(TenModel.Inst.mGameedSeatIdList[i], Othercards, false); } } } } yield return(new WaitForSeconds(0.2f * data.selfCards.Count)); mCastDown = true; if (data.canShowCard) { if (TenModel.Inst.mGameed) { mSelfPlayer.SetLiangCardBtnState(true); mSelfPlayer.SetCuoBtnState(true); } ShowLastTime("要牌倒计时", data.lastTime - 2); } //显示点数 mSelfPlayer.ShowPlayerPoint(data.cardsType.point, cardNum); }
/// <summary> /// 同步玩家发牌 /// </summary> /// <param name="data"></param> public void NetOnCastCard(TenonCastCard data) { StartCoroutine(IEOnCastCard(data)); }