Change Lobby timer

This commit is contained in:
2023-08-12 12:22:36 +02:00
parent b4836847f5
commit 0a814233a4
8 changed files with 27 additions and 24 deletions

View File

@@ -73,10 +73,12 @@ void GameMenu::ShowTeamSelection() {
}
void GameMenu::ShowLobbyProgress() {
const int timePassed = server::Lobby::LobbyWaitingTime - GetClient()->GetGame().GetLobbyTime();
const float progress = (float)timePassed / (float)(server::Lobby::LobbyWaitingTime);
const std::uint64_t waitTime = GetClient()->GetGame().GetGameStartTime() - GetClient()->GetGame().GetLobbyStartTime();
const std::uint64_t timeRemaining = GetClient()->GetGame().GetGameStartTime() - utils::GetTime();
const float progress = static_cast<float>(timeRemaining) / static_cast<float>(waitTime);
if (progress > 0 && progress < 1) {
ImGui::ProgressBar(progress, ImVec2(0.0f, 0.0f), std::string(std::to_string(GetClient()->GetGame().GetLobbyTime() / 1000) + "s").c_str());
ImGui::ProgressBar(1.0f - progress, ImVec2(0.0f, 0.0f), std::string(std::to_string(timeRemaining / 1000) + "s").c_str());
ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
ImGui::Text("Time Remaining");
} else {
@@ -86,7 +88,7 @@ void GameMenu::ShowLobbyProgress() {
void GameMenu::ShowTPS() {
ImGui::Text("Server TPS : %.1f", GetClient()->GetConnexion().GetServerTPS());
ImGui::Text("Server MSPT : %i", (int)GetClient()->GetConnexion().GetServerMSPT());
ImGui::Text("Server MSPT : %i", static_cast<int>(GetClient()->GetConnexion().GetServerMSPT()));
ImGui::Text("Server Ping : %i", GetClient()->GetConnexion().GetServerPing());
}