优化连接信息显示,调整无效状态的表示方式

This commit is contained in:
Ayndpa
2025-11-19 22:22:07 +08:00
parent c08a7753f3
commit e66f85576e

View File

@@ -275,7 +275,7 @@ int main()
auto getMemberConnectionInfo = [&](const CSteamID &memberID, const CSteamID &hostSteamID) -> std::pair<int, std::string> auto getMemberConnectionInfo = [&](const CSteamID &memberID, const CSteamID &hostSteamID) -> std::pair<int, std::string>
{ {
int ping = 0; int ping = 0;
std::string relayInfo = "N/A"; std::string relayInfo = "-";
if (steamManager.isHost()) if (steamManager.isHost())
{ {
@@ -350,7 +350,6 @@ int main()
// Poll events // Poll events
glfwPollEvents(); glfwPollEvents();
// Run Steam callbacks
SteamAPI_RunCallbacks(); SteamAPI_RunCallbacks();
// Update Steam networking info // Update Steam networking info
@@ -448,13 +447,13 @@ int main()
{ {
auto [ping, relayInfo] = getMemberConnectionInfo(memberID, hostSteamID); auto [ping, relayInfo] = getMemberConnectionInfo(memberID, hostSteamID);
if (relayInfo != "N/A") if (relayInfo != "-")
{ {
ImGui::Text("%d", ping); ImGui::Text("%d", ping);
} }
else else
{ {
ImGui::Text("N/A"); ImGui::Text("-");
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
ImGui::Text("%s", relayInfo.c_str()); ImGui::Text("%s", relayInfo.c_str());