From e1a7fb1cc821338a5856a3da115280d0f03e79b2 Mon Sep 17 00:00:00 2001 From: penev92 Date: Mon, 20 Feb 2023 12:13:05 +0200 Subject: [PATCH] Fixed displayed audio length in the AssetBrowser --- OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs index 66688dce47..d70e8ff44e 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/AssetBrowserLogic.cs @@ -226,15 +226,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic var frameText = panel.GetOrNull("FRAME_COUNT"); if (frameText != null) { - var soundLength = new CachedTransform(p => - modData.Translation.GetString(LengthInSeconds, Translation.Arguments("length", p))); + var soundLength = new CachedTransform(p => + modData.Translation.GetString(LengthInSeconds, Translation.Arguments("length", Math.Round(p, 3)))); + frameText.GetText = () => { if (isVideoLoaded) return $"{player.Video.CurrentFrameIndex + 1} / {player.Video.FrameCount}"; if (currentSoundFormat != null) - return soundLength.Update((int)currentSoundFormat.LengthInSeconds); + return soundLength.Update(currentSoundFormat.LengthInSeconds); return $"{currentFrame} / {currentSprites.Length - 1}"; };