Change Lobby timer
This commit is contained in:
@@ -36,6 +36,8 @@ protected:
|
||||
TeamList m_Teams = { Team{TeamColor::Red}, Team{TeamColor::Blue} };
|
||||
GameState m_GameState = GameState::Lobby;
|
||||
PlayerList m_Players;
|
||||
|
||||
std::uint64_t m_GameStartTime = 0;
|
||||
public:
|
||||
Game(World* world);
|
||||
virtual ~Game();
|
||||
@@ -65,6 +67,8 @@ public:
|
||||
|
||||
const TeamList& GetTeams() const { return m_Teams; }
|
||||
|
||||
std::uint64_t GetGameStartTime() const { return m_GameStartTime; }
|
||||
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
||||
@@ -18,7 +18,7 @@ class ClientGame : public protocol::PacketHandler, public game::Game {
|
||||
private:
|
||||
Client* m_Client;
|
||||
std::uint8_t m_ConnexionID;
|
||||
std::uint32_t m_LobbyTime = 0;
|
||||
std::uint64_t m_LobbyStartTime = 0;
|
||||
game::Player* m_Player = nullptr;
|
||||
render::Renderer* m_Renderer;
|
||||
client::WorldClient m_WorldClient;
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
|
||||
void RenderWorld();
|
||||
|
||||
std::uint32_t GetLobbyTime() const { return m_LobbyTime; }
|
||||
std::uint64_t GetLobbyStartTime() const { return m_LobbyStartTime; }
|
||||
const game::Player* GetPlayer() const { return m_Player; }
|
||||
const WorldClient& GetWorld() const { return m_WorldClient; }
|
||||
Client* GetClient() const { return m_Client; }
|
||||
|
||||
@@ -13,7 +13,7 @@ class Lobby {
|
||||
private:
|
||||
Server* m_Server;
|
||||
bool m_GameStarted = false;
|
||||
std::uint64_t m_StartTimerTime = 0;
|
||||
std::uint64_t m_StartTime = 0;
|
||||
std::vector<std::uint8_t> m_Players;
|
||||
utils::AutoTimer m_Timer;
|
||||
public:
|
||||
|
||||
@@ -7,17 +7,17 @@ namespace protocol {
|
||||
|
||||
class UpdateLobbyTimePacket : public Packet {
|
||||
private:
|
||||
std::uint32_t m_RemainingTime;
|
||||
std::uint64_t m_StartTime; // unix millis
|
||||
public:
|
||||
UpdateLobbyTimePacket() {}
|
||||
UpdateLobbyTimePacket(std::uint32_t remainingTime) : m_RemainingTime(remainingTime) {}
|
||||
UpdateLobbyTimePacket(std::uint64_t startTime) : m_StartTime(startTime) {}
|
||||
virtual ~UpdateLobbyTimePacket() {}
|
||||
|
||||
virtual DataBuffer Serialize(bool packetID = true) const;
|
||||
virtual void Deserialize(DataBuffer& data);
|
||||
virtual void Dispatch(PacketHandler* handler) const;
|
||||
|
||||
std::uint32_t GetRemainingTime() const { return m_RemainingTime; }
|
||||
std::uint64_t GetStartTime() const { return m_StartTime; }
|
||||
|
||||
virtual PacketType GetType() const { return PacketType::UpdateLobbyTime; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user