mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 12:57:25 +08:00
Make DownloadButton accessible by DirectPanel
This commit is contained in:
parent
efd9766fb3
commit
a069a3029e
@ -25,9 +25,11 @@ namespace osu.Game.Overlays.Direct
|
|||||||
private const float vertical_padding = 5;
|
private const float vertical_padding = 5;
|
||||||
|
|
||||||
private FillFlowContainer bottomPanel, statusContainer;
|
private FillFlowContainer bottomPanel, statusContainer;
|
||||||
|
private DownloadButton downloadButton;
|
||||||
private PlayButton playButton;
|
private PlayButton playButton;
|
||||||
private Box progressBar;
|
private Box progressBar;
|
||||||
|
|
||||||
|
public override DownloadButton DownloadButton => downloadButton;
|
||||||
protected override PlayButton PlayButton => playButton;
|
protected override PlayButton PlayButton => playButton;
|
||||||
protected override Box PreviewBar => progressBar;
|
protected override Box PreviewBar => progressBar;
|
||||||
|
|
||||||
@ -155,7 +157,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new DownloadButton(SetInfo)
|
downloadButton = new DownloadButton(SetInfo)
|
||||||
{
|
{
|
||||||
Size = new Vector2(50, 30),
|
Size = new Vector2(50, 30),
|
||||||
Margin = new MarginPadding(horizontal_padding),
|
Margin = new MarginPadding(horizontal_padding),
|
||||||
|
@ -27,11 +27,13 @@ namespace osu.Game.Overlays.Direct
|
|||||||
private const float height = 70;
|
private const float height = 70;
|
||||||
|
|
||||||
private FillFlowContainer statusContainer;
|
private FillFlowContainer statusContainer;
|
||||||
|
private DownloadButton downloadButton;
|
||||||
private PlayButton playButton;
|
private PlayButton playButton;
|
||||||
private Box progressBar;
|
private Box progressBar;
|
||||||
|
|
||||||
protected override bool FadePlayButton => false;
|
protected override bool FadePlayButton => false;
|
||||||
|
|
||||||
|
public override DownloadButton DownloadButton => downloadButton;
|
||||||
protected override PlayButton PlayButton => playButton;
|
protected override PlayButton PlayButton => playButton;
|
||||||
protected override Box PreviewBar => progressBar;
|
protected override Box PreviewBar => progressBar;
|
||||||
|
|
||||||
@ -149,7 +151,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Child = new DownloadButton(SetInfo)
|
Child = downloadButton = new DownloadButton(SetInfo)
|
||||||
{
|
{
|
||||||
Size = new Vector2(height - vertical_padding * 3),
|
Size = new Vector2(height - vertical_padding * 3),
|
||||||
Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding },
|
Margin = new MarginPadding { Left = vertical_padding * 2, Right = vertical_padding },
|
||||||
|
@ -34,6 +34,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
public PreviewTrack Preview => PlayButton.Preview;
|
public PreviewTrack Preview => PlayButton.Preview;
|
||||||
public Bindable<bool> PreviewPlaying => PlayButton.Playing;
|
public Bindable<bool> PreviewPlaying => PlayButton.Playing;
|
||||||
|
public abstract DownloadButton DownloadButton { get; }
|
||||||
protected abstract PlayButton PlayButton { get; }
|
protected abstract PlayButton PlayButton { get; }
|
||||||
protected abstract Box PreviewBar { get; }
|
protected abstract Box PreviewBar { get; }
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -26,6 +27,8 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
private readonly OsuAnimatedButton button;
|
private readonly OsuAnimatedButton button;
|
||||||
|
|
||||||
|
public readonly BindableBool Enabled = new BindableBool(true);
|
||||||
|
|
||||||
public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
|
||||||
: base(beatmapSet)
|
: base(beatmapSet)
|
||||||
{
|
{
|
||||||
@ -62,6 +65,8 @@ namespace osu.Game.Overlays.Direct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Enabled.BindTo(button.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -79,7 +84,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
|
||||||
{
|
{
|
||||||
button.Enabled.Value = false;
|
Enabled.Value = false;
|
||||||
button.TooltipText = "Unavailable";
|
button.TooltipText = "Unavailable";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user