1
This commit is contained in:
parent
2f8844344e
commit
3652d1e436
@ -1318,7 +1318,7 @@ void Room::InitAirDrop()
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
room->AirDrop(param.param1, param.param2);
|
||||
room->AirDrop(param.param1, param.param2, param.param3);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
@ -1328,26 +1328,27 @@ void Room::InitAirDrop()
|
||||
std::list<MetaData::AirDrop>& air_drops = MetaMgr::Instance()->GetAirDrops();
|
||||
for (auto& air_drop : air_drops) {
|
||||
if (air_drop.i->id() >= 1 && air_drop.i->id() <= 6) {
|
||||
xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * air_drop.i->time(),
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(air_drop.i->appear_time())
|
||||
.SetParam2(air_drop.i->drop_id())
|
||||
.SetParam3(air_drop.i->id()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
room->AirDrop(param.param1, param.param2);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE * air_drop.i->time(),
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(air_drop.i->appear_time())
|
||||
.SetParam2(air_drop.i->drop_id())
|
||||
.SetParam3(air_drop.i->id()),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
room->AirDrop(param.param1, param.param2, param.param3);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Room::AirDrop(int appear_time, int box_id)
|
||||
void Room::AirDrop(int appear_time, int box_id, int airdrop_id)
|
||||
{
|
||||
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(box_id);
|
||||
if (room_type_ == RT_NewBrid &&
|
||||
@ -1359,8 +1360,8 @@ void Room::AirDrop(int appear_time, int box_id)
|
||||
}
|
||||
}
|
||||
if (GetRoomMode() == kZombieMode) {
|
||||
for (auto& pair : accountid_hash_) {
|
||||
pair.second->SendShowCountdown("距离物资箱抵达还有%d秒", appear_time / 1000);
|
||||
if (airdrop_id != map_meta_->i->terminator_airdrop()) {
|
||||
NotifyCountdown("距离物资箱抵达还有%d秒", appear_time / 1000);
|
||||
}
|
||||
}
|
||||
if (thing_meta && thing_meta->i->type() == 2) {
|
||||
@ -1403,25 +1404,41 @@ void Room::AirDrop(int appear_time, int box_id)
|
||||
return;
|
||||
}
|
||||
frame_event.AddAirDrop(appear_time, box_id, box_pos);
|
||||
xtimer.
|
||||
AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * appear_time / 1000.f,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(box_id)
|
||||
.SetParam2(box_pos.x)
|
||||
.SetParam3(box_pos.y),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
RoomObstacle* obstacle = room->
|
||||
CreateObstacle(param.param1.GetInt(),
|
||||
param.param2.GetDouble(),
|
||||
param.param3.GetDouble());
|
||||
obstacle->is_treasure_box = true;
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
xtimer.AddDeadLineTimerAndAttach
|
||||
(SERVER_FRAME_RATE * appear_time / 1000.f,
|
||||
a8::XParams()
|
||||
.SetSender(this)
|
||||
.SetParam1(a8::MakeInt64(airdrop_id, box_id))
|
||||
.SetParam2(box_pos.x)
|
||||
.SetParam3(box_pos.y),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
if (!room->IsGameOver()) {
|
||||
int airdrop_id = a8::Low32(param.param1.GetInt());
|
||||
int box_id = a8::High32(param.param1.GetInt());
|
||||
RoomObstacle* obstacle = room->CreateObstacle
|
||||
(
|
||||
box_id,
|
||||
param.param2.GetDouble(),
|
||||
param.param3.GetDouble()
|
||||
);
|
||||
obstacle->is_treasure_box = true;
|
||||
if (room->GetRoomMode() == kZombieMode) {
|
||||
obstacle->is_terminator_airdrop_box =
|
||||
airdrop_id == room->map_meta_->i->terminator_airdrop();
|
||||
if (obstacle->is_terminator_airdrop_box) {
|
||||
room->NotifySysPiao
|
||||
(
|
||||
"终结者补给箱已送达",
|
||||
a8::MkRgb(0, 255, 0),
|
||||
3
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
++airdrop_times_;
|
||||
}
|
||||
}
|
||||
@ -3155,6 +3172,20 @@ void Room::RemoveRescue(Human* hum)
|
||||
}
|
||||
}
|
||||
|
||||
void Room::NotifyCountdown(const std::string& msg, int time)
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
pair.second->SendShowCountdown(msg, time);
|
||||
}
|
||||
}
|
||||
|
||||
void Room::NotifySysPiao(const std::string& msg, int color, int duration)
|
||||
{
|
||||
for (auto& pair : accountid_hash_) {
|
||||
pair.second->SendSysPiaoMsg(msg, color, duration);
|
||||
}
|
||||
}
|
||||
|
||||
size_t Room::GetRoomMaxPlayerNum()
|
||||
{
|
||||
if (room_mode_ == kZombieMode) {
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
bool IsMiniRoom();
|
||||
void FillObjectPositions(Human* hum, cs::SMUpdate& msg);
|
||||
void RemoveRescue(Human* hum);
|
||||
void NotifyCountdown(const std::string& msg, int time);
|
||||
void NotifySysPiao(const std::string& msg, int color, int duration);
|
||||
|
||||
private:
|
||||
int AllocUniid();
|
||||
@ -149,7 +151,7 @@ private:
|
||||
a8::Vec2& out_pos);
|
||||
void MatchTeam(Human* hum);
|
||||
void CombineTeam();
|
||||
void AirDrop(int appear_time, int box_id);
|
||||
void AirDrop(int appear_time, int box_id, int airdrop_id);
|
||||
void AdjustAirDropPos(MetaData::MapThing* thing_meta, a8::Vec2& box_pos);
|
||||
void ShuaPlane();
|
||||
int NewTeam();
|
||||
|
@ -8,6 +8,7 @@ class RoomObstacle : public Obstacle
|
||||
Room* room = nullptr;
|
||||
a8::XTimerAttacher xtimer_attacher;
|
||||
bool is_treasure_box = false;
|
||||
bool is_terminator_airdrop_box = false;
|
||||
|
||||
virtual ~RoomObstacle() override;
|
||||
virtual void Initialize() override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user