#pragma once #include #include #include "Singleton.h" #include "eGameMessageType.h" typedef std::map StateStorage; class GameMessageStorage : public Singleton { public: GameMessageStorage(); ~GameMessageStorage(); uint32_t GetGMFromName(std::string name); nlohmann::json GetGM(uint32_t id); private: nlohmann::json m_Storage; }; class GameMessage { public: GameMessage(std::string name); GameMessage(eGameMessageType type); void Serialize(RakNet::BitStream* bs); template inline void Set(std::string key, T value) { m_State[key] = std::any(value); } template inline T Get(std::string key) { return m_State[key]; } inline eGameMessageType GetType() { return m_Type; } inline StateStorage GetState() { return m_State; } inline nlohmann::json GetMessage() { return m_Message; } private: eGameMessageType m_Type; nlohmann::json m_Message; StateStorage m_State; };