Skip to content

Commit

Permalink
don't update dtr every tick
Browse files Browse the repository at this point in the history
  • Loading branch information
xorus committed Feb 12, 2022
1 parent a1a285c commit 5baccf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 1 addition & 2 deletions PluginUi.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using Dalamud.Game.Gui;
using Dalamud.Game.Gui.Dtr;
using Dalamud.Logging;
using Dalamud.Plugin;
using EngageTimer.UI;

Expand All @@ -23,11 +22,11 @@ DtrBar dtrBar
)
{
var numbers = new NumberTextures(configuration, pluginInterface.UiBuilder, pluginPath);
numbers.Load();
_countDown = new CountDown(configuration, state, gui, numbers, pluginPath);
_stopwatch = new FloatingWindow(configuration, state, pluginInterface);
_settings = new Settings(configuration, state, pluginInterface.UiBuilder, numbers);
_dtrBarUi = new DtrBarUi(configuration, state, dtrBar);
numbers.Load();
}

public void Draw()
Expand Down
16 changes: 10 additions & 6 deletions Ui/DtrBarUi.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using Dalamud.Game.Gui.Dtr;
using Dalamud.Game.Text.SeStringHandling;
using Dalamud.Game.Text.SeStringHandling.Payloads;
using Dalamud.Logging;

namespace EngageTimer.UI
Expand Down Expand Up @@ -77,12 +79,14 @@ public void Update()
}

if (!_entry.Shown) _entry.Shown = true;
_entry.Text = _configuration.DtrCombatTimePrefix +
(_configuration.DtrCombatTimeDecimalPrecision > 0
? _state.CombatDuration.ToString(@"mm\:ss\." + new string('f',
_configuration.DtrCombatTimeDecimalPrecision))
: _state.CombatDuration.ToString(@"mm\:ss"))
+ _configuration.DtrCombatTimeSuffix;

var seString = (SeString)(_configuration.DtrCombatTimePrefix +
(_configuration.DtrCombatTimeDecimalPrecision > 0
? _state.CombatDuration.ToString(@"mm\:ss\." + new string('f',
_configuration.DtrCombatTimeDecimalPrecision))
: _state.CombatDuration.ToString(@"mm\:ss"))
+ _configuration.DtrCombatTimeSuffix);
if (_entry.Text == null || !_entry.Text.Equals(seString)) _entry.Text = seString;
}

public void Dispose()
Expand Down

0 comments on commit 5baccf1

Please sign in to comment.