27 lines
586 B
C++
27 lines
586 B
C++
#pragma once
|
|
|
|
#include <a8/singleton.h>
|
|
|
|
class Player;
|
|
class PlayerMgr : public a8::Singleton<PlayerMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_PlayerMgr };
|
|
|
|
private:
|
|
PlayerMgr() {};
|
|
friend class a8::Singleton<PlayerMgr>;
|
|
|
|
public:
|
|
|
|
void Init();
|
|
void UnInit();
|
|
void Update();
|
|
std::shared_ptr<Player> GetPlayerByAccountId(const std::string& account_id);
|
|
std::shared_ptr<Player> GetPlayerBySocketHandle(int socket_handle);
|
|
|
|
private:
|
|
std::map<int, std::shared_ptr<Player>> socket_id_hash_;
|
|
std::map<std::string, std::shared_ptr<Player>> account_id_hash_;
|
|
};
|