public void SendRoomListToUser(UserToken token) { if (roomInfoList.Count == 0) { RoomListDTO listDto = new RoomListDTO(); listDto.roomCount = 0; write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ENTERGAMEHALL_CREQ, listDto); } else { RoomInfoDTO[] array = new RoomInfoDTO[roomInfoList.Count]; array = roomInfoList.ToArray(); RoomListDTO listDto = new RoomListDTO(); listDto.roomCount = array.Length; listDto.roomList = array; write(token, TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ENTERGAMEHALL_CREQ, listDto); } }
public void MessageReceive(SocketModel model) { Debug.Log("收到房间列表消息"); RoomListDTO dto = model.GetMessage <RoomListDTO>(); if (dto.roomCount == 0) { Debug.Log("隐藏房间"); HideAllRoom(); return; } List <RoomInfoDTO> list = new List <RoomInfoDTO>(); foreach (var item in dto.roomList) { list.Add(item); } ShowSearchRoom(list); }
/// <summary> /// 更新房间列表消息到用户大厅的用户 /// </summary> void UpdateRoomListToAll() { Debug.LogTest("更新房间信息"); if (roomInfoList.Count == 0) { RoomListDTO listDto = new RoomListDTO(); listDto.roomCount = 0; list = cache.getGameHallTokenList(); brocast(TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ROOMLIST_CREQ, listDto); } else { RoomInfoDTO[] array = roomInfoList.ToArray(); RoomListDTO listDto = new RoomListDTO(); listDto.roomList = array; listDto.roomCount = array.Length; list = cache.getGameHallTokenList(); brocast(TypeProtocol.TYPE_GAMEHALL_CREQ, 0, GameHallProtocol.GAMEHALL_ROOMLIST_CREQ, listDto); } }