添加游戏模式选择

This commit is contained in:
aozhiwei 2020-12-08 11:30:08 +08:00
parent 0eb19b3a2c
commit e6ba781b30
4 changed files with 16 additions and 4 deletions

View File

@ -13,9 +13,9 @@ public:
void UnInit();
void AttachRoom(Room* room, RoomInitInfo& init_info);
MapInstance* GetMapInstance(int map_id);
private:
MapInstance* GetMapInstance(int map_id);
MapInstance* RandMapInstance(int map_mode);
private:

View File

@ -25,6 +25,8 @@
#include "typeconvert.h"
#include "entityfactory.h"
#include "perfmonitor.h"
#include "mapinstance.h"
#include "mapmgr.h"
#include "framework/cpp/utils.h"
@ -742,7 +744,8 @@ bool Room::CanJoin(const std::string& accountid,
RoomType_e self_room_type,
RoomMode_e self_room_mode,
int self_proto_version,
int self_channel)
int self_channel,
int init_map_id)
{
if (self_room_mode < kChiJiMode) {
self_room_mode = kChiJiMode;
@ -756,6 +759,13 @@ bool Room::CanJoin(const std::string& accountid,
if (gas_data_.gas_mode != GasInactive) {
return false;
}
if (init_map_id != 0) {
MapInstance* map_instance = MapMgr::Instance()->GetMapInstance(init_map_id);
if (map_instance && map_instance->GetMapMeta()->i->map_mode() == room_mode_ &&
map_instance->map_id != map_meta_->i->map_id()) {
return false;
}
}
if (GetPlayerByAccountId(accountid)) {
return false;
}

View File

@ -113,7 +113,8 @@ public:
RoomType_e self_roomm_type,
RoomMode_e self_room_mode,
int self_proto_version,
int self_channel);
int self_channel,
int init_map_id);
void OnPlayerOffline(Player* hum);
Entity* FindFirstCollisonEntity(const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
void FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCollider* aabb_box,

View File

@ -249,7 +249,8 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
self_room_type,
(RoomMode_e)msg.room_mode(),
proto_version,
channel)) {
channel,
msg.mapid())) {
if (!msg.team_uuid().empty() && room->HaveMyTeam(msg.team_uuid())) {
return room;
}