1
This commit is contained in:
parent
aa2105b30c
commit
2053312e2b
@ -110,6 +110,26 @@ void Player::CoGame(f8::Coroutine* co)
|
|||||||
f8::UdpLog::Instance()->Info
|
f8::UdpLog::Instance()->Info
|
||||||
("join ok", {});
|
("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)
|
void Player::InternalSendMsg(int msgid, ::google::protobuf::Message& msg)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user