添加新手玩家进游戏等待时间处理
This commit is contained in:
parent
0c7ea381ec
commit
5d161ae4af
@ -128,6 +128,7 @@ public:
|
||||
#if 1
|
||||
{
|
||||
MetaMgr::Instance()->gas_inactive_time = MetaMgr::Instance()->GetSysParamAsInt("gas_inactive_time");
|
||||
MetaMgr::Instance()->newbie_wait_time = MetaMgr::Instance()->GetSysParamAsInt("newbie_wait_time", 10);
|
||||
MetaMgr::Instance()->jump_time = MetaMgr::Instance()->GetSysParamAsFloat("jump_time");
|
||||
MetaMgr::Instance()->K = MetaMgr::Instance()->GetSysParamAsFloat("K");
|
||||
MetaMgr::Instance()->kill_param = MetaMgr::Instance()->GetSysParamAsFloat("kill_parameter");
|
||||
|
@ -47,6 +47,7 @@ class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
MetaData::Robot* GetRobot(int robot_id);
|
||||
|
||||
int gas_inactive_time = 10;
|
||||
int newbie_wait_time = 10;
|
||||
int jump_time = 10;
|
||||
float K = 100.0f;
|
||||
float kill_param = 0.0f;
|
||||
|
@ -741,7 +741,7 @@ int Room::GetAliveTeamNum()
|
||||
return num;
|
||||
}
|
||||
|
||||
bool Room::CanJoin(const std::string& accountid)
|
||||
bool Room::CanJoin(const std::string& accountid, RoomType_e self_room_type)
|
||||
{
|
||||
if (gas_data.gas_mode != GasInactive) {
|
||||
return false;
|
||||
@ -749,6 +749,14 @@ bool Room::CanJoin(const std::string& accountid)
|
||||
if (accountid_hash_.find(accountid) != accountid_hash_.end()) {
|
||||
return false;
|
||||
}
|
||||
if (self_room_type == RT_NewBrid) {
|
||||
int remain_time_ms = MetaMgr::Instance()->gas_inactive_time * 1000 -
|
||||
(frame_no - gas_data.gas_start_frameno) * FRAME_RATE_MS;
|
||||
remain_time_ms = std::max(remain_time_ms, 0);
|
||||
if (remain_time_ms <= MetaMgr::Instance()->newbie_wait_time * 1000) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return accountid_hash_.size() < ROOM_MAX_PLAYER_NUM;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public:
|
||||
bool BattleStarted();
|
||||
int GetAliveTeamNum();
|
||||
std::set<Human*>* GetAliveTeam();
|
||||
bool CanJoin(const std::string& accountid);
|
||||
bool CanJoin(const std::string& accountid, RoomType_e self_roomm_type);
|
||||
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,
|
||||
|
@ -142,7 +142,7 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room
|
||||
{
|
||||
#if 0
|
||||
for (auto& pair : inactive_room_hash_) {
|
||||
if (pair.second->CanJoin(msg.account_id())) {
|
||||
if (pair.second->CanJoin(msg.account_id(), self_room_type)) {
|
||||
return pair.second;
|
||||
}
|
||||
}
|
||||
@ -154,7 +154,7 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room
|
||||
}
|
||||
for (auto& pair : inactive_room_hash_) {
|
||||
Room* room = pair.second;
|
||||
if (room->CanJoin(msg.account_id())) {
|
||||
if (room->CanJoin(msg.account_id(), self_room_type)) {
|
||||
if (!msg.team_uuid().empty() && room->HaveMyTeam(msg.team_uuid())) {
|
||||
return room;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user