提交进入地图和创建房间相关逻辑和协议
This commit is contained in:
@@ -15,13 +15,48 @@ public class G2Map_EnterRequestHandler : RouteRPC<Scene, G2Map_EnterRoomRequest,
|
||||
response.ErrorCode = ErrorCode.ErrServer;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var mapUnitManage = entity.GetComponent<MapUnitManageComponent>();
|
||||
if (mapUnitManage == null)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.ErrServer;
|
||||
return;
|
||||
}
|
||||
|
||||
var mapUnit = mapUnitManage.Get(request.AccountId);
|
||||
if (mapUnit == null)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.ErrServer;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
RoomHelper.ParseCode(request.RoomCode, out var serviceId, out var roomId);
|
||||
if (serviceId < 1 || roomId < 1)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.MapRoomIdError;
|
||||
return;
|
||||
}
|
||||
// roomManageComponent.Enter();
|
||||
|
||||
var room = roomManageComponent.Get(roomId);
|
||||
if (room == null)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.MapRoomIdError;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mapUnit.MapId != room.Map)
|
||||
{
|
||||
//切换地图
|
||||
response.ErrorCode = await mapUnit.EnterMap(mapUnit.MapId);
|
||||
if (response.ErrorCode != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
response.ErrorCode = await room.Enter(request.AccountId);
|
||||
response.RoomCode = room.Code;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user