From 5baccf1099912c1edd335c1d8960d0ea419fe3e0 Mon Sep 17 00:00:00 2001 From: Xorus Date: Sat, 12 Feb 2022 11:41:39 +0100 Subject: [PATCH] don't update dtr every tick --- PluginUi.cs | 3 +-- Ui/DtrBarUi.cs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/PluginUi.cs b/PluginUi.cs index 3b0b84e..65efed0 100644 --- a/PluginUi.cs +++ b/PluginUi.cs @@ -1,7 +1,6 @@ using System; using Dalamud.Game.Gui; using Dalamud.Game.Gui.Dtr; -using Dalamud.Logging; using Dalamud.Plugin; using EngageTimer.UI; @@ -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() diff --git a/Ui/DtrBarUi.cs b/Ui/DtrBarUi.cs index 38b1957..255c1b8 100644 --- a/Ui/DtrBarUi.cs +++ b/Ui/DtrBarUi.cs @@ -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 @@ -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()