/// <summary> /// 根据信息打开这个Item 完整信息 /// </summary> /// <param name="seat"></param> public void ShowWholeItem(NiuNiu.Seat seat, NN_ENUM_ROOM_STATUS roomStatus) { //头像 SetAvatarUI(seat.Avatar); //昵称 SetNicknameUI(seat.Nickname); //玩家是否准备 SetIsReadyToUI(seat.IsReady); //是否是庄 SetBankerUI(seat.IsBanker); //当前分数 SetGold(seat.Gold); //下注显示 SetBaseScoreUI(seat.Pour); //_banker.gameObject.SetActive(false); //牌型 SetPockeTypeUI(seat.PockeType, roomStatus); //牌 SetAllPokerUI(seat.PokerList); //PokerPos if (roomStatus == NN_ENUM_ROOM_STATUS.RSETTLE) { if (seat.PokerList[0].index > 0) { SetPokerPos(seat.PokerList); } } Debug.Log("位置" + seat.Pos + "的玩家是否胜利" + seat.Winner); }
/// <summary> /// 准备 /// </summary> /// <param name="pbSeat"></param> public void Ready(NN_SEAT_READY proto) { NiuNiu.Seat seat = GetSeatBySeatPos(proto.nn_seat.pos); if (seat == null) { return; } seat.IsReady = true; //--------------设置开始按钮遮罩--------------- bool isEnable = false; for (int i = 0; i < CurrentRoom.SeatList.Count; i++) { NiuNiu.Seat readySeat = GetSeatBySeatIndex(i); if (readySeat != null && readySeat.PlayerId > 0) { Debug.Log(string.Format("座位{0} 玩家是否准备{1}", readySeat.Pos, readySeat.IsReady)); if (readySeat.IsReady == false) { isEnable = true; break; } } } Debug.Log("bool isEnable:" + isEnable); Debug.Log("bool isEnable设置开始按钮遮罩"); TransferData dataMask = new TransferData(); dataMask.SetValue <bool>("OnOff", isEnable); ModelDispatcher.Instance.Dispatch(ConstDefine_NiuNiu.ObKey_EnableAllowStartBtn, dataMask);//设置开始游戏按钮遮罩 //刷新座位UI SendRoomInfoChangeNotify(); }
//显示Poker 牌 private void DealShowPoker(NiuNiu.Seat seat) { SetAllPokerUI(seat.PokerList); SetPokerPos(seat.PokerList); }
public void PlayeDealAni(NiuNiu.Seat seat, System.Action onComplete = null) { isPlayDrawPokerAni = true; StartCoroutine(DealAni(seat, onComplete)); //StartCoroutine("DealShowPoker", seat); }
/// <summary> /// 处理开关 换庄系列(换庄 抢庄等) /// </summary> /// <param name="seat"></param> /// <param name="room"></param> public void SwitchDecisionBnaker(NiuNiu.Seat seat, NiuNiu.Room room, int playerNumber) { NN_ENUM_ROOM_STATUS roomStatus = room.roomStatus; bool currActiveSelfBankerBtn = _BankerBtnParent.gameObject.activeSelf; bool currActiveSelfNoBankerBtn = _NoBankerBtnParent.gameObject.activeSelf; Debug.Log(string.Format("处理开关换庄按钮 房间状态:{0},自己ID:{1},庄:{2}", roomStatus.ToString(), seat.PlayerId, seat.IsBanker)); if (roomStatus == NN_ENUM_ROOM_STATUS.IDLE || roomStatus == NN_ENUM_ROOM_STATUS.DISSOLVE) { //庄 if (seat.IsBanker && playerNumber >= 2) { if (currActiveSelfBankerBtn == false) { _BankerBtnParent.gameObject.SetActive(true); NiuNiuWindWordAni.PopUp(_BankerBtnParent); } } else { _BankerBtnParent.gameObject.SetActive(false); } //非庄 //if (!seat.IsBanker && currActiveSelfBankerBtn == true) //{ _NoBankerBtnParent.gameObject.SetActive(false); //} } else if (roomStatus == NN_ENUM_ROOM_STATUS.HOG) { _BankerBtnParent.gameObject.SetActive(false); if (room.roomModel == Room.RoomModel.robBanker) { _NoBankerBtnParent.gameObject.SetActive(seat.isAlreadyHOG == 0 && seat.PokerList[0].index > 0); if (seat.isAlreadyHOG == 0 && seat.PokerList[0].index > 0 && currActiveSelfNoBankerBtn == false) { NiuNiuWindWordAni.PopUp(_NoBankerBtnParent); } } else if (room.roomModel == Room.RoomModel.AbdicateBanker) { _NoBankerBtnParent.gameObject.SetActive(!seat.IsBanker && seat.isAlreadyHOG == 0); if (!seat.IsBanker && seat.isAlreadyHOG == 0 && currActiveSelfNoBankerBtn == false) { NiuNiuWindWordAni.PopUp(_NoBankerBtnParent); } } } else { if (currActiveSelfBankerBtn) { _BankerBtnParent.gameObject.SetActive(false); } if (currActiveSelfNoBankerBtn) { _NoBankerBtnParent.gameObject.SetActive(false); } return; } }
/// <summary> /// 初始化房间信息 构建房间 /// </summary> /// <param name="proto"></param> public void InitCurrentRoom(NN_ROOM_CREATE proto) { BankerSeat = null; CurrentRoom = new NiuNiu.Room(); //收到数据存到模型基类 <------------------------------<保存配置>---------------------------------------- CurrentRoom.Config.Clear(); for (int i = 0; i < proto.nn_room.settingIdCount(); ++i) { cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(proto.nn_room.getSettingId(i)); if (settingEntity != null) { CurrentRoom.Config.Add(settingEntity); } } //获得当前游戏模式 for (int i = 0; i < CurrentRoom.Config.Count; i++) { if (CurrentRoom.Config[i].tags.Equals("mode")) { CurrentRoom.roomModel = (Room.RoomModel)CurrentRoom.Config[i].value; Debug.Log("服务器发送的房间 庄模式为为:" + CurrentRoom.Config[i].value); //#if IS_GUGENG // if (CurrentRoom.roomModel == Room.RoomModel.EveryTime || CurrentRoom.roomModel == Room.RoomModel.WinnerByBanker) // CurrentRoom.roomModel = Room.RoomModel.AutoBanker; //#endif } } for (int i = 0; i < CurrentRoom.Config.Count; i++) { if (CurrentRoom.Config[i].tags.Equals("roomMode")) { CurrentRoom.superModel = (Room.SuperModel)CurrentRoom.Config[i].value; Debug.Log("服务器发送的房间 普通高级场模式为为:" + CurrentRoom.Config[i].value); } } Debug.Log("房间ID为:" + proto.nn_room.roomId); Debug.Log("服务器发送的房间座位长度为:" + proto.nn_room.getNnSeatList().Count); CurrentRoom.roomId = proto.nn_room.roomId; CurrentRoom.roomStatus = proto.nn_room.nn_room_status; CurrentRoom.currentLoop = proto.nn_room.loop; CurrentRoom.maxLoop = proto.nn_room.maxLoop; CurrentRoom.SeatCount = proto.nn_room.getNnSeatList().Count; //CurrentRoom.SeatCount = proto.nn_room.nnSeatCount;//----------------------------------《座位长度《----------------------------------------- CurrentRoom.SeatList = new List <NiuNiu.Seat>(); for (int i = 0; i < CurrentRoom.SeatCount /*proto.nn_room.getNnSeatList().Count*/; ++i) { NN_SEAT nn_seat = proto.nn_room.getNnSeat(i); NiuNiu.Seat seat = new NiuNiu.Seat(); //NiuNiu.Seat seat = new NiuNiu.Seat(proto.nn_room.seatList[i]); //房主 seat.IsHomeowners = nn_seat.IsHomeowners;//----------------------------------《房主《----------------------------------------- //是否同意解散 if (nn_seat.hasDissolve()) { seat.Dissolve = nn_seat.dissolve; } //庄 seat.IsBanker = nn_seat.isBanker; //玩家ID seat.PlayerId = nn_seat.playerId; //pos seat.Pos = nn_seat.pos; //昵称 seat.Nickname = nn_seat.nickname; //头像 seat.Avatar = nn_seat.avatar; //性别 seat.Gender = nn_seat.gender; //是否准备 seat.IsReady = nn_seat.ready; //已有金币 seat.Gold = nn_seat.gold; //本局收益 seat.Earnings = nn_seat.nn_earnings; //是否是胜利者 seat.Winner = nn_seat.isWiner; //下注 seat.Pour = nn_seat.pour; //纬度 if (nn_seat.hasLatitude()) { seat.Latitude = nn_seat.latitude; } //经度 if (nn_seat.hasLongitude()) { seat.Longitude = nn_seat.longitude; } //手牌类型 if (nn_seat.hasNnPokerType()) { if (nn_seat.nn_pokerType != 0) { seat.PockeType = (int)nn_seat.nn_pokerType; } } seat.PokerList = new List <Poker>(); //具体手牌 //if (nn_seat.getNnPokerList() != null && nn_seat.getNnPokerList().Count > 0) //{ for (int j = 0; j < 5; j++)//nn_seat.nnPokerCount() { NN_POKER protoPoker = null; if (nn_seat.nnPokerCount() > j) { protoPoker = nn_seat.getNnPoker(j); } NiuNiu.Poker poker = new NiuNiu.Poker(); if (protoPoker != null && protoPoker.hasIndex() && protoPoker.index != 0) { //seat.PokerList[j].SetPoker(nn_seat.PokerList[j]); poker.color = protoPoker.color; poker.index = protoPoker.index; poker.size = protoPoker.size; poker.status = protoPoker.pokerStatus; } seat.PokerList.Add(poker); } //} if (seat.IsBanker) { BankerSeat = seat; //庄座位 } if (proto.nn_room.pos == seat.Pos) { CurrentRoom.RobBankerSeat = seat; //获得当前抢庄座位 } CurrentRoom.SeatList.Add(seat); } if (proto.nn_room.hasUnixtime()) { CurrentRoom.serverTime = proto.nn_room.unixtime;//(时间戳) } CalculateSeatIndex(CurrentRoom); playerSeatIndex = PlayerSeat.Pos; PeopleCounting(); if (CurrentRoom.roomModel == Room.RoomModel.robBanker && BankerSeat != null) { PlayerSeat.isAlreadyHOG = -1; } if (CurrentRoom.roomStatus == NN_ENUM_ROOM_STATUS.DISSOLVE) { //计算当前同意解散人数 ADHEnterRoom(proto.nn_room.getNnSeatList()); } }
private int scoreSort(NiuNiu.Seat info1, NiuNiu.Seat info2) { return(info1.Gold <= info2.Gold ? 1 : -1); }
//-----自定义排序规则--------------------------------------- private int nameSort(NiuNiu.Seat info1, NiuNiu.Seat info2) { return(string.Compare(info1.Nickname, info2.Nickname)); }