44 lines
988 B
C++
44 lines
988 B
C++
#pragma once
|
|
|
|
#include <a8/timer_attacher.h>
|
|
|
|
namespace cs
|
|
{
|
|
class CMJoin;
|
|
}
|
|
|
|
class Room;
|
|
class RoomMgr : public a8::Singleton<RoomMgr>
|
|
{
|
|
public:
|
|
enum { HID = HID_RoomMgr };
|
|
|
|
private:
|
|
RoomMgr() {};
|
|
friend class a8::Singleton<RoomMgr>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
void Update(int delta_time);
|
|
|
|
void _CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
|
void ActiveRoom(long long room_uuid);
|
|
int RoomNum();
|
|
int OverRoomNum();
|
|
Room* GetRoomByUuid(long long uuid);
|
|
void AddOverRoom(long long room_uuid);
|
|
void InstallReportStateTimer();
|
|
|
|
private:
|
|
Room* GetJoinableRoom(const cs::CMJoin& msg);
|
|
void ReportServerState(int instance_id, const std::string& host, int port);
|
|
void FreeOverRoom(long long room_uuid);
|
|
|
|
private:
|
|
std::map<long long, Room*> inactive_room_hash_;
|
|
std::map<long long, Room*> room_hash_;
|
|
std::map<long long, Room*> over_room_hash_;
|
|
a8::TimerAttacher reportstate_timer_attacher_;
|
|
};
|