This commit is contained in:
aozhiwei 2024-03-29 10:28:21 +08:00
parent 6490367f10
commit 6fe70cab66
3 changed files with 23 additions and 2 deletions

View File

@ -43,6 +43,7 @@
#include "stats.h"
#include "hero.h"
#include "bornpoint.h"
#include "ingamevoice.h"
#include "buff/sprint.h"
@ -3557,6 +3558,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
}
SendViewerUiMemberUpdate({GetUniId(), killer_id, real_killer_id});
room->NotifyUiUpdate();
room->GetInGameVoice()->OnHumanBeKill(real_killer_id, this);
}
int Human::GetTeamMode()

View File

@ -2,7 +2,7 @@
#include "ingamevoice.h"
#include "room.h"
#include "player.h"
#include "human.h"
InGameVoice::InGameVoice(Room* room)
{
@ -23,3 +23,19 @@ void InGameVoice::UnInit()
{
}
void InGameVoice::OnHumanBeKill(int killer_id, Human* deader)
{
if (killer_id == deader->GetUniId()) {
return;
}
Human* killer = room_->GetHumanByUniId(killer_id);
if (!killer) {
return;
}
++global_times_;
if (global_times_ == 1) {
room_->SendGlobalInGameVoice(killer_id, 1, deader->GetUniId());
return;
}
}

View File

@ -1,7 +1,7 @@
#pragma once
class Room;
class Human;
class InGameVoice : public std::enable_shared_from_this<InGameVoice>
{
public:
@ -11,6 +11,9 @@ class InGameVoice : public std::enable_shared_from_this<InGameVoice>
void Init();
void UnInit();
void OnHumanBeKill(int killer_id, Human* deader);
private:
Room* room_ = nullptr;
int global_times_ = 0;
};