/// <summary> /// 头像点击 /// </summary> public void OnSelfClick() { bool isself = mRoomPlayerInfo.seatId == MJGameModel.Inst.mMySeatId;//MainPlayerModel.GetInstance().mUserInfo.userId;//是否是自己 if (isself) { return; } MJGameUI view = Global.Inst.GetController <MJGameController>().mGameUI; if (view == null) { return; } GameUserInfoWidget infoview = GetWidget <GameUserInfoWidget>("Windows/GameCommonView/GameUserInfoWidget", view.transform); infoview.SetData(true, mRoomPlayerInfo.headUrl, mRoomPlayerInfo.nickName, mRoomPlayerInfo.uId, "", mRoomPlayerInfo.seatId, OnHudongClickCallback); }
private void HandleStartGameData(StartGameRespone data, bool isStart = false) { MJGameModel.Inst.mStartGameData = data; SQDebug.Log("准备房间 玩家数据移植:" + Time.deltaTime); MJGameModel.Inst.ReadyCountDownTime = 0; //准备倒计时 mModel.mPlayCount = data.roomInfo.maxGameCount; //最大局数 mModel.mCurPlayCount = data.roomInfo.currGameCount; //当前局数 MJGameModel.Inst.mRoomId = data.roomInfo.roomId; //房间号 MJGameModel.Inst.mMySeatId = data.roomInfo.mySeatId; //我自己的座位号 MJGameModel.Inst.mZhuangSeatId = data.startInfo.zhuangSeatId; //庄家座位号 MJGameModel.Inst.TurnFixedTime = data.roomInfo.turnFixedTime; //操作固定时间 MJGameModel.Inst.mRoomMgSeatId = 1; //房主座位号 int totalPlayerCount = data.roomInfo.maxPlayer; //房间总共人数 MJGameModel.Inst.totalPlayerCount = totalPlayerCount; totalPlayerCount = totalPlayerCount == 2 ? 4 : totalPlayerCount; MJGameModel.Inst.mnewSeatToIndex = new int[totalPlayerCount + 1]; //玩家座位号 数组 MJGameModel.Inst.mSeatToDirectionIndex = new int[5]; //所有玩家座位号对应桌面东南西北高亮显示的index MJGameModel.Inst.mRoomPlayers = new PlayerInfoStruct[totalPlayerCount + 1]; //玩家 数据缓存数组 foreach (var itemRoomPlayer in data.roomInfo.playerList) //玩家信息数据 { MJGameModel.Inst.mRoomPlayers[itemRoomPlayer.seatId] = itemRoomPlayer; MJGameModel.Inst.mnewSeatToIndex[itemRoomPlayer.seatId] = SeatIdToIndex(MJGameModel.Inst.mMySeatId, itemRoomPlayer.seatId, totalPlayerCount); MJGameModel.Inst.mSeatToDirectionIndex[itemRoomPlayer.seatId] = SeatIdToDirectionIndex(MJGameModel.Inst.mMySeatId, itemRoomPlayer.seatId, data.roomInfo.maxPlayer); } #endregion MJGameModel.Inst.isGetStartGameData = true; MJGameModel.Inst.totalCardNum = data.startInfo.totalCardNum; //总共有多少张牌 MJGameModel.Inst.leaveCardNum = data.startInfo.leaveCardNum; //剩余多少张牌 MJGameModel.Inst.mCurInsSeatId = data.startInfo.currTurnSeatId; //当前指针 指的玩家座位号 MJGameModel.Inst.isMyHit = data.startInfo.currTurnSeatId == MJGameModel.Inst.mMySeatId; //是否轮到我操作 MJGameModel.Inst.allPlayersCardsInfoStruct = new CardsInfoStruct[totalPlayerCount + 1]; //可操作列表 if (data.roomInfo.optList != null) { for (int i = 0; i < data.roomInfo.optList.Count; i++) { if (data.roomInfo.optList[i].ins == eMJInstructionsType.HIT) { GetCanHuList(data.roomInfo.optList[i]); } } } //手牌信息 if (data.startInfo.cardsInfoList != null) { foreach (var item in data.startInfo.cardsInfoList) { MJGameModel.Inst.allPlayersCardsInfoStruct[item.seatId] = item; //找出我定缺的类型 if (item.seatId == MJGameModel.Inst.mMySeatId) //我自己 { if (item.isFixedColor) //已经定缺 { MJGameModel.Inst.SetMyFixedType(item.fixedType); if (item.handList != null)//手牌排序 { item.handList = MJGameModel.Inst.ChangList(item.handList, item.fixedType); } } else { MJGameModel.Inst.SetMyFixedType(0); } } if (item.handList != null) { foreach (var VARIABLE in item.handList) { MJGameModel.Inst.mySelfCards.Add(VARIABLE); } if (item.isHasCurrCard) { MJGameModel.Inst.mySelfCards.Add(item.currCard); } foreach (var oneItem in MJGameModel.Inst.mySelfCards) { if (oneItem < 10) { MJGameModel.Inst.handCardsTiao.Add(oneItem); } else if (oneItem < 20) { MJGameModel.Inst.handCardsTong.Add(oneItem); } else if (oneItem < 30) { MJGameModel.Inst.handCardsWan.Add(oneItem); } } } } } //MJGameModel.Inst.UpdataModelDada(data); if (isStart && !MJGameModel.Inst.IsContainsDingque && !MJGameModel.Inst.IsContainsChange)//如果开始发牌且没有定缺也没有换三张,房间状态改为开始 { MJGameModel.Inst.mState = eMJRoomStatus.STARTE; MJGameModel.Inst.mStartGameData.roomInfo.roomState = eRoomState.START;//改变房间状态 } ; if (mGameUI != null) { List <string> view = new List <string>(); view.Add("GameUI"); BaseView.CloseAllViewBut(view); mGameUI.GetGameStartFormCtr(); } else { SQSceneLoader.It.LoadScene("mahjong_scenes", () => { mGameUI = OpenWindow() as MJGameUI; List <string> view = new List <string>(); view.Add("GameUI"); BaseView.CloseAllViewBut(view); mGameUI.GetGameStartFormCtr(); }); } }