Skip to content

Commit

Permalink
Hide stopwatch in cutscenes option, fixes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
xorus committed Oct 5, 2024
1 parent 8173ff5 commit d6d5151
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Plugin/Configuration/FloatingWindowConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class FloatingWindowConfiguration

[AutoField("Settings_FWTab_DisplayStopwatchOnlyInDuty")]
public bool StopwatchOnlyInDuty { get; set; } = false;

[AutoField("Settings_FWTab_HideInCutscenes")]
public bool HideInCutscenes { get; set; } = true;

[AutoField("Settings_FWTab_StopwatchAsSeconds")]
public bool StopwatchAsSeconds { get; set; } = false;
Expand Down
2 changes: 1 addition & 1 deletion Plugin/EngageTimer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AssemblyVersion>2.4.0.1</AssemblyVersion>
<AssemblyVersion>2.4.1.0</AssemblyVersion>
<Deterministic>false</Deterministic>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down
1 change: 1 addition & 0 deletions Plugin/Game/CountdownHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void Update()
if (_state.Mocked) return;
UpdateCountDown();
_state.InInstance = Plugin.Condition[ConditionFlag.BoundByDuty];
_state.InCutscene = Plugin.Condition[ConditionFlag.OccupiedInCutSceneEvent];
}

private void UpdateCountDown()
Expand Down
3 changes: 3 additions & 0 deletions Plugin/Properties/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -641,4 +641,7 @@ help text for the /eg settings command</comment>
<data name="Settings_FWTab_ForceHideWindowBorder" xml:space="preserve">
<value>Hide window border</value>
</data>
<data name="Settings_FWTab_HideInCutscenes" xml:space="preserve">
<value>Hide in cutscenes</value>
</data>
</root>
1 change: 1 addition & 0 deletions Plugin/Status/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class State
{
private bool _countingDown;
private bool _inCombat;
public bool InCutscene { get; set; }
public TimeSpan CombatDuration { get; set; }
public DateTime CombatEnd { get; set; }
public DateTime CombatStart { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Plugin/Ui/FloatingWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ private static bool StopwatchActive()
var displayStopwatch = Plugin.Config.FloatingWindow.EnableStopwatch;
if (!displayStopwatch) return false;

if (Plugin.Config.FloatingWindow.HideInCutscenes && Plugin.State.InCutscene) return false;

if (Plugin.Config.FloatingWindow.AutoHide &&
(DateTime.Now - Plugin.State.CombatEnd).TotalSeconds > Plugin.Config.FloatingWindow.AutoHideTimeout)
return false;
Expand Down
3 changes: 2 additions & 1 deletion Plugin/Ui/SettingsTab/FloatingWindowTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public static void Draw()
Components.AutoField(Plugin.Config.FloatingWindow, "Lock");
ImGuiComponents.HelpMarker(Strings.Settings_FWTab_Lock_Help);

Components.AutoField(Plugin.Config.FloatingWindow, "HideInCutscenes");
Components.AutoField(Plugin.Config.FloatingWindow, "AutoHide");
Components.AutoField(Plugin.Config.FloatingWindow, "AutoHideTimeout", sameLine: true);

Expand All @@ -51,7 +52,7 @@ public static void Draw()

Components.AutoField(Plugin.Config.FloatingWindow, "EnableStopwatch");
Components.AutoField(Plugin.Config.FloatingWindow, "DecimalStopwatchPrecision", sameLine: true);

ImGui.Separator();
if (ImGui.CollapsingHeader(Translator.TrId("Settings_FWTab_Styling"))) FwStyling();
ImGui.Separator();
Expand Down

0 comments on commit d6d5151

Please sign in to comment.