mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 22:29:28 +08:00
Move combo colour update logic to osu! ruleset
This commit is contained in:
parent
02f3e78b14
commit
5340d1de59
@ -1,11 +1,13 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
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 +56,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateComboColour(Color4 proposedColour, IReadOnlyList<Color4> comboColours) => AccentColour.Value = proposedColour;
|
||||
|
||||
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(HitObject, judgement);
|
||||
}
|
||||
}
|
||||
|
@ -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,24 @@ 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, comboColours);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a combo colour change is proposed.
|
||||
/// </summary>
|
||||
/// <param name="proposedColour">The proposed combo colour, based off the combo index.</param>
|
||||
/// <param name="comboColours">A list of combo colours provided by the beatmap or skin. Can be null if not available.</param>
|
||||
protected virtual void UpdateComboColour(Color4 proposedColour, IReadOnlyList<Color4> comboColours)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called when a change is made to the skin.
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user