/// <summary> /// 创建房间 /// </summary> /// <param name="obj"></param> private void OnServerBroadcastCreateRoom(byte[] obj) { SSS_CREATE_ROOM proto = SSS_CREATE_ROOM.decode(obj); CommandQueue.Clear(); UIViewManager.Instance.CloseWait(); RoomShiSanZhangProxy.Instance.InitRoom(proto); //IGameCommand command = new CreateRoomCommand(room); //CommandQueue.Enqueue(command); SceneMgr.Instance.LoadScene(SceneType.ShiSanZhang); }
public const int ROOM_SEAT_COUNT = 4; //房间座位数量 public void InitRoom(SSS_CREATE_ROOM proto) { //CurrentRoom = room; //CalculateSeatIndexOne(); //普通场计算座位 Index //SendRoomInfoChangeNotify(); CurrentRoom = new RoomEntity() { roomId = proto.roomInfo.roomId, currentLoop = proto.roomInfo.loop, maxLoop = proto.roomInfo.maxLoop, SszRoomStatus = proto.roomInfo.roomStatus, BaseScore = proto.roomInfo.baseScore,//底分 SeatCount = proto.roomInfo.seatInfoCount(), gameId = GameCtrl.Instance.CurrentGameId, groupId = 0, matchId = 0, SeatList = new List <SeatEntity>(), }; Debug.Log(proto.roomInfo.seatInfoCount() + " 座位长度"); for (int i = 0; i < proto.roomInfo.seatInfoCount(); ++i) { SEAT_INFO ssz_seat = proto.roomInfo.getSeatInfo(i); SeatEntity seat = new SeatEntity(); seat.PlayerId = ssz_seat.playerId;//玩家ID if (seat.PlayerId == AccountProxy.Instance.CurrentAccountEntity.passportId) { seat.IsPlayer = true; } Debug.Log(ssz_seat.nickname + " 玩家名字"); seat.Nickname = ssz_seat.nickname; //玩家名字 seat.Avatar = ssz_seat.avatar; //玩家头像 seat.Gender = ssz_seat.gender; //玩家性别 seat.Gold = ssz_seat.gold; //底分 seat.Pos = ssz_seat.pos; //座位位置 seat.seatStatus = ssz_seat.seatStatus; //座位状态 seat.handPokerList = new List <Poker>(); seat.firstPokerList = new List <Poker>(); seat.middlePokerList = new List <Poker>(); seat.endPokerList = new List <Poker>(); for (int j = 0; j < ssz_seat.firstPokerInfoCount(); ++j) { FIRST_POKER_INFO firstPoker = ssz_seat.getFirstPokerInfo(j); seat.firstPokerList.Add(new Poker(firstPoker.index, firstPoker.color, firstPoker.size)); } for (int j = 0; j < ssz_seat.secondPokerInfoCount(); ++j) { SECOND_POKER_INFO middlePoker = ssz_seat.getSecondPokerInfo(j); seat.middlePokerList.Add(new Poker(middlePoker.index, middlePoker.color, middlePoker.size)); } for (int j = 0; j < ssz_seat.thirdPokerInfoCount(); ++j) { THIRD_POKER_INFO endPoker = ssz_seat.getThirdPokerInfo(j); seat.endPokerList.Add(new Poker(endPoker.index, endPoker.color, endPoker.size)); } CurrentRoom.SeatList.Add(seat); } if (proto.roomInfo.seatInfoCount() == 3) { CurrentRoom.SeatList.Add(new SeatEntity()); } CalculateSeatIndexOne(); }