Load removed, online user centred

This commit is contained in:
xPumaa
2022-08-06 11:06:31 +02:00
parent e404d3a093
commit 88aec40e69

View File

@@ -289,34 +289,27 @@ namespace MareSynchronos.UI
private void DrawServerStatus() private void DrawServerStatus()
{ {
var originalY = ImGui.GetCursorPosY();
var buttonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Link); var buttonSize = UiShared.GetIconButtonSize(FontAwesomeIcon.Link);
var textSize = ImGui.CalcTextSize("%"); var userCount = _apiController.OnlineUsers.ToString();
var textPos = originalY + buttonSize.Y / 2 - textSize.Y / 2; var userSize = ImGui.CalcTextSize(userCount);
var textSize = ImGui.CalcTextSize("Users Online");
if (_apiController.ServerState is ServerState.Connected) if (_apiController.ServerState is ServerState.Connected)
{ {
ImGui.SetCursorPosY(textPos); ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - buttonSize.X) / 2 - (userSize.X + textSize.X) / 2);
ImGui.TextColored(ImGuiColors.ParsedGreen, _apiController.OnlineUsers.ToString()); ImGui.AlignTextToFramePadding();
ImGui.TextColored(ImGuiColors.ParsedGreen, userCount);
ImGui.SameLine(); ImGui.SameLine();
ImGui.SetCursorPosY(textPos); ImGui.AlignTextToFramePadding();
ImGui.Text("Users Online"); ImGui.Text("Users Online");
ImGui.SameLine();
ImGui.SetCursorPosY(textPos);
UiShared.ColorText(_apiController.SystemInfoDto.CpuUsage.ToString("0.00") + "%", UiShared.GetCpuLoadColor(_apiController.SystemInfoDto.CpuUsage));
ImGui.SameLine();
ImGui.SetCursorPosY(textPos);
ImGui.Text("Load");
UiShared.AttachToolTip("This is the current servers' CPU load");
} }
else else
{ {
ImGui.SetCursorPosY(textPos); ImGui.AlignTextToFramePadding();
ImGui.TextColored(ImGuiColors.DalamudRed, "Not connected to any server"); ImGui.TextColored(ImGuiColors.DalamudRed, "Not connected to any server");
} }
ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - buttonSize.X); ImGui.SameLine(ImGui.GetWindowContentRegionMin().X + UiShared.GetWindowContentRegionWidth() - buttonSize.X);
ImGui.SetCursorPosY(originalY);
var color = UiShared.GetBoolColor(!_configuration.FullPause); var color = UiShared.GetBoolColor(!_configuration.FullPause);
var connectedIcon = !_configuration.FullPause ? FontAwesomeIcon.Link : FontAwesomeIcon.Unlink; var connectedIcon = !_configuration.FullPause ? FontAwesomeIcon.Link : FontAwesomeIcon.Unlink;