/// <summary> /// 加入游戏 /// </summary> /// <param name="data"></param> public void ServerCreateJoinRoom(NNCreateJoinRoomData data) { CleanAllDesk(); UpdateBaseScore(NiuniuModel.Inst.mRoomRules.baseScore); if (data.roomInfo.pt) { mRoomId.text = "模式:自由场"; mSelfPlayer.SetChangDeskBtnState(true); mSelfPlayer.SetInvateBtnState(false); } else { mRoomId.text = "房间号:" + data.roomInfo.roomId; mSelfPlayer.SetChangDeskBtnState(false); mSelfPlayer.SetInvateBtnState(true); } if (data.roomInfo.playerList != null) {//玩家坐下 for (int i = 0; i < data.roomInfo.playerList.Count; i++) { PlayerSeatDown(data.roomInfo.playerList[i]); } } ChangZhuang(data.roomInfo.zhuangSeatId); if (data.roomInfo.roomState == 0 || (eNNGameState)data.roomInfo.gameState == eNNGameState.Ready) { if (NiuniuModel.Inst.mPlayerInfoDic[data.roomInfo.mySeatId].isReady) { mSelfPlayer.SetReadybtnState(false); } else { mSelfPlayer.SetReadybtnState(true); } } else { NiuniuPlayerUI player = null; mSelfPlayer.SetReadybtnState(false); mSelfPlayer.SetInvateBtnState(false); mSelfPlayer.SetChangDeskBtnState(false); if (data.roomInfo.handCardsList != null && data.roomInfo.handCardsList.myCardsInfo != null) { if (TryGetPlayer(data.roomInfo.mySeatId, out player)) { if (data.roomInfo.handCardsList.myCardsInfo.cards != null) { player.InstantiateCards(data.roomInfo.mySeatId, data.roomInfo.handCardsList.myCardsInfo.cards.cards, false, data.roomInfo.handCardsList.myCardsInfo.cards.mp); } player.UpdateCathecticCoin(data.roomInfo.handCardsList.myCardsInfo.xz + ""); if (data.roomInfo.handCardsList.myCardsInfo.isQz) { player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.myCardsInfo.qzbs); } if (data.roomInfo.handCardsList.myCardsInfo.cardsType != null) { player.SetCardsType(data.roomInfo.handCardsList.myCardsInfo.cardsType); } switch ((eNNGameState)data.roomInfo.gameState) { case eNNGameState.XiaZhu: if (data.roomInfo.handCardsList.myCardsInfo.isXz) { player.UpdateCathecticCoin(data.roomInfo.handCardsList.myCardsInfo.xz + ""); } else { if (data.roomInfo.zhuangSeatId != data.roomInfo.mySeatId) { mSelfPlayer.SetBetBtnItemState(true); mSelfPlayer.InitOptItemList <float>(data.roomInfo.handCardsList.myCardsInfo.xzListValue); mSelfPlayer.ShowBetBtnList(data.roomInfo.handCardsList.myCardsInfo.canXzList); } } break; case eNNGameState.QiangZhuang: if (data.roomInfo.handCardsList.myCardsInfo.isQz) { player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.myCardsInfo.qzbs); } else { mSelfPlayer.SetBetBtnItemState(true); mSelfPlayer.InitOptItemList <int>(data.roomInfo.handCardsList.myCardsInfo.qzListValue); mSelfPlayer.ShowBetBtnList(data.roomInfo.handCardsList.myCardsInfo.canQzList); } break; case eNNGameState.LookCard: if (data.roomInfo.handCardsList.myCardsInfo.isLp && data.roomInfo.handCardsList.myCardsInfo.cardsType != null) { player.SeparateCards(data.roomInfo.handCardsList.myCardsInfo.cardsType.order); player.SetCardType(true, data.roomInfo.handCardsList.myCardsInfo.cardsType.point, data.roomInfo.handCardsList.myCardsInfo.cardsType.ratio); } else { NiuniuModel.Inst.mLookCard = true; mSelfPlayer.SetLiangCardBtnState(true); mSelfPlayer.SetCuoBtnState(false); } break; } } } if (data.roomInfo.handCardsList != null && data.roomInfo.handCardsList.otherCardsInfo != null) { for (int i = 0; i < data.roomInfo.handCardsList.otherCardsInfo.Count; i++) { if (TryGetPlayer(data.roomInfo.handCardsList.otherCardsInfo[i].seatId, out player)) { if (data.roomInfo.handCardsList.otherCardsInfo[i].cards != null) { player.InstantiateCards(data.roomInfo.handCardsList.otherCardsInfo[i].seatId, data.roomInfo.handCardsList.otherCardsInfo[i].cards.cards, false, data.roomInfo.handCardsList.otherCardsInfo[i].cards.mp); } player.UpdateCathecticCoin(data.roomInfo.handCardsList.otherCardsInfo[i].xz + ""); if (data.roomInfo.handCardsList.otherCardsInfo[i].isQz) { player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.otherCardsInfo[i].qzbs); } switch ((eNNGameState)data.roomInfo.gameState) { case eNNGameState.XiaZhu: if (data.roomInfo.handCardsList.otherCardsInfo[i].isXz) { player.UpdateCathecticCoin(data.roomInfo.handCardsList.otherCardsInfo[i].xz + ""); } break; case eNNGameState.QiangZhuang: if (data.roomInfo.handCardsList.otherCardsInfo[i].isQz) { player.SetQiangZhuangResult(true, data.roomInfo.handCardsList.otherCardsInfo[i].qzbs); } break; case eNNGameState.LookCard: if (data.roomInfo.handCardsList.otherCardsInfo[i].isLp && data.roomInfo.handCardsList.otherCardsInfo[i].cardsType != null) { List <string> cards = new List <string>(); cards.AddRange(data.roomInfo.handCardsList.otherCardsInfo[i].cards.mp); cards.AddRange(data.roomInfo.handCardsList.otherCardsInfo[i].cards.cards); player.TurnCards(cards); player.SeparateCards(data.roomInfo.handCardsList.otherCardsInfo[i].cardsType.order); player.SetCardType(true, data.roomInfo.handCardsList.myCardsInfo.cardsType.point, data.roomInfo.handCardsList.myCardsInfo.cardsType.ratio); } break; } } } } } if (data.roomInfo.zhuangSeatId > 0) { CleanQzStateBut(data.roomInfo.zhuangSeatId); } switch ((eNNGameState)data.roomInfo.gameState) { case eNNGameState.LookCard: ShowLastTime("看牌倒计时", data.roomInfo.timeDown); break; case eNNGameState.QiangZhuang: ShowLastTime("抢庄倒计时", data.roomInfo.timeDown); break; case eNNGameState.XiaZhu: ShowLastTime("下注倒计时", data.roomInfo.timeDown); break; } }
/// <summary> /// 进入游戏 /// </summary> /// <param name="data"></param> private void ServerCreateJoinRoom(NNCreateJoinRoomData data) { #if YYVOICE //登陆呀呀语音(step=2) YYsdkManager.instance.LoginVoiceServer(PlayerModel.Inst.UserInfo.userId); #endif if (PlayerModel.Inst.address != null) { NetProcess.SendRequest <SendAddrReq>(PlayerModel.Inst.address, NNProtoIdMap.CMD_SendAddress, (msgData) => { SQDebug.Log("gps 返回"); }, false); } NiuniuModel.Inst.mGameId = (eGameType)data.roomInfo.gameId; NiuniuModel.Inst.mSubGameId = data.roomInfo.subGameId; NiuniuModel.Inst.mRoomRules = data.roomInfo.rule; NiuniuModel.Inst.mZhuangSeatId = data.roomInfo.zhuangSeatId; NiuniuModel.Inst.mMySeatId = data.roomInfo.mySeatId; NiuniuModel.Inst.mGoldPattern = data.roomInfo.pt; NiuniuModel.Inst.mGameState = (eNNGameState)data.roomInfo.gameState; NiuniuModel.Inst.mRoomId = data.roomInfo.roomId; NiuniuModel.Inst.mRoomState = data.roomInfo.roomState; if (data.roomInfo.playerList != null) { for (int i = 0; i < data.roomInfo.playerList.Count; i++) { PlayerSeatDown(data.roomInfo.playerList[i]); } } if (data.roomInfo.handCardsList != null) { if (data.roomInfo.handCardsList.myCardsInfo != null) { NiuniuModel.Inst.mQzListValue = data.roomInfo.handCardsList.myCardsInfo.qzListValue; NiuniuModel.Inst.mXzListValue = data.roomInfo.handCardsList.myCardsInfo.xzListValue; if (data.roomInfo.handCardsList.myCardsInfo.qzListValue != null || data.roomInfo.handCardsList.myCardsInfo.xzListValue != null) { NiuniuModel.Inst.mGameed = true; NiuniuModel.Inst.mGameedSeatIdList.Add(data.roomInfo.mySeatId); } } if (data.roomInfo.handCardsList.otherCardsInfo != null) { for (int i = 0; i < data.roomInfo.handCardsList.otherCardsInfo.Count; i++) { if (data.roomInfo.handCardsList.otherCardsInfo[i].qzListValue != null || data.roomInfo.handCardsList.otherCardsInfo[i].xzListValue != null) { NiuniuModel.Inst.mGameedSeatIdList.Add(data.roomInfo.handCardsList.otherCardsInfo[i].seatId); } } } } OpenWindow(); mView.ServerCreateJoinRoom(data); if (mView != null) { mView.mSelfPlayer.SetChanagDeskBtnState(true); mView.mSelfPlayer.SetReadyBtnState(true); } List <string> names = new List <string>(); names.Add(typeof(NiuniuGameView).Name); BaseView.CloseAllViewBut(names); }