/// <summary> /// 调用播放牌型音乐的方法 /// </summary> /// <param name="data"></param> private void PlayMusic(TransferData data) { RoomEntity room = data.GetValue <RoomEntity>("Room"); SeatEntity currentSeat = data.GetValue <SeatEntity>("PlayerSeat"); StartCoroutine(PlayMusicTor(room, currentSeat)); }
IEnumerator PlayMusicTor(RoomEntity room, SeatEntity currentSeat) { List <string> MusiList = new List <string>(); int currentPos = currentSeat.Pos; for (int j = 0; j < room.seatList.Count; ++j) { if (MusiList.Count != 0) { MusiList.Clear(); } int seatIndex = (currentPos + j - 1) % room.seatList.Count; SeatEntity seat = room.seatList[seatIndex]; if (seat.PlayerId == 0) { continue; } GuPaiJiuSeatCtrl currSeatCrtl = GetSeatCtrlBySeatPos(seat.Index); MusiList = currSeatCrtl.PlayMusic(seat); for (int i = 0; i < MusiList.Count; i++) { string MusicName = string.Format("gp_{0}_{1}", MusiList[i], seat.Gender); AudioEffectManager.Instance.Play(MusicName, Vector3.zero); yield return(new WaitForSeconds(0.5f)); } yield return(new WaitForSeconds(0.3f)); } }
/// <summary> /// 结算的时候加载别人的牌 /// </summary> /// <param name="data"></param> private void GroupEndJieSuan(TransferData data) { List <SeatEntity> seatList = data.GetValue <List <SeatEntity> >("SeatList"); SeatEntity currentSeat = data.GetValue <SeatEntity>("PlayerSeat"); RoomEntity room = data.GetValue <RoomEntity>("Room"); int currentPos = currentSeat.Pos == 4 ? 1 : currentSeat.Pos + 1; StartCoroutine(GroupEndJieSuanPoker(currentPos, room, seatList)); StartCoroutine(LoadSmallResult(seatList)); }
/// <summary> /// 发牌动画 /// </summary> private void BigDealAni(TransferData data) { RoomEntity room = data.GetValue <RoomEntity>("Room"); for (int i = 0; i < room.seatList.Count; i++) { if (room.seatList[i].IsBanker) { GuPaiJiuSeatCtrl seatCtrl = GetSeatCtrlBySeatPos(room.seatList[i].Index); StartCoroutine(DealAniTor(seatCtrl, room)); } } }
IEnumerator GroupEndJieSuanPoker(int currentPos, RoomEntity room, List <SeatEntity> seatList) { for (int j = 0; j < 4; ++j) { int seatIndex = (currentPos + j - 1) % room.seatList.Count; SeatEntity seat = room.seatList[seatIndex]; GuPaiJiuSeatCtrl currSeatCrtl = GetSeatCtrlBySeatPos(seat.Index); currSeatCrtl.SetCtrlJieSuanPoker(seat, room.roomStatus); yield return(new WaitForSeconds(2f)); } yield return(new WaitForSeconds(0.5f)); RoomGuPaiJiuProxy.Instance.SetBetUI(seatList); }
/// <summary> /// 洗牌动画 /// </summary> private void ShuffleAnimation(TransferData data) { Debug.Log("······················开始洗牌啦························"); RoomEntity room = data.GetValue <RoomEntity>("Room"); for (int i = 0; i < room.seatList.Count; i++) { if (room.seatList[i].IsBanker) { GuPaiJiuSeatCtrl seatCtrl = GetSeatCtrlBySeatPos(room.seatList[i].Index); Debug.Log(seatCtrl.SeatIndex + " 洗牌Index"); //BankerSeat = room.seatList[i]; //if (wallList.Count != 0) wallList.Clear(); seatCtrl.ShuffleAnimation(room, (List <GameObject> listObj) => { //this.wallList = listObj; }); AudioEffectManager.Instance.Play("gp_xipai", Vector3.zero); } } }
IEnumerator DealAniTor(GuPaiJiuSeatCtrl seatCtrl, RoomEntity room) { Debug.Log("```````````````````````````````````````开始发牌``````````````````````````````````````````````````````" + room.FirstGivePos); int loopCount = room.roomPlay == EnumPlay.BigPaiJiu ? 4 : 2; //int loopCount = 31; int firstGivePos = room.FirstGivePos; //按顺序发牌 for (int j = 0; j < room.seatList.Count; ++j) { int seatIndex = (firstGivePos + j - 1) % room.seatList.Count; SeatEntity seat = room.seatList[seatIndex]; GuPaiJiuSeatCtrl currSeatCrtl = GetSeatCtrlBySeatPos(seat.Index); for (int i = 0; i < loopCount; i++) { if (i < 2) { seatCtrl.DealTran.transform.GetChild(seatCtrl.DealTran.transform.childCount - i - 1).DOMove(currSeatCrtl.HandContainer[2].position, 0.5f); } else { seatCtrl.DealTran.transform.GetChild(seatCtrl.DealTran.transform.childCount - i - 1).DOMove(currSeatCrtl.HandContainer[2].position + new Vector3(39, 0, 0), 0.5f); } } yield return(new WaitForSeconds(0.2f)); for (int k = 0; k < loopCount; k++) { Destroy(seatCtrl.DealTran.transform.GetChild(seatCtrl.DealTran.transform.childCount - k - 1).gameObject); LoadPoker(seat, currSeatCrtl.HandContainer[k], k); } AudioEffectManager.Instance.Play("gp_fapai", Vector3.zero); yield return(new WaitForSeconds(0.2f)); } yield return(new WaitForSeconds(0.1f)); SendNotification(ConstantGuPaiJiu.GuPaiJiuClientEmptyReceive); }