This commit is contained in:
aozhiwei 2023-03-03 10:35:03 +08:00
parent 471d78ca05
commit 67c6267079

View File

@ -929,6 +929,18 @@ void Human::DoJump()
MustBeAddBuff(this, JUMP_BUFFID);
jump_frameno_ = room->GetFrameNo();
SyncAroundPlayers(__FILE__, __LINE__, __func__);
if (IsPlayer()) {
room->xtimer.SetTimeoutEx
(
SERVER_FRAME_RATE,
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
SyncVolume(-1);
}
},
&xtimer_attacher);
}
}
}
@ -3431,5 +3443,22 @@ void Human::CalcAssists(Human* target)
void Human::SyncVolume(int slot_id)
{
if (slot_id < 0) {
for (int i = 0; i < IS_END; ++i) {
if (volume_[i] > 0) {
room->xtimer.SetTimeoutEx
(
std::max(SERVER_FRAME_RATE * 6, i * 2),
[this, i] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
room->frame_event.AddPropChg(GetWeakPtrRef(), kPropVolume, i, volume_[i], true);
}
},
&xtimer_attacher);
}
}
} else if (slot_id < IS_END){
room->frame_event.AddPropChg(GetWeakPtrRef(), kPropVolume, slot_id, volume_[slot_id], true);
}
}