39 lines
947 B
C++
39 lines
947 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 (std::shared_ptr<MatchTeam>&, bool&)> func);
|
|
|
|
bool NeedMatch(const cs::CMJoin& msg);
|
|
std::shared_ptr<MatchTeam> GetTeam(const std::string& team_uuid);
|
|
std::tuple<std::string, std::shared_ptr<MatchTeam>>* GetMatchInfo(int socket_handle);
|
|
void RemoveTeam(const std::string& team_uuid);
|
|
void RemoveSocket(int socket_handle);
|
|
void Output();
|
|
|
|
private:
|
|
std::map<std::string, std::shared_ptr<MatchTeam>> team_hash_;
|
|
std::map<int, std::tuple<std::string, std::shared_ptr<MatchTeam>>> socket_hash_;
|
|
};
|