mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 14:17:06 +09:00
Introduce PreviewTrack class
This commit is contained in:
@ -2,13 +2,13 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
private readonly Box bg, progress;
|
||||
private readonly PlayButton playButton;
|
||||
|
||||
private Track preview => playButton.Preview;
|
||||
private PreviewTrack preview => playButton.Preview;
|
||||
public Bindable<bool> Playing => playButton.Playing;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
if (Playing.Value && preview != null)
|
||||
{
|
||||
// prevent negative (potential infinite) width if a track without length was loaded
|
||||
progress.Width = preview.Length > 0 ? (float)(preview.CurrentTime / preview.Length) : 0f;
|
||||
progress.Width = preview.Track.Length > 0 ? (float)(preview.Track.CurrentTime / preview.Track.Length) : 0f;
|
||||
}
|
||||
else
|
||||
progress.Width = 0;
|
||||
|
Reference in New Issue
Block a user