This commit is contained in:
aozhiwei 2024-03-20 19:52:44 +08:00
parent 93d19816de
commit ef3bdcf123
4 changed files with 25 additions and 7 deletions

View File

@ -2636,7 +2636,21 @@ void Room::NotifyKillList(const std::vector<int>& uniid_list)
void Room::SendSMTeamFull(Human* hum)
{
if (!IsMobaModeRoom()) {
return;
}
cs::SMTeamFullNotify notify_msg;
std::vector<Team*> team_list = {GetMobaTeamA(), GetMobaTeamB()};
for (Team* team : team_list) {
team->FillMFTeamFull(notify_msg.add_team_list());
}
TraversePlayerList
(
[&notify_msg] (Player* hum) -> bool
{
hum->SendNotifyMsg(notify_msg);
return true;
});
}
void Room::OnTeamPartChg(Human* hum)
@ -2644,15 +2658,15 @@ void Room::OnTeamPartChg(Human* hum)
if (!IsMobaModeRoom()) {
return;
}
if (hpchg_human_hash_.empty()) {
hpchg_human_hash_[hum->GetUniId()] = hum;
if (team_part_chg_human_hash_.empty()) {
team_part_chg_human_hash_[hum->GetUniId()] = hum;
xtimer.SetTimeoutWpEx
(SERVER_FRAME_RATE * 0.5,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
cs::SMTeamPartNotify notify_msg;
for (auto& pair : hpchg_human_hash_) {
for (auto& pair : team_part_chg_human_hash_) {
pair.second->FillMFTeamPart(notify_msg.add_members());
}
TraversePlayerList
@ -2662,11 +2676,12 @@ void Room::OnTeamPartChg(Human* hum)
hum->SendNotifyMsg(notify_msg);
return true;
});
hpchg_human_hash_.clear();
team_part_chg_human_hash_.clear();
}
},
&xtimer_attacher_);
hpchg_human_hash_[hum->GetUniId()] = hum;
} else {
team_part_chg_human_hash_[hum->GetUniId()] = hum;
}
}

View File

@ -2997,6 +2997,7 @@ void Room::OnBattleStart()
return true;
});
battle_starting_ = false;
SendSMTeamFull(nullptr);
}
bool Room::CanAddObstacle(const glm::vec3& pos, int obstacle_id)

View File

@ -399,7 +399,7 @@ private:
std::map<int, Human*> alive_human_hash_;
std::map<int, Human*> alive_player_hash_;
std::map<int, Human*> last_human_hash_;
std::map<int, Human*> hpchg_human_hash_;
std::map<int, Human*> team_part_chg_human_hash_;
std::map<int, std::shared_ptr<BornPoint>> born_point_hash_;
std::map<int, std::shared_ptr<a8::CommonCbProcEx>> task_hash_;

View File

@ -2005,6 +2005,8 @@ message SMUiUpdate
optional int32 alive_count = 1; //
optional int32 kill_count = 2; //
repeated MFMapCarInfo car_list = 3; //
optional int32 dead_count = 4; //()
optional int32 assist_count = 5; //
//pve模式有意义
optional int32 score = 10; //