Skip to content

Commit 7a3b5e1

Browse files
Add Systems tab to DebugWindow
1 parent 0676b48 commit 7a3b5e1

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Pulsar4X/Pulsar4X.Client/Interface/Windows/Debug/DebugWindow.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ internal override void Display()
167167
{
168168
DisplayInfoTab();
169169
DisplayEntitiesTab();
170+
DisplaySystemsTab();
170171
DisplayInstanceProcessorsTab();
171172
DisplayHotLoopProcessorsTab();
172173

@@ -677,6 +678,56 @@ private void DisplayEntitiesTab()
677678
}
678679
}
679680

681+
private void DisplaySystemsTab()
682+
{
683+
if (_uiState.Game == null) return;
684+
685+
if (ImGui.BeginTabItem("Systems"))
686+
{
687+
var game = _uiState.Game;
688+
ImGui.Text($"Total Systems: {game.Systems.Count}");
689+
ImGui.Text($"Global Time: {game.TimePulse.GameGlobalDateTime.ToString(_uiState.GameSettings.GetDateTimeFormat())}");
690+
691+
int stasisCount = game.Systems.Count(s => s.ActivityState == SystemActivityState.Stasis);
692+
int bgCount = game.Systems.Count(s => s.ActivityState == SystemActivityState.Background);
693+
int fgCount = game.Systems.Count(s => s.ActivityState == SystemActivityState.Foreground);
694+
ImGui.Text($"Stasis: {stasisCount} Background: {bgCount} Foreground: {fgCount}");
695+
696+
ImGui.Separator();
697+
698+
if (ImGui.BeginTable("SystemsTable", 6, Styles.TableFlags))
699+
{
700+
ImGui.TableSetupColumn("System Name");
701+
ImGui.TableSetupColumn("Activity State");
702+
ImGui.TableSetupColumn("System Time");
703+
ImGui.TableSetupColumn("Time Lag");
704+
ImGui.TableSetupColumn("Entities");
705+
ImGui.TableSetupColumn("Freq Multiplier");
706+
ImGui.TableHeadersRow();
707+
708+
foreach (var system in game.Systems)
709+
{
710+
ImGui.TableNextRow();
711+
ImGui.TableSetColumnIndex(0);
712+
ImGui.Text(system.NameDB?.DefaultName ?? system.ID);
713+
ImGui.TableSetColumnIndex(1);
714+
ImGui.Text(system.ActivityState.ToString());
715+
ImGui.TableSetColumnIndex(2);
716+
ImGui.Text(system.StarSysDateTime.ToString(_uiState.GameSettings.GetDateTimeFormat()));
717+
ImGui.TableSetColumnIndex(3);
718+
var lag = game.TimePulse.GameGlobalDateTime - system.StarSysDateTime;
719+
ImGui.Text(lag.TotalSeconds > 0 ? lag.ToString() : "-");
720+
ImGui.TableSetColumnIndex(4);
721+
ImGui.Text(system.EntityCount.ToString());
722+
ImGui.TableSetColumnIndex(5);
723+
ImGui.Text(system.ManagerSubpulses.FrequencyMultiplier.ToString("F1"));
724+
}
725+
ImGui.EndTable();
726+
}
727+
ImGui.EndTabItem();
728+
}
729+
}
730+
680731
private void DisplayInfoTab()
681732
{
682733
if (ImGui.BeginTabItem("Info"))

0 commit comments

Comments
 (0)