aozhiwei c144c7a803 1
2022-12-17 15:25:05 +08:00

39 lines
866 B
C++

#pragma once
#include <a8/singleton.h>
#include <f8/protoutils.h>
namespace cs
{
class CMJoin;
}
class MatchTeam;
class MatchMgr : public a8::Singleton<MatchMgr>
{
private:
MatchMgr() {};
friend class a8::Singleton<MatchMgr>;
public:
f8::Attacher timer_attacher;
void Init();
void UnInit();
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& 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);
void RemoveTeam(const std::string& team_uuid);
void RemoveSocket(int socket_handle);
void Output();
private:
std::map<std::string, MatchTeam*> team_hash_;
std::map<int, std::tuple<std::string, MatchTeam*>> socket_hash_;
};