mirror of https://github.com/ppy/osu
Make OverlayRulesetSelector use colour provider
This commit is contained in:
parent
a72250acc6
commit
7cd60e3193
|
@ -11,7 +11,8 @@
|
|||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
|
@ -23,12 +24,15 @@ public class TestSceneProfileRulesetSelector : OsuTestScene
|
|||
typeof(ProfileRulesetTabItem),
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
public TestSceneProfileRulesetSelector()
|
||||
{
|
||||
ProfileRulesetSelector selector;
|
||||
var user = new Bindable<User>();
|
||||
|
||||
Child = selector = new ProfileRulesetSelector(OverlayColourScheme.Green)
|
||||
Child = selector = new ProfileRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
|
@ -40,16 +40,29 @@ public TestSceneOverlayRulesetSelector()
|
|||
Spacing = new Vector2(0, 5),
|
||||
Children = new[]
|
||||
{
|
||||
selector = new OverlayRulesetSelector(OverlayColourScheme.Green) { Current = ruleset },
|
||||
new OverlayRulesetSelector(OverlayColourScheme.Blue) { Current = ruleset },
|
||||
new OverlayRulesetSelector(OverlayColourScheme.Orange) { Current = ruleset },
|
||||
new OverlayRulesetSelector(OverlayColourScheme.Pink) { Current = ruleset },
|
||||
new OverlayRulesetSelector(OverlayColourScheme.Purple) { Current = ruleset },
|
||||
new OverlayRulesetSelector(OverlayColourScheme.Red) { Current = ruleset }
|
||||
new ColourProvidedContainer(OverlayColourScheme.Green, selector = new OverlayRulesetSelector { Current = ruleset }),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Blue, new OverlayRulesetSelector { Current = ruleset }),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Orange, new OverlayRulesetSelector { Current = ruleset }),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Pink, new OverlayRulesetSelector { Current = ruleset }),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Purple, new OverlayRulesetSelector { Current = ruleset }),
|
||||
new ColourProvidedContainer(OverlayColourScheme.Red, new OverlayRulesetSelector { Current = ruleset }),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private class ColourProvidedContainer : Container
|
||||
{
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider;
|
||||
|
||||
public ColourProvidedContainer(OverlayColourScheme colourScheme, OverlayRulesetSelector rulesetSelector)
|
||||
{
|
||||
colourProvider = new OverlayColourProvider(colourScheme);
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Add(rulesetSelector);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelection()
|
||||
{
|
||||
|
|
|
@ -28,19 +28,15 @@ public Color4 AccentColour
|
|||
}
|
||||
}
|
||||
|
||||
protected OverlayColourScheme ColourScheme { get; }
|
||||
|
||||
public OverlayRulesetSelector(OverlayColourScheme colourScheme)
|
||||
public OverlayRulesetSelector()
|
||||
{
|
||||
ColourScheme = colourScheme;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
AccentColour = colours.ForOverlayElement(ColourScheme, 1, 0.7f);
|
||||
AccentColour = colourProvider.Highlight1;
|
||||
}
|
||||
|
||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new OverlayRulesetTabItem(value);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Users;
|
||||
|
||||
|
@ -13,11 +12,6 @@ public class ProfileRulesetSelector : OverlayRulesetSelector
|
|||
{
|
||||
public readonly Bindable<User> User = new Bindable<User>();
|
||||
|
||||
public ProfileRulesetSelector(OverlayColourScheme colourScheme)
|
||||
: base(colourScheme)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
|
Loading…
Reference in New Issue