mirror of
https://github.com/ppy/osu
synced 2025-01-05 13:50:03 +00:00
Merge pull request #19039 from Cwazywierdo/mod-icon-colors
Update mod icon colors
This commit is contained in:
commit
9e40e50d93
@ -1,10 +1,10 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -13,10 +13,24 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneModIcon : OsuTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestShowAllMods()
|
||||
{
|
||||
AddStep("create mod icons", () =>
|
||||
{
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Full,
|
||||
ChildrenEnumerable = Ruleset.Value.CreateInstance().CreateAllMods().Select(m => new ModIcon(m)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeModType()
|
||||
{
|
||||
ModIcon icon = null;
|
||||
ModIcon icon = null!;
|
||||
|
||||
AddStep("create mod icon", () => Child = icon = new ModIcon(new OsuModDoubleTime()));
|
||||
AddStep("change mod", () => icon.Mod = new OsuModEasy());
|
||||
@ -25,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Test]
|
||||
public void TestInterfaceModType()
|
||||
{
|
||||
ModIcon icon = null;
|
||||
ModIcon icon = null!;
|
||||
|
||||
var ruleset = new OsuRuleset();
|
||||
|
||||
|
@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osuTK;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Rulesets.UI
|
||||
@ -53,7 +54,6 @@ namespace osu.Game.Rulesets.UI
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private Color4 backgroundColour;
|
||||
private Color4 highlightedColour;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new instance.
|
||||
@ -123,47 +123,13 @@ namespace osu.Game.Rulesets.UI
|
||||
modAcronym.FadeOut();
|
||||
}
|
||||
|
||||
switch (value.Type)
|
||||
{
|
||||
default:
|
||||
case ModType.DifficultyIncrease:
|
||||
backgroundColour = colours.Yellow;
|
||||
highlightedColour = colours.YellowLight;
|
||||
break;
|
||||
|
||||
case ModType.DifficultyReduction:
|
||||
backgroundColour = colours.Green;
|
||||
highlightedColour = colours.GreenLight;
|
||||
break;
|
||||
|
||||
case ModType.Automation:
|
||||
backgroundColour = colours.Blue;
|
||||
highlightedColour = colours.BlueLight;
|
||||
break;
|
||||
|
||||
case ModType.Conversion:
|
||||
backgroundColour = colours.Purple;
|
||||
highlightedColour = colours.PurpleLight;
|
||||
break;
|
||||
|
||||
case ModType.Fun:
|
||||
backgroundColour = colours.Pink;
|
||||
highlightedColour = colours.PinkLight;
|
||||
break;
|
||||
|
||||
case ModType.System:
|
||||
backgroundColour = colours.Gray6;
|
||||
highlightedColour = colours.Gray7;
|
||||
modIcon.Colour = colours.Yellow;
|
||||
break;
|
||||
}
|
||||
|
||||
backgroundColour = colours.ForModType(value.Type);
|
||||
updateColour();
|
||||
}
|
||||
|
||||
private void updateColour()
|
||||
{
|
||||
background.Colour = Selected.Value ? highlightedColour : backgroundColour;
|
||||
background.Colour = Selected.Value ? backgroundColour.Lighten(0.2f) : backgroundColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user