add client disconnect button
This commit is contained in:
@@ -18,6 +18,8 @@ private:
|
|||||||
void ShowPlayers();
|
void ShowPlayers();
|
||||||
void ShowLobbyProgress();
|
void ShowLobbyProgress();
|
||||||
void ShowTeamSelection();
|
void ShowTeamSelection();
|
||||||
|
|
||||||
|
void DisconnectButton();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ void Client::CloseConnection() {
|
|||||||
|
|
||||||
protocol::DisconnectPacket packet;
|
protocol::DisconnectPacket packet;
|
||||||
m_Connexion.SendPacket(&packet);
|
m_Connexion.SendPacket(&packet);
|
||||||
|
|
||||||
|
m_Game->SetGameState(game::GameState::Disconnected);
|
||||||
|
m_Connexion.CloseConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Tick(std::uint64_t delta) {
|
void Client::Tick(std::uint64_t delta) {
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ void GameMenu::Render() {
|
|||||||
ShowPlayers();
|
ShowPlayers();
|
||||||
ShowLobbyProgress();
|
ShowLobbyProgress();
|
||||||
ShowTeamSelection();
|
ShowTeamSelection();
|
||||||
|
ImGui::Separator();
|
||||||
|
DisconnectButton();
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@@ -33,6 +35,8 @@ void GameMenu::Render() {
|
|||||||
ShowTPS();
|
ShowTPS();
|
||||||
ShowStats();
|
ShowStats();
|
||||||
ShowPlayers();
|
ShowPlayers();
|
||||||
|
ImGui::Separator();
|
||||||
|
DisconnectButton();
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
@@ -95,5 +99,11 @@ void GameMenu::ShowStats() {
|
|||||||
ImGui::Text("EXP: %i", GetClient()->GetGame().GetPlayer()->GetExp());
|
ImGui::Text("EXP: %i", GetClient()->GetGame().GetPlayer()->GetExp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GameMenu::DisconnectButton() {
|
||||||
|
if (ImGui::Button("Disconnect")) {
|
||||||
|
m_Client->CloseConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
|||||||
Reference in New Issue
Block a user