mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 22:27:25 +08:00
Merge pull request #7722 from EVAST9919/rankings-overlay-update
Update RankingsOverlay in line with the web design
This commit is contained in:
commit
f1c7130805
@ -11,6 +11,8 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -22,6 +24,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(CountryPill)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
public TestSceneRankingsCountryFilter()
|
||||
{
|
||||
var countryBindable = new Bindable<Country>();
|
||||
|
@ -1,66 +0,0 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneRankingsDismissableFlag : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(DismissableFlag),
|
||||
};
|
||||
|
||||
public TestSceneRankingsDismissableFlag()
|
||||
{
|
||||
DismissableFlag flag;
|
||||
SpriteText text;
|
||||
|
||||
var countryA = new Country
|
||||
{
|
||||
FlagName = "BY",
|
||||
FullName = "Belarus"
|
||||
};
|
||||
|
||||
var countryB = new Country
|
||||
{
|
||||
FlagName = "US",
|
||||
FullName = "United States"
|
||||
};
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
flag = new DismissableFlag
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(30, 20),
|
||||
Country = countryA,
|
||||
},
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = "Invoked",
|
||||
Font = OsuFont.GetFont(size: 30),
|
||||
Alpha = 0,
|
||||
}
|
||||
});
|
||||
|
||||
flag.Action += () => text.FadeIn().Then().FadeOut(1000, Easing.OutQuint);
|
||||
|
||||
AddStep("Trigger click", () => flag.Click());
|
||||
AddStep("Change to country 2", () => flag.Country = countryB);
|
||||
AddStep("Change to country 1", () => flag.Country = countryA);
|
||||
}
|
||||
}
|
||||
}
|
@ -3,8 +3,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Users;
|
||||
@ -15,24 +16,23 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(DismissableFlag),
|
||||
typeof(HeaderTitle),
|
||||
typeof(RankingsRulesetSelector),
|
||||
typeof(RankingsScopeSelector),
|
||||
typeof(RankingsHeader),
|
||||
typeof(RankingsOverlayHeader),
|
||||
typeof(CountryFilter),
|
||||
typeof(CountryPill)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
public TestSceneRankingsHeader()
|
||||
{
|
||||
var countryBindable = new Bindable<Country>();
|
||||
var ruleset = new Bindable<RulesetInfo>();
|
||||
var scope = new Bindable<RankingsScope>();
|
||||
|
||||
Add(new RankingsHeader
|
||||
Add(new RankingsOverlayHeader
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scope = { BindTarget = scope },
|
||||
Current = { BindTarget = scope },
|
||||
Country = { BindTarget = countryBindable },
|
||||
Ruleset = { BindTarget = ruleset },
|
||||
Spotlights = new[]
|
||||
|
@ -1,55 +0,0 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneRankingsHeaderTitle : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(DismissableFlag),
|
||||
typeof(HeaderTitle),
|
||||
};
|
||||
|
||||
public TestSceneRankingsHeaderTitle()
|
||||
{
|
||||
var countryBindable = new Bindable<Country>();
|
||||
var scope = new Bindable<RankingsScope>();
|
||||
|
||||
Add(new HeaderTitle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Country = { BindTarget = countryBindable },
|
||||
Scope = { BindTarget = scope },
|
||||
});
|
||||
|
||||
var countryA = new Country
|
||||
{
|
||||
FlagName = "BY",
|
||||
FullName = "Belarus"
|
||||
};
|
||||
|
||||
var countryB = new Country
|
||||
{
|
||||
FlagName = "US",
|
||||
FullName = "United States"
|
||||
};
|
||||
|
||||
AddStep("Set country 1", () => countryBindable.Value = countryA);
|
||||
AddStep("Set country 2", () => countryBindable.Value = countryB);
|
||||
AddStep("Set null country", () => countryBindable.Value = null);
|
||||
AddStep("Set scope to Performance", () => scope.Value = RankingsScope.Performance);
|
||||
AddStep("Set scope to Spotlights", () => scope.Value = RankingsScope.Spotlights);
|
||||
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
|
||||
AddStep("Set scope to Country", () => scope.Value = RankingsScope.Country);
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
typeof(TableRowBackground),
|
||||
typeof(UserBasedTable),
|
||||
typeof(RankingsTable<>),
|
||||
typeof(RankingsOverlay)
|
||||
typeof(RankingsOverlay),
|
||||
typeof(RankingsOverlayHeader)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
|
@ -1,41 +0,0 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneRankingsRulesetSelector : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(RankingsRulesetSelector),
|
||||
};
|
||||
|
||||
public TestSceneRankingsRulesetSelector()
|
||||
{
|
||||
var current = new Bindable<RulesetInfo>();
|
||||
|
||||
Add(new RankingsRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Current = { BindTarget = current }
|
||||
});
|
||||
|
||||
AddStep("Select osu!", () => current.Value = new OsuRuleset().RulesetInfo);
|
||||
AddStep("Select mania", () => current.Value = new ManiaRuleset().RulesetInfo);
|
||||
AddStep("Select taiko", () => current.Value = new TaikoRuleset().RulesetInfo);
|
||||
AddStep("Select catch", () => current.Value = new CatchRuleset().RulesetInfo);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
// 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 System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneRankingsScopeSelector : OsuTestScene
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(RankingsScopeSelector),
|
||||
};
|
||||
|
||||
private readonly Box background;
|
||||
|
||||
public TestSceneRankingsScopeSelector()
|
||||
{
|
||||
var scope = new Bindable<RankingsScope>();
|
||||
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new RankingsScopeSelector
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Current = scope,
|
||||
}
|
||||
});
|
||||
|
||||
AddStep(@"Select country", () => scope.Value = RankingsScope.Country);
|
||||
AddStep(@"Select performance", () => scope.Value = RankingsScope.Performance);
|
||||
AddStep(@"Select score", () => scope.Value = RankingsScope.Score);
|
||||
AddStep(@"Select spotlights", () => scope.Value = RankingsScope.Spotlights);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
background.Colour = colours.GreySeafoam;
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -36,6 +37,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
private readonly BasicScrollContainer scrollFlow;
|
||||
private readonly DimmedLoadingLayer loading;
|
||||
private CancellationTokenSource cancellationToken;
|
||||
|
@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Rankings
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
background.Colour = colours.GreySeafoam;
|
||||
background.Colour = colourProvider.Dark3;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -100,9 +100,9 @@ namespace osu.Game.Overlays.Rankings
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
background.Colour = colours.GreySeafoamDarker;
|
||||
background.Colour = colourProvider.Background5;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -154,9 +154,9 @@ namespace osu.Game.Overlays.Rankings
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
IdleColour = colours.GreySeafoamLighter;
|
||||
IdleColour = colourProvider.Light2;
|
||||
HoverColour = Color4.White;
|
||||
}
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
// 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.Graphics.Sprites;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK.Graphics;
|
||||
using osuTK;
|
||||
using osu.Framework.Input.Events;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class DismissableFlag : UpdateableFlag
|
||||
{
|
||||
private const int duration = 200;
|
||||
|
||||
public Action Action;
|
||||
|
||||
private readonly SpriteIcon hoverIcon;
|
||||
|
||||
public DismissableFlag()
|
||||
{
|
||||
AddInternal(hoverIcon = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Depth = -1,
|
||||
Alpha = 0,
|
||||
Size = new Vector2(10),
|
||||
Icon = FontAwesome.Solid.Times,
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
hoverIcon.FadeIn(duration, Easing.OutQuint);
|
||||
this.FadeColour(Color4.Gray, duration, Easing.OutQuint);
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
hoverIcon.FadeOut(duration, Easing.OutQuint);
|
||||
this.FadeColour(Color4.White, duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Action?.Invoke();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Graphics;
|
||||
using osuTK;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class HeaderTitle : CompositeDrawable
|
||||
{
|
||||
private const int spacing = 10;
|
||||
private const int flag_margin = 5;
|
||||
private const int text_size = 40;
|
||||
|
||||
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
|
||||
public readonly Bindable<Country> Country = new Bindable<Country>();
|
||||
|
||||
private readonly SpriteText scopeText;
|
||||
private readonly DismissableFlag flag;
|
||||
|
||||
public HeaderTitle()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
InternalChild = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(spacing, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flag = new DismissableFlag
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Margin = new MarginPadding { Bottom = flag_margin },
|
||||
Size = new Vector2(30, 20),
|
||||
},
|
||||
scopeText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light),
|
||||
Text = @"Ranking"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
flag.Action += () => Country.Value = null;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
scopeText.Colour = colours.Lime;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Scope.BindValueChanged(onScopeChanged, true);
|
||||
Country.BindValueChanged(onCountryChanged, true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) => scopeText.Text = scope.NewValue.ToString();
|
||||
|
||||
private void onCountryChanged(ValueChangedEvent<Country> country)
|
||||
{
|
||||
if (country.NewValue == null)
|
||||
{
|
||||
flag.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
flag.Country = country.NewValue;
|
||||
flag.Show();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,129 +0,0 @@
|
||||
// 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.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osuTK;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class RankingsHeader : CompositeDrawable
|
||||
{
|
||||
private const int content_height = 250;
|
||||
|
||||
public IEnumerable<Spotlight> Spotlights
|
||||
{
|
||||
get => dropdown.Items;
|
||||
set => dropdown.Items = value;
|
||||
}
|
||||
|
||||
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
|
||||
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
public readonly Bindable<Country> Country = new Bindable<Country>();
|
||||
public readonly Bindable<Spotlight> Spotlight = new Bindable<Spotlight>();
|
||||
|
||||
private readonly OsuDropdown<Spotlight> dropdown;
|
||||
|
||||
public RankingsHeader()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
AddInternal(new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RankingsRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Current = Ruleset
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = content_height,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Child = new HeaderBackground(),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RankingsScopeSelector
|
||||
{
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Current = Scope
|
||||
},
|
||||
new HeaderTitle
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Scope = { BindTarget = Scope },
|
||||
Country = { BindTarget = Country },
|
||||
},
|
||||
dropdown = new OsuDropdown<Spotlight>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.8f,
|
||||
Current = Spotlight,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Scope.BindValueChanged(onScopeChanged, true);
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) =>
|
||||
dropdown.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint);
|
||||
|
||||
private class HeaderBackground : Sprite
|
||||
{
|
||||
public HeaderBackground()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
FillMode = FillMode.Fill;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(@"Headers/rankings");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
135
osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs
Normal file
135
osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs
Normal file
@ -0,0 +1,135 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
|
||||
{
|
||||
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
public readonly Bindable<Spotlight> Spotlight = new Bindable<Spotlight>();
|
||||
public readonly Bindable<Country> Country = new Bindable<Country>();
|
||||
|
||||
public IEnumerable<Spotlight> Spotlights
|
||||
{
|
||||
get => spotlightsContainer.Spotlights;
|
||||
set => spotlightsContainer.Spotlights = value;
|
||||
}
|
||||
|
||||
protected override ScreenTitle CreateTitle() => new RankingsTitle
|
||||
{
|
||||
Scope = { BindTarget = Current }
|
||||
};
|
||||
|
||||
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector
|
||||
{
|
||||
Current = Ruleset
|
||||
};
|
||||
|
||||
private SpotlightsContainer spotlightsContainer;
|
||||
|
||||
protected override Drawable CreateContent() => new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CountryFilter
|
||||
{
|
||||
Current = Country
|
||||
},
|
||||
spotlightsContainer = new SpotlightsContainer
|
||||
{
|
||||
Spotlight = { BindTarget = Spotlight }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum RankingsScope
|
||||
{
|
||||
Performance,
|
||||
Spotlights,
|
||||
Score,
|
||||
Country
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class RankingsRulesetSelector : PageTabControl<RulesetInfo>
|
||||
{
|
||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RankingsTabItem(value);
|
||||
|
||||
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
|
||||
|
||||
public RankingsRulesetSelector()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, RulesetStore rulesets)
|
||||
{
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
AddItem(r);
|
||||
|
||||
AccentColour = colours.Lime;
|
||||
|
||||
SelectTab(TabContainer.FirstOrDefault());
|
||||
}
|
||||
|
||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(20, 0),
|
||||
};
|
||||
|
||||
private class RankingsTabItem : PageTabItem
|
||||
{
|
||||
public RankingsTabItem(RulesetInfo value)
|
||||
: base(value)
|
||||
{
|
||||
}
|
||||
|
||||
protected override string CreateText() => $"{Value.Name}";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
// 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.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Allocation;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings
|
||||
{
|
||||
public class RankingsScopeSelector : GradientLineTabControl<RankingsScope>
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AccentColour = LineColour = Color4.Black;
|
||||
}
|
||||
}
|
||||
|
||||
public enum RankingsScope
|
||||
{
|
||||
Performance,
|
||||
Spotlights,
|
||||
Score,
|
||||
Country
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
public abstract class RankingsTable<TModel> : TableContainer
|
||||
{
|
||||
protected const int TEXT_SIZE = 14;
|
||||
protected const int TEXT_SIZE = 12;
|
||||
private const float horizontal_inset = 20;
|
||||
private const float row_height = 25;
|
||||
private const int items_per_page = 50;
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
private static TableColumn[] mainHeaders => new[]
|
||||
{
|
||||
new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 50)), // place
|
||||
new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 40)), // place
|
||||
new TableColumn(string.Empty, Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed)), // flag and username (country name)
|
||||
};
|
||||
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
private OsuSpriteText createIndexDrawable(int index) => new OsuSpriteText
|
||||
{
|
||||
Text = $"#{index + 1}",
|
||||
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.Bold)
|
||||
Font = OsuFont.GetFont(size: TEXT_SIZE, weight: FontWeight.SemiBold)
|
||||
};
|
||||
|
||||
private FillFlowContainer createMainContent(TModel item) => new FillFlowContainer
|
||||
@ -112,10 +112,10 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
if (Text != highlighted)
|
||||
Colour = colours.GreySeafoamLighter;
|
||||
Colour = colourProvider.Foreground1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,9 +131,9 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
protected class ColoredRowText : RowText
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
Colour = colours.GreySeafoamLighter;
|
||||
Colour = colourProvider.Foreground1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
@ -35,10 +34,10 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
background.Colour = idleColour = colours.GreySeafoam;
|
||||
hoverColour = colours.GreySeafoamLight;
|
||||
background.Colour = idleColour = colourProvider.Background4;
|
||||
hoverColour = colourProvider.Background3;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
@ -6,7 +6,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Rulesets;
|
||||
@ -27,6 +26,7 @@ namespace osu.Game.Overlays
|
||||
private readonly BasicScrollContainer scrollFlow;
|
||||
private readonly Container tableContainer;
|
||||
private readonly DimmedLoadingLayer loading;
|
||||
private readonly Box background;
|
||||
|
||||
private APIRequest lastRequest;
|
||||
private CancellationTokenSource cancellationToken;
|
||||
@ -39,10 +39,9 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.1f),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
scrollFlow = new BasicScrollContainer
|
||||
{
|
||||
@ -55,12 +54,13 @@ namespace osu.Game.Overlays
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new RankingsHeader
|
||||
new RankingsOverlayHeader
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Depth = -float.MaxValue,
|
||||
Country = { BindTarget = Country },
|
||||
Scope = { BindTarget = Scope },
|
||||
Current = { BindTarget = Scope },
|
||||
Ruleset = { BindTarget = ruleset }
|
||||
},
|
||||
new Container
|
||||
@ -86,6 +86,12 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
background.Colour = ColourProvider.Background5;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Country.BindValueChanged(_ =>
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Overlays
|
||||
TabControl = CreateTabControl().With(control =>
|
||||
{
|
||||
control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN };
|
||||
control.Current = current;
|
||||
control.Current = Current;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user