1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 12:42:54 +08:00

Handle combo colour lookups in other skins

This commit is contained in:
Salman Ahmed 2021-05-05 07:11:45 +03:00
parent 9be8d3f0d2
commit 78794935b4
2 changed files with 11 additions and 10 deletions

View File

@ -127,14 +127,8 @@ namespace osu.Game.Tests.Gameplay
{ {
switch (lookup) switch (lookup)
{ {
case GlobalSkinColours global: case SkinComboColourLookup comboColour:
switch (global) return SkinUtils.As<TValue>(new Bindable<Color4>(ComboColours[comboColour.ColourIndex % ComboColours.Count]));
{
case GlobalSkinColours.ComboColours:
return SkinUtils.As<TValue>(new Bindable<IReadOnlyList<Color4>>(ComboColours));
}
break;
} }
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.OpenGL.Textures; using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Audio; using osu.Game.Audio;
using osu.Game.Beatmaps.Formats;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Skinning namespace osu.Game.Skinning
@ -28,10 +29,10 @@ namespace osu.Game.Skinning
public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup) public override IBindable<TValue> GetConfig<TLookup, TValue>(TLookup lookup)
{ {
// todo: this code is pulled from LegacySkin and should not exist.
// will likely change based on how databased storage of skin configuration goes.
switch (lookup) switch (lookup)
{ {
// todo: this code is pulled from LegacySkin and should not exist.
// will likely change based on how databased storage of skin configuration goes.
case GlobalSkinColours global: case GlobalSkinColours global:
switch (global) switch (global)
{ {
@ -40,9 +41,15 @@ namespace osu.Game.Skinning
} }
break; break;
case SkinComboColourLookup comboColour:
return SkinUtils.As<TValue>(new Bindable<Color4>(getComboColour(Configuration, comboColour.ColourIndex)));
} }
return null; return null;
} }
private static Color4 getComboColour(IHasComboColours source, int colourIndex)
=> source.ComboColours[colourIndex % source.ComboColours.Count];
} }
} }