From b397652af4a08870262c94eaf41d83b9e59f1ea0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 27 Jun 2019 15:02:26 +0900 Subject: [PATCH] Remove ability to set arbitrary accent colours --- .../Online/TestSceneProfileRulesetSelector.cs | 4 --- .../Components/ProfileRulesetSelector.cs | 32 ++++++------------- .../Components/ProfileRulesetTabItem.cs | 2 +- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index ce484f72bb..c344cb9598 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -2,9 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Graphics; -using osu.Framework.MathUtils; using osu.Game.Overlays.Profile.Header.Components; -using osuTK.Graphics; using System; using System.Collections.Generic; using osu.Game.Rulesets.Catch; @@ -37,8 +35,6 @@ namespace osu.Game.Tests.Visual.Online AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo)); AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo)); AddStep("select default ruleset", selector.SelectDefaultRuleset); - - AddStep("set random colour", () => selector.AccentColour = new Color4(RNG.NextSingle(), RNG.NextSingle(), RNG.NextSingle(), 1)); } } } diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index cea16a918b..b6112a6501 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -16,23 +16,6 @@ namespace osu.Game.Overlays.Profile.Header.Components { private Color4 accentColour = Color4.White; - public Color4 AccentColour - { - get => accentColour; - set - { - if (accentColour == value) - return; - - accentColour = value; - - foreach (TabItem tabItem in TabContainer) - { - ((ProfileRulesetTabItem)tabItem).AccentColour = value; - } - } - } - public ProfileRulesetSelector() { TabContainer.Masking = false; @@ -43,13 +26,11 @@ namespace osu.Game.Overlays.Profile.Header.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - AccentColour = colours.Seafoam; - } + accentColour = colours.Seafoam; - protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value) - { - AccentColour = AccentColour - }; + foreach (TabItem tabItem in TabContainer) + ((ProfileRulesetTabItem)tabItem).AccentColour = accentColour; + } public void SetDefaultRuleset(RulesetInfo ruleset) { @@ -71,6 +52,11 @@ namespace osu.Game.Overlays.Profile.Header.Components } } + protected override TabItem CreateTabItem(RulesetInfo value) => new ProfileRulesetTabItem(value) + { + AccentColour = accentColour + }; + protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer { Direction = FillDirection.Horizontal, diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs index a1ee8a09a7..63f7783451 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetTabItem.cs @@ -15,7 +15,7 @@ using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { - public class ProfileRulesetTabItem : TabItem + public class ProfileRulesetTabItem : TabItem, IHasAccentColour { private readonly OsuSpriteText text; private readonly SpriteIcon icon;