This commit is contained in:
azw 2023-08-19 16:07:20 +08:00
parent aa2105b30c
commit 2053312e2b

View File

@ -110,6 +110,26 @@ void Player::CoGame(f8::Coroutine* co)
f8::UdpLog::Instance()->Info
("join ok", {});
}
{
int seq_id = 0;
long long last_ping_tick = a8::XGetTickCount();
long long last_cmmove_tick = a8::XGetTickCount();
while (true) {
long long tick = a8::XGetTickCount();
if (tick - last_ping_tick > 1000) {
cs::CMPing msg;
SendMsg(msg);
last_ping_tick = tick;
}
if (tick - last_cmmove_tick > 100) {
cs::CMMove msg;
msg.set_seq(++seq_id);
SendMsg(msg);
last_cmmove_tick = tick;
}
co->CoYield();
}
}
}
void Player::InternalSendMsg(int msgid, ::google::protobuf::Message& msg)