This commit is contained in:
aozhiwei 2023-12-01 10:26:38 +08:00
parent 38eb2c1891
commit 74c29ae4fc
2 changed files with 7 additions and 2 deletions

View File

@ -20,7 +20,7 @@ AndroidAgent::~AndroidAgent()
bool AndroidAgent::IsLoginSuccess() bool AndroidAgent::IsLoginSuccess()
{ {
return false; return is_login_success_;
} }
behaviac::EBTStatus AndroidAgent::SearchEnemy(int range) behaviac::EBTStatus AndroidAgent::SearchEnemy(int range)
@ -84,8 +84,9 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
( (
[context] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx) [context] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
{ {
a8::XPrintf("data:%s\n", {rsp_obj->ToJsonStr()});
if (ok) { if (ok) {
context->login_ok = true;
} else { } else {
context->login_ok = false; context->login_ok = false;
} }
@ -105,6 +106,7 @@ behaviac::EBTStatus AndroidAgent::CoLogin()
[this, context] (BtCoroutine* co) [this, context] (BtCoroutine* co)
{ {
if (context->login_ok == std::nullopt) { if (context->login_ok == std::nullopt) {
owner_->SetLoginSucess(context->login_ok);
return behaviac::BT_RUNNING; return behaviac::BT_RUNNING;
} }
return behaviac::BT_SUCCESS; return behaviac::BT_SUCCESS;

View File

@ -32,6 +32,8 @@ public:
const std::string& GetAccountId() { return account_id_; } const std::string& GetAccountId() { return account_id_; }
auto GetWebSocket() { return web_socket_; } auto GetWebSocket() { return web_socket_; }
int GetIdx() { return idx_; } int GetIdx() { return idx_; }
void SetLoginSucess();
bool IsLoginSucess() { return is_login_sucess_; };
void _SMKcpHandshake(f8::MsgHdr* hdr, const cs::SMKcpHandshake& msg); void _SMKcpHandshake(f8::MsgHdr* hdr, const cs::SMKcpHandshake& msg);
void _SMPing(f8::MsgHdr* hdr, const cs::SMPing& msg); void _SMPing(f8::MsgHdr* hdr, const cs::SMPing& msg);
@ -74,6 +76,7 @@ private:
std::string remote_ip_; std::string remote_ip_;
int remote_port_ = 0; int remote_port_ = 0;
bool is_login_success_ = false;
bool net_connected_ = false; bool net_connected_ = false;
bool join_ok_ = false; bool join_ok_ = false;