This commit is contained in:
aozhiwei 2023-06-12 13:32:36 +08:00
parent c22f7b1c7d
commit ef58abcb27
2 changed files with 9 additions and 1 deletions

View File

@ -14,15 +14,20 @@ void Player::Init()
void Player::CoNet(f8::Coroutine* co)
{
co->Await(CoLogin);
co->Await(CoGame);
}
void Player::CoLogin(f8::Coroutine* co)
{
while (NetConnected()) {
}
}
void Player::CoGame(f8::Coroutine* co)
{
while (NetConnected()) {
}
}

View File

@ -24,6 +24,7 @@ public:
{
}
int GetSocketId() { return socket_id_; }
bool NetConnected() { return net_connected_; }
private:
@ -39,6 +40,8 @@ private:
std::string remote_ip_;
int remote_port_ = 0;
bool net_connected_ = false;
std::shared_ptr<a8::WebSocketClient> web_socket_;
};