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

Move combo colour update logic to osu! ruleset

This commit is contained in:
Dean Herbert 2020-02-19 15:05:04 +09:00
parent 26fe15b038
commit 618fb4ccfb
2 changed files with 11 additions and 4 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Graphics.Containers;
using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
@ -54,6 +55,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
}
}
protected override void UpdateComboColour(Color4 comboColour) => AccentColour.Value = comboColour;
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(HitObject, judgement);
}
}

View File

@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (HitObject is IHasComboInformation combo)
{
comboIndexBindable = combo.ComboIndexBindable.GetBoundCopy();
comboIndexBindable.BindValueChanged(_ => updateAccentColour(), true);
comboIndexBindable.BindValueChanged(_ => updateComboColour(), true);
}
samplesBindable = HitObject.SamplesBindable.GetBoundCopy();
@ -336,7 +336,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
base.SkinChanged(skin, allowFallback);
updateAccentColour();
updateComboColour();
ApplySkin(skin, allowFallback);
@ -344,15 +344,19 @@ namespace osu.Game.Rulesets.Objects.Drawables
updateState(State.Value, true);
}
private void updateAccentColour()
private void updateComboColour()
{
if (HitObject is IHasComboInformation combo)
{
var comboColours = CurrentSkin.GetConfig<GlobalSkinColours, IReadOnlyList<Color4>>(GlobalSkinColours.ComboColours)?.Value;
AccentColour.Value = comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White;
UpdateComboColour(comboColours?.Count > 0 ? comboColours[combo.ComboIndex % comboColours.Count] : Color4.White);
}
}
protected virtual void UpdateComboColour(Color4 comboColour)
{
}
/// <summary>
/// Called when a change is made to the skin.
/// </summary>