From ef3bdcf12317aae84d67fde46b1cc3e17d22428e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 20 Mar 2024 19:52:44 +0800 Subject: [PATCH] 1 --- server/gameserver/pbutils.cc | 27 ++++++++++++++++++++------ server/gameserver/room.cc | 1 + server/gameserver/room.h | 2 +- server/tools/protobuild/cs_proto.proto | 2 ++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/server/gameserver/pbutils.cc b/server/gameserver/pbutils.cc index 839fe636..7f474073 100644 --- a/server/gameserver/pbutils.cc +++ b/server/gameserver/pbutils.cc @@ -2636,7 +2636,21 @@ void Room::NotifyKillList(const std::vector& uniid_list) void Room::SendSMTeamFull(Human* hum) { - + if (!IsMobaModeRoom()) { + return; + } + cs::SMTeamFullNotify notify_msg; + std::vector team_list = {GetMobaTeamA(), GetMobaTeamB()}; + for (Team* team : team_list) { + team->FillMFTeamFull(notify_msg.add_team_list()); + } + TraversePlayerList + ( + [¬ify_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; } } diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 3e3f7884..c77d4872 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2997,6 +2997,7 @@ void Room::OnBattleStart() return true; }); battle_starting_ = false; + SendSMTeamFull(nullptr); } bool Room::CanAddObstacle(const glm::vec3& pos, int obstacle_id) diff --git a/server/gameserver/room.h b/server/gameserver/room.h index c70dd7d0..48d62c73 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -399,7 +399,7 @@ private: std::map alive_human_hash_; std::map alive_player_hash_; std::map last_human_hash_; - std::map hpchg_human_hash_; + std::map team_part_chg_human_hash_; std::map> born_point_hash_; std::map> task_hash_; diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index d3a26006..03a8b153 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -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; //积分