1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 02:07:34 +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());
}
[Test]
public void TestVisibility()
{
AddStep("Toggle Visibility", selector.ToggleVisibility);
}
[Test]
public void TestLocalSpotlights()
{

View File

@ -18,10 +18,8 @@ using osu.Game.Online.API.Requests;
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>();
public readonly Bindable<RankingsSortCriteria> Sort = new Bindable<RankingsSortCriteria>();
@ -37,10 +35,7 @@ namespace osu.Game.Overlays.Rankings
set => dropdown.Items = value;
}
protected override bool StartHidden => true;
private readonly Box background;
private readonly Container content;
private readonly SpotlightsDropdown dropdown;
private readonly InfoColumn startDateColumn;
private readonly InfoColumn endDateColumn;
@ -51,73 +46,68 @@ namespace osu.Game.Overlays.Rankings
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Add(content = new Container
InternalChildren = new Drawable[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
background = new Box
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new Container
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN },
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN },
Child = new FillFlowContainer
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
new Container
{
new Container
{
Margin = new MarginPadding { Vertical = 20 },
RelativeSizeAxes = Axes.X,
Height = 40,
Depth = -float.MaxValue,
Child = dropdown = new SpotlightsDropdown
{
RelativeSizeAxes = Axes.X,
Current = Current
}
},
new Container
Margin = new MarginPadding { Vertical = 20 },
RelativeSizeAxes = Axes.X,
Height = 40,
Depth = -float.MaxValue,
Child = dropdown = new SpotlightsDropdown
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
Current = Current
}
},
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,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Margin = new MarginPadding { Bottom = 5 },
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
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
}
}
}
}
}
}
});
};
}
[BackgroundDependencyLoader]
@ -134,10 +124,6 @@ namespace osu.Game.Overlays.Rankings
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 class InfoColumn : FillFlowContainer

View File

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