mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:43:20 +08:00
Add overridable combo colour retrieval method and handle in legacy skin
This commit is contained in:
parent
f95744170f
commit
9be8d3f0d2
@ -16,6 +16,7 @@ using osu.Framework.IO.Stores;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK.Graphics;
|
||||
@ -119,6 +120,9 @@ namespace osu.Game.Skinning
|
||||
|
||||
break;
|
||||
|
||||
case SkinComboColourLookup comboColour:
|
||||
return SkinUtils.As<TValue>(GetComboColour(Configuration, comboColour.ColourIndex, comboColour.Combo));
|
||||
|
||||
case SkinCustomColourLookup customColour:
|
||||
return SkinUtils.As<TValue>(getCustomColour(Configuration, customColour.Lookup.ToString()));
|
||||
|
||||
@ -276,6 +280,18 @@ namespace osu.Game.Skinning
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the correct combo colour for a given colour index and information on the combo.
|
||||
/// </summary>
|
||||
/// <param name="source">The source to retrieve the combo colours from.</param>
|
||||
/// <param name="colourIndex">The preferred index for retrieving the combo colour with.</param>
|
||||
/// <param name="combo">Information on the combo whose using the returned colour.</param>
|
||||
protected virtual IBindable<Color4> GetComboColour(IHasComboColours source, int colourIndex, IHasComboInformation combo)
|
||||
{
|
||||
var colour = source.ComboColours?[colourIndex % source.ComboColours.Count];
|
||||
return colour.HasValue ? new Bindable<Color4>(colour.Value) : null;
|
||||
}
|
||||
|
||||
private IBindable<Color4> getCustomColour(IHasCustomColours source, string lookup)
|
||||
=> source.CustomColours.TryGetValue(lookup, out var col) ? new Bindable<Color4>(col) : null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user