添加房间模式判断
This commit is contained in:
parent
db9a820e6b
commit
dd18e41cb6
@ -281,7 +281,8 @@ enum ObjectSyncFlags_e
|
|||||||
enum RoomMode_e
|
enum RoomMode_e
|
||||||
{
|
{
|
||||||
kChiJiMode = 0,
|
kChiJiMode = 0,
|
||||||
kZombieMode = 1
|
kZombieMode = 1,
|
||||||
|
kRoomModeEnd
|
||||||
};
|
};
|
||||||
|
|
||||||
enum RaceType_e
|
enum RaceType_e
|
||||||
|
@ -25,6 +25,7 @@ void GameLog::GameStart(Player* hum)
|
|||||||
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
prop->SetVal("game_uniid", a8::XValue(hum->room->GetRoomUuid()).GetString());
|
prop->SetVal("game_uniid", a8::XValue(hum->room->GetRoomUuid()).GetString());
|
||||||
prop->SetVal("room_type", a8::XValue(hum->room->GetRoomType()).GetString());
|
prop->SetVal("room_type", a8::XValue(hum->room->GetRoomType()).GetString());
|
||||||
|
prop->SetVal("room_mode", a8::XValue((int)hum->room->GetRoomMode()));
|
||||||
//prop->SetVal("game_param", "");
|
//prop->SetVal("game_param", "");
|
||||||
prop->SetVal("nickname", hum->name);
|
prop->SetVal("nickname", hum->name);
|
||||||
//prop->SetVal("localuuid", "");
|
//prop->SetVal("localuuid", "");
|
||||||
@ -60,6 +61,7 @@ void GameLog::GameEnd(Player* hum)
|
|||||||
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
prop->SetVal("account_register_date", a8::TimestampToDateTime(hum->account_registertime));
|
||||||
prop->SetVal("game_uniid", a8::XValue(hum->room->GetRoomUuid()).GetString());
|
prop->SetVal("game_uniid", a8::XValue(hum->room->GetRoomUuid()).GetString());
|
||||||
prop->SetVal("room_type", a8::XValue(hum->room->GetRoomType()).GetString());
|
prop->SetVal("room_type", a8::XValue(hum->room->GetRoomType()).GetString());
|
||||||
|
prop->SetVal("room_mode", a8::XValue((int)hum->room->GetRoomMode()));
|
||||||
//prop->SetVal("game_param", "");
|
//prop->SetVal("game_param", "");
|
||||||
prop->SetVal("game_gold", hum->stats.gold);
|
prop->SetVal("game_gold", hum->stats.gold);
|
||||||
prop->SetVal("game_score", hum->stats.score);
|
prop->SetVal("game_score", hum->stats.score);
|
||||||
|
@ -665,8 +665,19 @@ int Room::GetAliveTeamNum()
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Room::CanJoin(const std::string& accountid, RoomType_e self_room_type)
|
bool Room::CanJoin(const std::string& accountid,
|
||||||
|
RoomType_e self_room_type,
|
||||||
|
RoomMode_e self_room_mode)
|
||||||
{
|
{
|
||||||
|
if (self_room_mode < kChiJiMode) {
|
||||||
|
self_room_mode = kChiJiMode;
|
||||||
|
}
|
||||||
|
if (self_room_mode > kRoomModeEnd) {
|
||||||
|
self_room_mode = kZombieMode;
|
||||||
|
}
|
||||||
|
if (room_mode_ != self_room_mode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (gas_data_.gas_mode != GasInactive) {
|
if (gas_data_.gas_mode != GasInactive) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
bool IsGameOver() { return game_over_; }
|
bool IsGameOver() { return game_over_; }
|
||||||
const GasData& GetGasData() { return gas_data_; }
|
const GasData& GetGasData() { return gas_data_; }
|
||||||
RoomType_e GetRoomType() { return room_type_; }
|
RoomType_e GetRoomType() { return room_type_; }
|
||||||
|
RoomMode_e GetRoomMode() { return room_mode_; }
|
||||||
long long GetRoomUuid() { return room_uuid_; }
|
long long GetRoomUuid() { return room_uuid_; }
|
||||||
int GetRoomIdx() { return room_idx_; }
|
int GetRoomIdx() { return room_idx_; }
|
||||||
std::string GetMapTplName() { return map_tpl_name_; }
|
std::string GetMapTplName() { return map_tpl_name_; }
|
||||||
@ -97,7 +98,9 @@ public:
|
|||||||
bool BattleStarted();
|
bool BattleStarted();
|
||||||
int GetAliveTeamNum();
|
int GetAliveTeamNum();
|
||||||
std::set<Human*>* GetAliveTeam();
|
std::set<Human*>* GetAliveTeam();
|
||||||
bool CanJoin(const std::string& accountid, RoomType_e self_roomm_type);
|
bool CanJoin(const std::string& accountid,
|
||||||
|
RoomType_e self_roomm_type,
|
||||||
|
RoomMode_e self_room_mode);
|
||||||
void OnPlayerOffline(Player* hum);
|
void OnPlayerOffline(Player* hum);
|
||||||
Entity* FindFirstCollisonEntity(const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
|
Entity* FindFirstCollisonEntity(const a8::Vec2& aabb_pos, AabbCollider& aabb_box);
|
||||||
void FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCollider* aabb_box,
|
void FindLocationWithAabb(Entity* target, const a8::Vec2& aabb_pos, AabbCollider* aabb_box,
|
||||||
|
@ -43,6 +43,9 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (msg.room_mode() == kZombieMode) {
|
||||||
|
return RT_OldBrid3;
|
||||||
|
}
|
||||||
|
|
||||||
if (!msg.team_uuid().empty() && msg.team_members().size() > 1) {
|
if (!msg.team_uuid().empty() && msg.team_members().size() > 1) {
|
||||||
for (auto& team_member : msg.team_members()) {
|
for (auto& team_member : msg.team_members()) {
|
||||||
@ -174,7 +177,7 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg,
|
|||||||
}
|
}
|
||||||
for (auto& pair : inactive_room_hash_) {
|
for (auto& pair : inactive_room_hash_) {
|
||||||
Room* room = pair.second;
|
Room* room = pair.second;
|
||||||
if (room->CanJoin(msg.account_id(), self_room_type)) {
|
if (room->CanJoin(msg.account_id(), self_room_type, (RoomMode_e)msg.room_mode())) {
|
||||||
if (!msg.team_uuid().empty() && room->HaveMyTeam(msg.team_uuid())) {
|
if (!msg.team_uuid().empty() && room->HaveMyTeam(msg.team_uuid())) {
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user