#pragma once #include namespace Game { class NetbaraStatusReq; class NetbarStatusRes; }; class GameClient; class TencentNetbarInterface { public: TencentNetbarInterface(); ~TencentNetbarInterface(); public: enum RequestStatus { RS_NotRequest=0, RS_ClientRequesting, RS_ClientRequest_Done, RS_ClientRequest_Failed, RS_ServerRequesting, RS_ReqestFailed, RS_RequestDone, }; enum NetbarStatus { NS_Unknown = 0, NS_Netbar, NS_ClientFailed, NS_ServerFailed, }; typedef std::function RequestCallback; bool beginRequestNetbarStatus(RequestCallback callback); void onReceiveNetbarReportRequest(Game::NetbarStatusRes* response); void init(GameClient* client); void tick(); private: static unsigned int _workingThreadEntry(void* param); bool workThreadEntry(); private: enum { TENCENT_NETBAR_DNF_CLIENT_GAME_ID = 20 }; private: GameClient* m_client = nullptr; std::atomic m_requestStatus; HANDLE m_workThread; NetbarStatus m_netbarStatus; int32_t m_clientErrorCode; int32_t m_serverErrorCode; std::string m_serverErrorMessage; int32_t m_netbarLevel; RequestCallback m_requestCallback; Game::NetbaraStatusReq* m_clientNetbarReq = nullptr; };