1
This commit is contained in:
parent
e896c08c6a
commit
1eec34422e
@ -1,9 +1,11 @@
|
|||||||
#include "precompile.h"
|
#include "precompile.h"
|
||||||
|
|
||||||
|
#include <a8/mutable_xobject.h>
|
||||||
#include <f8/btmgr.h>
|
#include <f8/btmgr.h>
|
||||||
|
|
||||||
#include "android_agent.h"
|
#include "android_agent.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "httpproxy.h"
|
||||||
|
|
||||||
AndroidAgent::AndroidAgent()
|
AndroidAgent::AndroidAgent()
|
||||||
{
|
{
|
||||||
@ -37,17 +39,35 @@ behaviac::EBTStatus AndroidAgent::CoIdle(int min_val, int max_val)
|
|||||||
);
|
);
|
||||||
context->time = a8::RandEx(min_val, max_val);
|
context->time = a8::RandEx(min_val, max_val);
|
||||||
auto co = std::make_shared<BtCoroutine>(context, co_id, "CoIdle");
|
auto co = std::make_shared<BtCoroutine>(context, co_id, "CoIdle");
|
||||||
#if 0
|
|
||||||
co->runing_cb =
|
co->runing_cb =
|
||||||
[this, context] (BtCoroutine* co)
|
[this, context] (BtCoroutine* co)
|
||||||
{
|
{
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
};
|
};
|
||||||
#endif
|
return StartCoroutine(co);
|
||||||
// return StartCoroutine(co);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviac::EBTStatus AndroidAgent::CoLogin()
|
behaviac::EBTStatus AndroidAgent::CoLogin()
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
|
url_params->SetVal("c", "Login");
|
||||||
|
url_params->SetVal("a", "auth");
|
||||||
|
url_params->SetVal("gameid", 2006);
|
||||||
|
url_params->SetVal("channel", 6513);
|
||||||
|
url_params->SetVal("openid", owner_->GetIdx());
|
||||||
|
HttpProxy::Instance()->HttpGet
|
||||||
|
(
|
||||||
|
[] (bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||||
|
{
|
||||||
|
if (ok) {
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"https://login-test.kingsome.cn/webapp/index.php",
|
||||||
|
*url_params
|
||||||
|
);
|
||||||
|
}
|
||||||
return behaviac::BT_SUCCESS;
|
return behaviac::BT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,12 +86,10 @@ void BaseAgent::CheckCoroutineEvent()
|
|||||||
list_head* head = &coroutines_list_;
|
list_head* head = &coroutines_list_;
|
||||||
list_for_each_safe(pos, next, head) {
|
list_for_each_safe(pos, next, head) {
|
||||||
BtCoroutine* co = list_entry(pos, BtCoroutine, entry);
|
BtCoroutine* co = list_entry(pos, BtCoroutine, entry);
|
||||||
#if 0
|
|
||||||
if (co->GetContext()->HasEvent()) {
|
if (co->GetContext()->HasEvent()) {
|
||||||
co_id = co->GetId();
|
co_id = co->GetId();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (co_id >= 0) {
|
if (co_id >= 0) {
|
||||||
@ -102,7 +100,7 @@ void BaseAgent::CheckCoroutineEvent()
|
|||||||
auto co = itr->second;
|
auto co = itr->second;
|
||||||
coroutines_hash_.clear();
|
coroutines_hash_.clear();
|
||||||
INIT_LIST_HEAD(&coroutines_list_);
|
INIT_LIST_HEAD(&coroutines_list_);
|
||||||
//co->GetContext()->FireEvent(this);
|
co->GetContext()->FireEvent(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
bool NetConnected() { return net_connected_; }
|
bool NetConnected() { return net_connected_; }
|
||||||
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_; }
|
||||||
|
|
||||||
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);
|
||||||
@ -61,6 +62,7 @@ private:
|
|||||||
void InternalSendMsg(int msgid, ::google::protobuf::Message& msg);
|
void InternalSendMsg(int msgid, ::google::protobuf::Message& msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
int idx_ = 0;
|
||||||
int socket_handle_ = 0;
|
int socket_handle_ = 0;
|
||||||
std::string account_id_;
|
std::string account_id_;
|
||||||
std::string session_id_;
|
std::string session_id_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user