Fixed displayed audio length in the AssetBrowser
This commit is contained in:
@@ -226,15 +226,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
var frameText = panel.GetOrNull<LabelWidget>("FRAME_COUNT");
|
||||||
if (frameText != null)
|
if (frameText != null)
|
||||||
{
|
{
|
||||||
var soundLength = new CachedTransform<int, string>(p =>
|
var soundLength = new CachedTransform<double, string>(p =>
|
||||||
modData.Translation.GetString(LengthInSeconds, Translation.Arguments("length", p)));
|
modData.Translation.GetString(LengthInSeconds, Translation.Arguments("length", Math.Round(p, 3))));
|
||||||
|
|
||||||
frameText.GetText = () =>
|
frameText.GetText = () =>
|
||||||
{
|
{
|
||||||
if (isVideoLoaded)
|
if (isVideoLoaded)
|
||||||
return $"{player.Video.CurrentFrameIndex + 1} / {player.Video.FrameCount}";
|
return $"{player.Video.CurrentFrameIndex + 1} / {player.Video.FrameCount}";
|
||||||
|
|
||||||
if (currentSoundFormat != null)
|
if (currentSoundFormat != null)
|
||||||
return soundLength.Update((int)currentSoundFormat.LengthInSeconds);
|
return soundLength.Update(currentSoundFormat.LengthInSeconds);
|
||||||
|
|
||||||
return $"{currentFrame} / {currentSprites.Length - 1}";
|
return $"{currentFrame} / {currentSprites.Length - 1}";
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user