This commit is contained in:
aozhiwei 2023-06-03 11:17:50 +08:00
parent 0c86b1bd58
commit f67342df0e
3 changed files with 27 additions and 0 deletions

View File

@ -2156,6 +2156,21 @@ void Room::NotifyNewsTicker(int msg_type, std::vector<std::string> msg_content)
}); });
} }
void Room::NotifyKillList(const std::vector<int>& uniid_list)
{
cs::SMSyncKillList notify_msg;
for (int obj_uniid : uniid_list) {
auto p = notify_msg.add_kill_list();
p->set_obj_uniid(obj_uniid);
}
TraversePlayerList
(
[&notify_msg] (Player* hum)
{
hum->SendNotifyMsg(notify_msg);
});
}
void SyncObject::FillSMSyncPosition(cs::SMSyncPosition& sync_msg) void SyncObject::FillSMSyncPosition(cs::SMSyncPosition& sync_msg)
{ {
if (!c.Get()) { if (!c.Get()) {

View File

@ -41,6 +41,7 @@
#include "airraid.h" #include "airraid.h"
#include "sandtable.h" #include "sandtable.h"
#include "batchsync.h" #include "batchsync.h"
#include "trigger.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Hero.h" #include "mt/Hero.h"
@ -3334,6 +3335,16 @@ void Room::ForwardGasRing(int n)
boss_uniid); boss_uniid);
if (hero) { if (hero) {
batch_sync_->AddGlobalObject(hero); batch_sync_->AddGlobalObject(hero);
hero->GetTrigger()->AddListener
(
kDieEvent,
[this, boss_uniid] (const a8::Args& args) mutable
{
if (!IsGameOver()) {
batch_sync_->RemoveGlobalObject(boss_uniid);
NotifyKillList({boss_uniid});
}
});
} }
} }
}, },

View File

@ -253,6 +253,7 @@ public:
void OpenRoomSwitch(int tag); void OpenRoomSwitch(int tag);
void CloseRoomSwitch(int tag); void CloseRoomSwitch(int tag);
void NotifyNewsTicker(int msg_type, std::vector<std::string> msg_content); void NotifyNewsTicker(int msg_type, std::vector<std::string> msg_content);
void NotifyKillList(const std::vector<int>& uniid_list);
std::shared_ptr<AirRaid> GetAirRaid() { return air_raid_; } std::shared_ptr<AirRaid> GetAirRaid() { return air_raid_; }
std::shared_ptr<BatchSync> GetBatchSync() { return batch_sync_; } std::shared_ptr<BatchSync> GetBatchSync() { return batch_sync_; }