39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using AutoMapper;
|
|
using CommonService;
|
|
using FishRoomService.Hubs;
|
|
using FishRoomService.RoomSend.Response;
|
|
using RedisService.Param;
|
|
|
|
namespace FishRoomService.RoomSend
|
|
{
|
|
public class FishingRoomSendService : IFishingRoomSendService
|
|
{
|
|
|
|
public readonly IHubSend<FishRoomHub> _roomSend;
|
|
public readonly IMapper _mapper;
|
|
|
|
public FishingRoomSendService(IHubSend<FishRoomHub> roomSend, IMapper mapper)
|
|
{
|
|
_roomSend = roomSend;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
public void GetRoomListResult(string cid, List<RedisGameRoom> rooms)
|
|
{
|
|
var list = _mapper.Map<List<GameRoomReponse>>(rooms);
|
|
|
|
if (list != null)
|
|
list = list.OrderBy(c => c.RoomNumber).ToList();
|
|
_roomSend.SendUserCId(cid, "GetRoomListResult", list);
|
|
}
|
|
|
|
public void RoomChange(RedisGameRoom room)
|
|
{
|
|
string partition = $"{(int)room.GameType}{room.RoomLevel}{room.RoomPartition}";
|
|
_roomSend.SendGroup(partition, "RoomChange", room);
|
|
}
|
|
|
|
|
|
}
|
|
}
|