mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 16:13:20 +08:00
Merge branch 'master' into online-overlay-login-placeholder
This commit is contained in:
commit
28550f19e8
@ -139,35 +139,43 @@ 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)
|
||||||
{
|
{
|
||||||
foreach (var newCol in newCollections)
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
{
|
|
||||||
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
|
||||||
if (existing == null)
|
|
||||||
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });
|
|
||||||
|
|
||||||
foreach (var newBeatmap in newCol.Beatmaps)
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (!existing.Beatmaps.Contains(newBeatmap))
|
foreach (var newCol in newCollections)
|
||||||
existing.Beatmaps.Add(newBeatmap);
|
{
|
||||||
|
var existing = Collections.FirstOrDefault(c => c.Name == newCol.Name);
|
||||||
|
if (existing == null)
|
||||||
|
Collections.Add(existing = new BeatmapCollection { Name = { Value = newCol.Name.Value } });
|
||||||
|
|
||||||
|
foreach (var newBeatmap in newCol.Beatmaps)
|
||||||
|
{
|
||||||
|
if (!existing.Beatmaps.Contains(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)
|
||||||
|
@ -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,40 +119,47 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
currentChannelContainer = new Container<DrawableChannel>
|
new OnlineViewContainer("Sign in to chat")
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Bottom = textbox_height
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = textbox_height,
|
|
||||||
Padding = new MarginPadding
|
|
||||||
{
|
|
||||||
Top = padding * 2,
|
|
||||||
Bottom = padding * 2,
|
|
||||||
Left = ChatLine.LEFT_PADDING + padding * 2,
|
|
||||||
Right = padding * 2,
|
|
||||||
},
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
textbox = new FocusedTextBox
|
currentChannelContainer = new Container<DrawableChannel>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 1,
|
Padding = new MarginPadding
|
||||||
PlaceholderText = "type your message",
|
{
|
||||||
ReleaseFocusOnCommit = false,
|
Bottom = textbox_height
|
||||||
HoldFocus = true,
|
},
|
||||||
}
|
},
|
||||||
}
|
new Container
|
||||||
},
|
{
|
||||||
loading = new LoadingSpinner(),
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = textbox_height,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Top = padding * 2,
|
||||||
|
Bottom = padding * 2,
|
||||||
|
Left = ChatLine.LEFT_PADDING + padding * 2,
|
||||||
|
Right = padding * 2,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
textbox = new FocusedTextBox
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Height = 1,
|
||||||
|
PlaceholderText = "type your message",
|
||||||
|
ReleaseFocusOnCommit = false,
|
||||||
|
HoldFocus = true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loading = new LoadingSpinner(),
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tabsArea = new TabsArea
|
tabsArea = new TabsArea
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user