1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 16:23:16 +08:00

Merge branch 'master' into online-overlay-login-placeholder

This commit is contained in:
Dan Balasescu 2021-02-19 10:06:25 +09:00 committed by GitHub
commit 28550f19e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 51 deletions

View File

@ -139,22 +139,19 @@ namespace osu.Game.Collections
PostNotification?.Invoke(notification); PostNotification?.Invoke(notification);
var collection = readCollections(stream, notification); var collection = readCollections(stream, notification);
bool importCompleted = false; await importCollections(collection);
Schedule(() =>
{
importCollections(collection);
importCompleted = true;
});
while (!IsDisposed && !importCompleted)
await Task.Delay(10);
notification.CompletionText = $"Imported {collection.Count} collections"; notification.CompletionText = $"Imported {collection.Count} collections";
notification.State = ProgressNotificationState.Completed; notification.State = ProgressNotificationState.Completed;
} }
private void importCollections(List<BeatmapCollection> newCollections) private Task importCollections(List<BeatmapCollection> newCollections)
{
var tcs = new TaskCompletionSource<bool>();
Schedule(() =>
{
try
{ {
foreach (var newCol in newCollections) foreach (var newCol in newCollections)
{ {
@ -168,6 +165,17 @@ namespace osu.Game.Collections
existing.Beatmaps.Add(newBeatmap); existing.Beatmaps.Add(newBeatmap);
} }
} }
tcs.SetResult(true);
}
catch (Exception e)
{
Logger.Error(e, "Failed to import collection.");
tcs.SetException(e);
}
});
return tcs.Task;
} }
private List<BeatmapCollection> readCollections(Stream stream, ProgressNotification notification = null) private List<BeatmapCollection> readCollections(Stream stream, ProgressNotification notification = null)

View File

@ -24,6 +24,7 @@ using osu.Game.Overlays.Chat.Tabs;
using osuTK.Input; using osuTK.Input;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Online;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -118,6 +119,11 @@ namespace osu.Game.Overlays
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new OnlineViewContainer("Sign in to chat")
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
currentChannelContainer = new Container<DrawableChannel> currentChannelContainer = new Container<DrawableChannel>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -152,6 +158,8 @@ namespace osu.Game.Overlays
} }
}, },
loading = new LoadingSpinner(), loading = new LoadingSpinner(),
},
}
} }
}, },
tabsArea = new TabsArea tabsArea = new TabsArea

View File

@ -25,8 +25,13 @@ namespace osu.Game.Screens.Select.Carousel
public readonly Bindable<CarouselItemState> State = new Bindable<CarouselItemState>(CarouselItemState.NotSelected); public readonly Bindable<CarouselItemState> State = new Bindable<CarouselItemState>(CarouselItemState.NotSelected);
private readonly HoverLayer hoverLayer;
protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both };
private const float corner_radius = 10;
private const float border_thickness = 2.5f;
public CarouselHeader() public CarouselHeader()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -36,12 +41,12 @@ namespace osu.Game.Screens.Select.Carousel
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Masking = true, Masking = true,
CornerRadius = 10, CornerRadius = corner_radius,
BorderColour = new Color4(221, 255, 255, 255), BorderColour = new Color4(221, 255, 255, 255),
Children = new Drawable[] Children = new Drawable[]
{ {
Content, Content,
new HoverLayer() hoverLayer = new HoverLayer()
} }
}; };
} }
@ -59,6 +64,8 @@ namespace osu.Game.Screens.Select.Carousel
{ {
case CarouselItemState.Collapsed: case CarouselItemState.Collapsed:
case CarouselItemState.NotSelected: case CarouselItemState.NotSelected:
hoverLayer.InsetForBorder = false;
BorderContainer.BorderThickness = 0; BorderContainer.BorderThickness = 0;
BorderContainer.EdgeEffect = new EdgeEffectParameters BorderContainer.EdgeEffect = new EdgeEffectParameters
{ {
@ -70,7 +77,9 @@ namespace osu.Game.Screens.Select.Carousel
break; break;
case CarouselItemState.Selected: case CarouselItemState.Selected:
BorderContainer.BorderThickness = 2.5f; hoverLayer.InsetForBorder = true;
BorderContainer.BorderThickness = border_thickness;
BorderContainer.EdgeEffect = new EdgeEffectParameters BorderContainer.EdgeEffect = new EdgeEffectParameters
{ {
Type = EdgeEffectType.Glow, Type = EdgeEffectType.Glow,
@ -107,6 +116,26 @@ namespace osu.Game.Screens.Select.Carousel
sampleHover = audio.Samples.Get("SongSelect/song-ping"); sampleHover = audio.Samples.Get("SongSelect/song-ping");
} }
public bool InsetForBorder
{
set
{
if (value)
{
// apply same border as above to avoid applying additive overlay to it (and blowing out the colour).
Masking = true;
CornerRadius = corner_radius;
BorderThickness = border_thickness;
}
else
{
BorderThickness = 0;
CornerRadius = 0;
Masking = false;
}
}
}
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
box.FadeIn(100, Easing.OutQuint); box.FadeIn(100, Easing.OutQuint);