40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
#pragma once
|
|
|
|
namespace cs
|
|
{
|
|
class CMJoin;
|
|
class CMReconnect;
|
|
class CMMatchCancel;
|
|
class CMMatchChoose;
|
|
class CMMatchStartGame;
|
|
}
|
|
|
|
class MatchTeam;
|
|
class MatchMgr : public a8::Singleton<MatchMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_RoomMgr };
|
|
|
|
private:
|
|
MatchMgr() {};
|
|
friend class a8::Singleton<MatchMgr>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
|
|
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
|
void _CMMatchCancel(f8::MsgHdr& hdr, const cs::CMMatchCancel& msg);
|
|
void _CMMatchChoose(f8::MsgHdr& hdr, const cs::CMMatchChoose& msg);
|
|
void _CMMatchStartGame(f8::MsgHdr& hdr, const cs::CMMatchStartGame& msg);
|
|
void TraverseTeam(std::function<void (MatchTeam*, bool&)> func);
|
|
|
|
bool NeedMatch(const cs::CMJoin& msg);
|
|
MatchTeam* GetTeam(const std::string& team_uuid);
|
|
std::tuple<std::string, MatchTeam*>* GetMatchInfo(int socket_handle);
|
|
|
|
private:
|
|
std::map<std::string, MatchTeam*> team_hash_;
|
|
std::map<int, std::tuple<std::string, MatchTeam*>> socket_hash_;
|
|
};
|