From 3a4fb2ffedd25cf4945771673b45747dfef4142c Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Thu, 1 Dec 2016 08:20:24 +0800 Subject: [PATCH] IsEnabled property for drag bar of music controller. --- osu.Game/Overlays/DragBar.cs | 15 ++++++++++++++- osu.Game/Overlays/MusicController.cs | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index ee54d21d74..32a1ed4933 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -16,6 +16,18 @@ namespace osu.Game.Overlays public Action SeekRequested; private bool isDragging; + private bool enabled; + public bool IsEnabled + { + get { return enabled; } + set + { + enabled = value; + if (!enabled) + fill.Width = 0; + } + } + public DragBar() { RelativeSizeAxes = Axes.X; @@ -34,13 +46,14 @@ namespace osu.Game.Overlays public void UpdatePosition(float position) { - if (isDragging) return; + if (isDragging || !IsEnabled) return; fill.Width = position; } private void seek(InputState state) { + if (!IsEnabled) return; float seekLocation = state.Mouse.Position.X / DrawWidth; SeekRequested?.Invoke(seekLocation); fill.Width = seekLocation; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e8be9efb1b..c69624bfda 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -240,6 +240,7 @@ namespace osu.Game.Overlays private void workingChanged(object sender = null, EventArgs e = null) { + progress.IsEnabled = (beatmapSource.Value != null); if (beatmapSource.Value == current) return; bool audioEquals = current?.BeatmapInfo.AudioEquals(beatmapSource.Value.BeatmapInfo) ?? false; current = beatmapSource.Value;