From 253eccfdce7d27d44aed9ee70aa1949394c884a5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 19 Jun 2020 13:26:49 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 14 ++++++++++++-- server/gameserver/human.h | 2 +- server/tools/protobuild/cs_proto.proto | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 8e97382..28073b4 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -272,7 +272,7 @@ long long Human::GetDeadFrameNo(Room* room) return dead_frameno; } -void Human::FillMFTeamData(cs::MFTeamData* team_data) +void Human::FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over) { { last_sync_teamdata_frameno_ = room->GetFrameNo(); @@ -285,6 +285,9 @@ void Human::FillMFTeamData(cs::MFTeamData* team_data) team_data->set_disconnected(false); team_data->set_dead(dead); team_data->set_downed(downed); + if (is_game_over) { + team_data->set_account_id(account_id); + } } } @@ -848,6 +851,13 @@ void Human::FillSMGameOver(cs::SMGameOver& msg) msg.set_victory(!dead); msg.set_room_uuid(a8::XValue(room->GetRoomUuid())); + { + for (auto& itr : *team_members) { + if (itr != this) { + itr->FillMFTeamData(msg.add_team_data(), true); + } + } + } cs::MFPlayerStats* p = msg.add_player_stats(); FillMFPlayerStats(p); } @@ -3150,7 +3160,7 @@ void Human::NotifyObservers(cs::SMUpdate* msg, cs::MFActivePlayerData* active_pl if (observer->team_members) { for (auto& itr : *observer->team_members) { if (itr != observer) { - itr->FillMFTeamData(msg->add_team_data()); + itr->FillMFTeamData(msg->add_team_data(), false); } } } diff --git a/server/gameserver/human.h b/server/gameserver/human.h index b7b07fe..8dc11fe 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -154,7 +154,7 @@ class Human : public MoveableEntity virtual void GetAabbBox(AabbCollider& aabb_box); virtual bool IsDead(Room* room) override; virtual long long GetDeadFrameNo(Room* room) override; - void FillMFTeamData(cs::MFTeamData* team_data); + void FillMFTeamData(cs::MFTeamData* team_data, bool is_game_over); void Shot(a8::Vec2& target_dir); void TankShot(a8::Vec2& target_dir); void RecalcSelfCollider(); diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index 058046d..40024e4 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -502,6 +502,7 @@ message MFTeamData optional bool downed = 7 [default = false]; //是否倒下 optional string name = 8; //名字 optional float max_health = 9; //最大血量 + optional string account_id = 10; //只在结算的时候该字段才有内容 } //子弹 @@ -873,6 +874,7 @@ message SMGameOver repeated MFPlayerStats player_stats = 6; //玩家信息统计 optional string room_uuid = 7; //房间唯一id + repeated MFTeamData team_data = 10; //队伍数据 } //离开