mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into reduce-panel-width
This commit is contained in:
@ -61,20 +61,23 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
|
||||
Action = () =>
|
||||
{
|
||||
if (!downloader.Download())
|
||||
if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading)
|
||||
{
|
||||
Content.MoveToX(-5, 50, Easing.OutSine).Then()
|
||||
.MoveToX(5, 100, Easing.InOutSine).Then()
|
||||
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
||||
.MoveToX(0, 50, Easing.InSine);
|
||||
return;
|
||||
}
|
||||
|
||||
downloader.Download();
|
||||
};
|
||||
|
||||
downloader.Downloaded.ValueChanged += d =>
|
||||
downloader.DownloadState.ValueChanged += d =>
|
||||
{
|
||||
if (d)
|
||||
if (d == BeatmapSetDownloader.DownloadStatus.Downloaded)
|
||||
this.FadeOut(200);
|
||||
else
|
||||
else if (d == BeatmapSetDownloader.DownloadStatus.NotDownloaded)
|
||||
this.FadeIn(200);
|
||||
};
|
||||
}
|
||||
|
@ -168,11 +168,10 @@ namespace osu.Game.Overlays.Direct
|
||||
},
|
||||
new DownloadButton(SetInfo)
|
||||
{
|
||||
Size = new Vector2(30),
|
||||
Size = new Vector2(50, 30),
|
||||
Margin = new MarginPadding(horizontal_padding),
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Colour = colours.Gray5,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -120,8 +120,8 @@ namespace osu.Game.Overlays.Direct
|
||||
Alpha = 0,
|
||||
Child = new DownloadButton(SetInfo)
|
||||
{
|
||||
Size = new Vector2(height - vertical_padding * 2),
|
||||
Margin = new MarginPadding { Left = vertical_padding },
|
||||
Size = new Vector2(height - vertical_padding * 3),
|
||||
Margin = new MarginPadding { Left = vertical_padding, Right = vertical_padding },
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
|
@ -99,6 +99,7 @@ namespace osu.Game.Overlays.Direct
|
||||
attachDownload(downloadRequest);
|
||||
|
||||
beatmaps.BeatmapDownloadBegan += attachDownload;
|
||||
beatmaps.ItemAdded += setAdded;
|
||||
}
|
||||
|
||||
public override bool DisposeOnDeathRemoval => true;
|
||||
@ -107,6 +108,7 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
beatmaps.BeatmapDownloadBegan -= attachDownload;
|
||||
beatmaps.ItemAdded -= setAdded;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -171,6 +173,12 @@ namespace osu.Game.Overlays.Direct
|
||||
};
|
||||
}
|
||||
|
||||
private void setAdded(BeatmapSetInfo s)
|
||||
{
|
||||
if (s.OnlineBeatmapSetID == SetInfo.OnlineBeatmapSetID)
|
||||
progressBar.FadeOut(500);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
@ -1,76 +1,109 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class DownloadButton : OsuClickableContainer
|
||||
public class DownloadButton : OsuAnimatedButton
|
||||
{
|
||||
private readonly SpriteIcon icon;
|
||||
private readonly SpriteIcon checkmark;
|
||||
private readonly BeatmapSetDownloader downloader;
|
||||
private readonly Box background;
|
||||
|
||||
private OsuColour colours;
|
||||
|
||||
public DownloadButton(BeatmapSetInfo set, bool noVideo = false)
|
||||
{
|
||||
BeatmapSetDownloader downloader;
|
||||
Children = new Drawable[]
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
downloader = new BeatmapSetDownloader(set, noVideo),
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue
|
||||
},
|
||||
icon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(30),
|
||||
Icon = FontAwesome.fa_osu_chevron_down_o,
|
||||
Size = new Vector2(13),
|
||||
Icon = FontAwesome.fa_download,
|
||||
},
|
||||
};
|
||||
checkmark = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
X = 8,
|
||||
Size = Vector2.Zero,
|
||||
Icon = FontAwesome.fa_check,
|
||||
}
|
||||
});
|
||||
|
||||
Action = () =>
|
||||
{
|
||||
if (!downloader.Download())
|
||||
if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloading)
|
||||
{
|
||||
// todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged.
|
||||
Content.MoveToX(-5, 50, Easing.OutSine).Then()
|
||||
.MoveToX(5, 100, Easing.InOutSine).Then()
|
||||
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
||||
.MoveToX(0, 50, Easing.InSine);
|
||||
}
|
||||
};
|
||||
|
||||
downloader.Downloaded.ValueChanged += d =>
|
||||
{
|
||||
if (d)
|
||||
this.FadeOut(200);
|
||||
else if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloaded)
|
||||
{
|
||||
// TODO: Jump to song select with this set when the capability is implemented
|
||||
}
|
||||
else
|
||||
this.FadeIn(200);
|
||||
{
|
||||
downloader.Download();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
icon.ScaleTo(0.9f, 1000, Easing.Out);
|
||||
return base.OnMouseDown(state, args);
|
||||
base.LoadComplete();
|
||||
downloader.DownloadState.BindValueChanged(updateState, true);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
icon.ScaleTo(1f, 500, Easing.OutElastic);
|
||||
return base.OnMouseUp(state, args);
|
||||
this.colours = colours;
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
private void updateState(BeatmapSetDownloader.DownloadStatus state)
|
||||
{
|
||||
icon.ScaleTo(1.1f, 500, Easing.OutElastic);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
switch (state)
|
||||
{
|
||||
case BeatmapSetDownloader.DownloadStatus.NotDownloaded:
|
||||
background.FadeColour(colours.Gray4, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
break;
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
icon.ScaleTo(1f, 500, Easing.OutElastic);
|
||||
case BeatmapSetDownloader.DownloadStatus.Downloading:
|
||||
background.FadeColour(colours.Blue, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(0, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo);
|
||||
break;
|
||||
|
||||
case BeatmapSetDownloader.DownloadStatus.Downloaded:
|
||||
background.FadeColour(colours.Green, 500, Easing.InOutExpo);
|
||||
icon.MoveToX(-8, 500, Easing.InOutExpo);
|
||||
checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +142,14 @@ namespace osu.Game.Overlays
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new[]
|
||||
{
|
||||
prevButton = new IconButton
|
||||
prevButton = new MusicIconButton
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Action = prev,
|
||||
Icon = FontAwesome.fa_step_backward,
|
||||
},
|
||||
playButton = new IconButton
|
||||
playButton = new MusicIconButton
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -158,7 +158,7 @@ namespace osu.Game.Overlays
|
||||
Action = play,
|
||||
Icon = FontAwesome.fa_play_circle_o,
|
||||
},
|
||||
nextButton = new IconButton
|
||||
nextButton = new MusicIconButton
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -167,7 +167,7 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
}
|
||||
},
|
||||
playlistButton = new IconButton
|
||||
playlistButton = new MusicIconButton
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.CentreRight,
|
||||
@ -405,6 +405,16 @@ namespace osu.Game.Overlays
|
||||
Prev
|
||||
}
|
||||
|
||||
private class MusicIconButton : IconButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
HoverColour = colours.YellowDark.Opacity(0.6f);
|
||||
FlashColour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
private class Background : BufferedContainer
|
||||
{
|
||||
private readonly Sprite sprite;
|
||||
|
@ -128,7 +128,8 @@ namespace osu.Game.Overlays
|
||||
var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType)));
|
||||
section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth);
|
||||
|
||||
State = Visibility.Visible;
|
||||
if (notification.IsImportant)
|
||||
State = Visibility.Visible;
|
||||
|
||||
updateCounts();
|
||||
});
|
||||
|
@ -23,6 +23,11 @@ namespace osu.Game.Overlays.Notifications
|
||||
/// </summary>
|
||||
public event Action Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this notification should forcefully display itself.
|
||||
/// </summary>
|
||||
public virtual bool IsImportant => true;
|
||||
|
||||
/// <summary>
|
||||
/// Run on user activating the notification. Return true to close.
|
||||
/// </summary>
|
||||
|
@ -118,9 +118,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
|
||||
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
|
||||
Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight,
|
||||
Origin = TooltipAnchor,
|
||||
Position = new Vector2((TooltipAnchor & Anchor.x0) > 0 ? 5 : -5, 5),
|
||||
Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5),
|
||||
Alpha = 0,
|
||||
Children = new[]
|
||||
{
|
||||
|
Reference in New Issue
Block a user