2020-02-04 01:20:35 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
using System.Collections.Generic;
|
2020-02-04 01:32:20 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-02-04 01:47:41 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Allocation;
|
2020-02-04 01:20:35 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Rankings
|
|
|
|
|
{
|
|
|
|
|
public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
|
|
|
|
|
{
|
|
|
|
|
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
2020-02-04 01:47:41 +08:00
|
|
|
|
public readonly Bindable<Spotlight> Spotlight = new Bindable<Spotlight>();
|
2020-02-04 01:20:35 +08:00
|
|
|
|
public readonly Bindable<Country> Country = new Bindable<Country>();
|
|
|
|
|
|
2020-02-04 01:47:41 +08:00
|
|
|
|
public IEnumerable<Spotlight> Spotlights
|
|
|
|
|
{
|
|
|
|
|
get => spotlightsContainer.Spotlights;
|
|
|
|
|
set => spotlightsContainer.Spotlights = value;
|
|
|
|
|
}
|
2020-02-04 01:20:35 +08:00
|
|
|
|
|
|
|
|
|
protected override ScreenTitle CreateTitle() => new RankingsTitle
|
|
|
|
|
{
|
|
|
|
|
Scope = { BindTarget = Current }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector
|
|
|
|
|
{
|
|
|
|
|
Current = Ruleset
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-04 01:47:41 +08:00
|
|
|
|
private SpotlightsContainer spotlightsContainer;
|
|
|
|
|
|
|
|
|
|
protected override Drawable CreateContent() => new FillFlowContainer
|
2020-02-04 01:32:20 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2020-02-04 01:47:41 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2020-02-04 01:32:20 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new CountryFilter
|
|
|
|
|
{
|
|
|
|
|
Current = Country
|
2020-02-04 01:47:41 +08:00
|
|
|
|
},
|
|
|
|
|
spotlightsContainer = new SpotlightsContainer
|
|
|
|
|
{
|
|
|
|
|
Spotlight = { BindTarget = Spotlight }
|
2020-02-04 01:32:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-04 01:47:41 +08:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
Current.BindValueChanged(onCurrentChanged, true);
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onCurrentChanged(ValueChangedEvent<RankingsScope> scope) =>
|
|
|
|
|
spotlightsContainer.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint);
|
|
|
|
|
|
2020-02-04 01:20:35 +08:00
|
|
|
|
private class RankingsTitle : ScreenTitle
|
|
|
|
|
{
|
|
|
|
|
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
|
|
|
|
|
|
|
|
|
|
public RankingsTitle()
|
|
|
|
|
{
|
|
|
|
|
Title = "ranking";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
Scope.BindValueChanged(scope => Section = scope.NewValue.ToString().ToLowerInvariant(), true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/rankings");
|
|
|
|
|
}
|
2020-02-04 01:47:41 +08:00
|
|
|
|
|
|
|
|
|
private class SpotlightsContainer : CompositeDrawable
|
|
|
|
|
{
|
|
|
|
|
public readonly Bindable<Spotlight> Spotlight = new Bindable<Spotlight>();
|
|
|
|
|
|
|
|
|
|
public IEnumerable<Spotlight> Spotlights
|
|
|
|
|
{
|
|
|
|
|
get => dropdown.Items;
|
|
|
|
|
set => dropdown.Items = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly OsuDropdown<Spotlight> dropdown;
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
|
|
|
|
|
public SpotlightsContainer()
|
|
|
|
|
{
|
|
|
|
|
Height = 100;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
dropdown = new OsuDropdown<Spotlight>
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Width = 0.8f,
|
|
|
|
|
Current = Spotlight,
|
|
|
|
|
Y = 20,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
|
{
|
|
|
|
|
background.Colour = colourProvider.Dark3;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-02-04 01:20:35 +08:00
|
|
|
|
}
|
2020-02-04 01:59:08 +08:00
|
|
|
|
|
|
|
|
|
public enum RankingsScope
|
|
|
|
|
{
|
|
|
|
|
Performance,
|
|
|
|
|
Spotlights,
|
|
|
|
|
Score,
|
|
|
|
|
Country
|
|
|
|
|
}
|
2020-02-04 01:20:35 +08:00
|
|
|
|
}
|