Skip to content

Commit

Permalink
Popup when LSO is in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed May 25, 2024
1 parent d0c4240 commit 38e6cff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CentrED/Map/MapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ public void Update(GameTime gameTime, bool isActive, bool processMouse, bool pro
{
if (CEDGame.Closing)
return;
if (CEDClient.ServerState != ServerState.Running)
return;

Metrics.Start("UpdateMap");
var mouseState = Mouse.GetState();
Keymap.Update(Keyboard.GetState());
Expand Down
28 changes: 28 additions & 0 deletions CentrED/UI/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ protected virtual void DrawUI()
ShowCrashInfo();
if (CEDGame.Closing)
return;
ServerStatePopup();

if (_resetLayout)
{
ImGui.LoadIniSettingsFromDisk("imgui.ini.default");
Expand Down Expand Up @@ -436,6 +438,32 @@ public void ShowCrashInfo()
}
}

private bool _showServerStatePopup;
public void ServerStatePopup()
{
if (CEDClient.ServerState != ServerState.Running)
{
ImGui.OpenPopup("ServerState");
_showServerStatePopup = true;
}
if (ImGui.BeginPopupModal
(
"ServerState",
ref _showServerStatePopup,
ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoTitleBar
))
{
ImGui.Text("Server is performing operation");
ImGui.Text($"State: {CEDClient.ServerState.ToString()}");
ImGui.Text($"Reason: {CEDClient.Status}");
if (CEDClient.ServerState == ServerState.Running)
{
ImGui.CloseCurrentPopup();
}
ImGui.EndPopup();
}
}

public static void DragInt(ReadOnlySpan<char> label, ref int value, float v_speed, int v_min, int v_max)
{
ImGui.PushItemWidth(50);
Expand Down

0 comments on commit 38e6cff

Please sign in to comment.