This commit is contained in:
aozhiwei 2023-11-26 13:00:22 +08:00
parent 8625147110
commit 289c19b307

View File

@ -113,6 +113,16 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
behaviac::EBTStatus AndroidAgent::CoConnectBattleServer() behaviac::EBTStatus AndroidAgent::CoConnectBattleServer()
{ {
PRE_ENTER_COROUTINE();
auto context = MAKE_BTCONTEXT
(
std::function<void (a8::WebSocketClient*, int)> old_on_error;
std::function<void (a8::WebSocketClient*)> old_on_connect;
std::function<void (a8::WebSocketClient*)> old_on_disconnect;
);
context->old_on_error = owner_->GetWebSocket()->on_error;
context->old_on_connect = owner_->GetWebSocket()->on_connect;
context->old_on_disconnect = owner_->GetWebSocket()->on_disconnect;
owner_->GetWebSocket()->on_error = owner_->GetWebSocket()->on_error =
[this] (a8::WebSocketClient*,int err_code) [this] (a8::WebSocketClient*,int err_code)
{ {