Gameplay Stats Tweaks (#2379)
* persist stat tracker across sessions * fix tab spaces * configurable gameplay stats display * streamline to use AddWindow method
This commit is contained in:
parent
7a75fe8411
commit
ec4cee787c
|
@ -120,6 +120,9 @@ void DrawStatsTracker(bool& open) {
|
|||
return;
|
||||
}
|
||||
|
||||
bool showTimestamps = (CVarGetInteger("gGameplayStatsMode", 0) <= 1);
|
||||
bool showCounts = ( (CVarGetInteger("gGameplayStatsMode", 0) == 0) || (CVarGetInteger("gGameplayStatsMode", 0) == 2) );
|
||||
|
||||
u32 totalTimer = GAMEPLAYSTAT_TOTAL_TIME;
|
||||
u32 enemiesDefeated = 0;
|
||||
u32 ammoUsed = 0;
|
||||
|
@ -168,12 +171,18 @@ void DrawStatsTracker(bool& open) {
|
|||
ImGui::EndTable();
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 8.0f, 8.0f });
|
||||
ImGui::BeginTable("gameStatsTable", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
|
||||
ImGui::BeginTable("gameStatsTable", (showTimestamps && showCounts) ? 2 : 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV);
|
||||
|
||||
if (showTimestamps) {
|
||||
ImGui::TableSetupColumn("Timestamps", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
}
|
||||
if (showCounts) {
|
||||
ImGui::TableSetupColumn("Counts", ImGuiTableColumnFlags_WidthStretch, 200.0f);
|
||||
}
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::TableNextRow();
|
||||
|
||||
if (showTimestamps) {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
// Display chronological timestamps of items obtained and bosses defeated
|
||||
|
@ -183,7 +192,9 @@ void DrawStatsTracker(bool& open) {
|
|||
DisplayTimeHHMMSS(timestampDisplay[i].time, timestampDisplay[i].name, timestampDisplay[i].color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showCounts) {
|
||||
ImGui::TableNextColumn();
|
||||
|
||||
DisplayStat("Enemies Defeated: ", enemiesDefeated);
|
||||
|
@ -330,10 +341,18 @@ void DrawStatsTracker(bool& open) {
|
|||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PopStyleVar(1);
|
||||
ImGui::EndTable();
|
||||
|
||||
const char* gameplayStatsModeOptions[3] = { "Both", "Timestamps", "Counts"};
|
||||
|
||||
ImGui::Text("Display Mode");
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
|
||||
UIWidgets::EnhancementCombobox("gGameplayStatsMode", gameplayStatsModeOptions, 3, 0);
|
||||
|
||||
ImGui::Text("Note: Gameplay stats are saved to the current file and will be\nlost if you quit without saving.");
|
||||
|
||||
ImGui::End();
|
||||
|
@ -482,7 +501,7 @@ void SetupDisplayColors() {
|
|||
}
|
||||
|
||||
void InitStatTracker() {
|
||||
SohImGui::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker);
|
||||
SohImGui::AddWindow("Enhancements", "Gameplay Stats", DrawStatsTracker, CVarGetInteger("gGameplayStatsEnabled", 0) == 1);
|
||||
SetupDisplayNames();
|
||||
SetupDisplayColors();
|
||||
}
|
Loading…
Reference in New Issue