1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Merge branch 'master' into overlay-header-padding

This commit is contained in:
Dean Herbert 2020-07-22 16:22:20 +09:00 committed by GitHub
commit 11f48ee4db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 67 deletions

View File

@ -30,12 +30,6 @@ namespace osu.Game.Tests.Visual.Online
Add(selector = new SpotlightSelector()); Add(selector = new SpotlightSelector());
} }
[Test]
public void TestVisibility()
{
AddStep("Toggle Visibility", selector.ToggleVisibility);
}
[Test] [Test]
public void TestLocalSpotlights() public void TestLocalSpotlights()
{ {

View File

@ -18,10 +18,8 @@ using osu.Game.Online.API.Requests;
namespace osu.Game.Overlays.Rankings namespace osu.Game.Overlays.Rankings
{ {
public class SpotlightSelector : VisibilityContainer, IHasCurrentValue<APISpotlight> public class SpotlightSelector : CompositeDrawable, IHasCurrentValue<APISpotlight>
{ {
private const int duration = 300;
private readonly BindableWithCurrent<APISpotlight> current = new BindableWithCurrent<APISpotlight>(); private readonly BindableWithCurrent<APISpotlight> current = new BindableWithCurrent<APISpotlight>();
public readonly Bindable<RankingsSortCriteria> Sort = new Bindable<RankingsSortCriteria>(); public readonly Bindable<RankingsSortCriteria> Sort = new Bindable<RankingsSortCriteria>();
@ -37,10 +35,7 @@ namespace osu.Game.Overlays.Rankings
set => dropdown.Items = value; set => dropdown.Items = value;
} }
protected override bool StartHidden => true;
private readonly Box background; private readonly Box background;
private readonly Container content;
private readonly SpotlightsDropdown dropdown; private readonly SpotlightsDropdown dropdown;
private readonly InfoColumn startDateColumn; private readonly InfoColumn startDateColumn;
private readonly InfoColumn endDateColumn; private readonly InfoColumn endDateColumn;
@ -51,73 +46,68 @@ namespace osu.Game.Overlays.Rankings
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
Add(content = new Container InternalChildren = new Drawable[]
{ {
RelativeSizeAxes = Axes.X, background = new Box
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{ {
background = new Box RelativeSizeAxes = Axes.Both,
{ },
RelativeSizeAxes = Axes.Both, new Container
}, {
new Container RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN },
Child = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN }, Direction = FillDirection.Vertical,
Child = new FillFlowContainer Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.X, new Container
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
new Container Margin = new MarginPadding { Vertical = 20 },
{ RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Vertical = 20 }, Height = 40,
RelativeSizeAxes = Axes.X, Depth = -float.MaxValue,
Height = 40, Child = dropdown = new SpotlightsDropdown
Depth = -float.MaxValue,
Child = dropdown = new SpotlightsDropdown
{
RelativeSizeAxes = Axes.X,
Current = Current
}
},
new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, Current = Current
Children = new Drawable[] }
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new FillFlowContainer
{ {
new FillFlowContainer AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Margin = new MarginPadding { Bottom = 5 },
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.Both, startDateColumn = new InfoColumn(@"Start Date"),
Direction = FillDirection.Horizontal, endDateColumn = new InfoColumn(@"End Date"),
Spacing = new Vector2(10, 0), mapCountColumn = new InfoColumn(@"Map Count"),
Margin = new MarginPadding { Bottom = 5 }, participantsColumn = new InfoColumn(@"Participants")
Children = new Drawable[]
{
startDateColumn = new InfoColumn(@"Start Date"),
endDateColumn = new InfoColumn(@"End Date"),
mapCountColumn = new InfoColumn(@"Map Count"),
participantsColumn = new InfoColumn(@"Participants")
}
},
new RankingsSortTabControl
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Current = Sort
} }
},
new RankingsSortTabControl
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Current = Sort
} }
} }
} }
} }
} }
} }
}); };
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -134,10 +124,6 @@ namespace osu.Game.Overlays.Rankings
participantsColumn.Value = response.Spotlight.Participants?.ToString("N0"); participantsColumn.Value = response.Spotlight.Participants?.ToString("N0");
} }
protected override void PopIn() => content.FadeIn(duration, Easing.OutQuint);
protected override void PopOut() => content.FadeOut(duration, Easing.OutQuint);
private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd"); private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd");
private class InfoColumn : FillFlowContainer private class InfoColumn : FillFlowContainer

View File

@ -81,8 +81,6 @@ namespace osu.Game.Overlays.Rankings
{ {
base.LoadComplete(); base.LoadComplete();
selector.Show();
selectedSpotlight.BindValueChanged(_ => onSpotlightChanged()); selectedSpotlight.BindValueChanged(_ => onSpotlightChanged());
sort.BindValueChanged(_ => onSpotlightChanged()); sort.BindValueChanged(_ => onSpotlightChanged());
Ruleset.BindValueChanged(onRulesetChanged); Ruleset.BindValueChanged(onRulesetChanged);