This commit is contained in:
aozhiwei 2020-06-19 13:26:49 +08:00
parent 8dc52d28e7
commit 253eccfdce
3 changed files with 15 additions and 3 deletions

View File

@ -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);
}
}
}

View File

@ -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();

View File

@ -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; //
}
//