feat: add option to for timestamp visibility

This commit is contained in:
Anna 2021-04-15 12:25:56 -04:00
parent d7e43eb087
commit 5812395c75
2 changed files with 20 additions and 11 deletions

View File

@ -24,6 +24,7 @@ namespace PeepingTom {
public bool KeepHistory { get; set; } = true;
public bool HistoryWhenClosed { get; set; } = true;
public int NumHistory { get; set; } = 5;
public bool ShowTimestamps { get; set; } = true;
public bool LogParty { get; set; } = true;
public bool LogAlliance { get; set; }
@ -31,7 +32,7 @@ namespace PeepingTom {
public bool LogSelf { get; set; }
public bool FocusTargetOnHover { get; set; } = true;
public bool OpenExamine { get; set; } = false;
public bool OpenExamine { get; set; }
public bool PlaySoundOnTarget { get; set; }
public string? SoundPath { get; set; }

View File

@ -346,6 +346,12 @@ namespace PeepingTom {
this.Plugin.Config.Save();
}
var showTimestamps = this.Plugin.Config.ShowTimestamps;
if (ImGui.Checkbox("Show timestamps", ref showTimestamps)) {
this.Plugin.Config.ShowTimestamps = showTimestamps;
this.Plugin.Config.Save();
}
ImGui.EndTabItem();
}
@ -508,19 +514,21 @@ namespace PeepingTom {
ImGui.Selectable(targeter.Name, false, flags);
var time = DateTime.UtcNow - targeter.When >= TimeSpan.FromDays(1)
? targeter.When.ToLocalTime().ToString("dd/MM")
: targeter.When.ToLocalTime().ToString("t");
ImGui.SameLine(ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(time).X);
if (this.Plugin.Config.ShowTimestamps) {
var time = DateTime.UtcNow - targeter.When >= TimeSpan.FromDays(1)
? targeter.When.ToLocalTime().ToString("dd/MM")
: targeter.When.ToLocalTime().ToString("t");
ImGui.SameLine(ImGui.GetWindowContentRegionWidth() - ImGui.CalcTextSize(time).X);
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]);
}
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int) ImGuiCol.TextDisabled]);
}
ImGui.TextUnformatted(time);
ImGui.TextUnformatted(time);
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
ImGui.PopStyleColor();
if (flags.HasFlag(ImGuiSelectableFlags.Disabled)) {
ImGui.PopStyleColor();
}
}
ImGui.EndGroup();