This commit is contained in:
aozhiwei 2023-05-31 21:36:31 +08:00
parent 2d8089254c
commit 749e0f19cb
2 changed files with 15 additions and 0 deletions

View File

@ -5,15 +5,29 @@ namespace a8
class WebSocketClient;
}
A8_DECLARE_ENUM(PlayerState_e,
INIT = 0,
);
class Player
{
public:
void Update();
template <typename T>
void SendNotifyMsg(T& msg)
{
}
int GetSocketId() { return socket_id_; }
private:
int socket_id_ = 0;
PlayerState_e state_ = PlayerState_e::INIT;
std::string account_id_;
std::string session_id_;
std::string remote_ip_;
int remote_port_ = 0;
std::shared_ptr<a8::WebSocketClient> web_socket_;

View File

@ -22,5 +22,6 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
void CoCreatePlayer(int idx, f8::Coroutine* co);
private:
std::map<int, std::shared_ptr<Player>> socket_id_hash_;
std::map<std::string, std::shared_ptr<Player>> account_id_hash_;
};