Merge pull request #12683 from frenzibyte/legacy-beatmap-combo-offset

Apply combo offsets "colour hax" only on beatmap skins
This commit is contained in:
Dean Herbert
2021-07-23 14:30:18 +09:00
committed by GitHub
12 changed files with 177 additions and 34 deletions

View File

@ -124,7 +124,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
public readonly Bindable<double> StartTimeBindable = new Bindable<double>();
private readonly BindableList<HitSampleInfo> samplesBindable = new BindableList<HitSampleInfo>();
private readonly Bindable<bool> userPositionalHitSounds = new Bindable<bool>();
private readonly Bindable<int> comboIndexBindable = new Bindable<int>();
private readonly Bindable<int> comboIndexWithOffsetsBindable = new Bindable<int>();
protected override bool RequiresChildrenUpdate => true;
@ -185,7 +187,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
base.LoadComplete();
comboIndexBindable.BindValueChanged(_ => UpdateComboColour(), true);
comboIndexBindable.BindValueChanged(_ => UpdateComboColour());
comboIndexWithOffsetsBindable.BindValueChanged(_ => UpdateComboColour(), true);
updateState(ArmedState.Idle, true);
}
@ -250,7 +253,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
StartTimeBindable.BindValueChanged(onStartTimeChanged);
if (HitObject is IHasComboInformation combo)
{
comboIndexBindable.BindTo(combo.ComboIndexBindable);
comboIndexWithOffsetsBindable.BindTo(combo.ComboIndexWithOffsetsBindable);
}
samplesBindable.BindTo(HitObject.SamplesBindable);
samplesBindable.BindCollectionChanged(onSamplesChanged, true);
@ -275,8 +281,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
protected sealed override void OnFree(HitObjectLifetimeEntry entry)
{
StartTimeBindable.UnbindFrom(HitObject.StartTimeBindable);
if (HitObject is IHasComboInformation combo)
{
comboIndexBindable.UnbindFrom(combo.ComboIndexBindable);
comboIndexWithOffsetsBindable.UnbindFrom(combo.ComboIndexWithOffsetsBindable);
}
samplesBindable.UnbindFrom(HitObject.SamplesBindable);
// Changes in start time trigger state updates. When a new hitobject is applied, OnApply() automatically performs a state update anyway.

View File

@ -118,6 +118,7 @@ namespace osu.Game.Rulesets.Objects
foreach (var n in NestedHitObjects.OfType<IHasComboInformation>())
{
n.ComboIndexBindable.BindTo(hasCombo.ComboIndexBindable);
n.ComboIndexWithOffsetsBindable.BindTo(hasCombo.ComboIndexWithOffsetsBindable);
n.IndexInCurrentComboBindable.BindTo(hasCombo.IndexInCurrentComboBindable);
}
}

View File

@ -15,17 +15,25 @@ namespace osu.Game.Rulesets.Objects.Types
Bindable<int> IndexInCurrentComboBindable { get; }
/// <summary>
/// The offset of this hitobject in the current combo.
/// The index of this hitobject in the current combo.
/// </summary>
int IndexInCurrentCombo { get; set; }
Bindable<int> ComboIndexBindable { get; }
/// <summary>
/// The offset of this combo in relation to the beatmap.
/// The index of this combo in relation to the beatmap.
/// </summary>
int ComboIndex { get; set; }
Bindable<int> ComboIndexWithOffsetsBindable { get; }
/// <summary>
/// The index of this combo in relation to the beatmap, with all aggregate <see cref="IHasCombo.ComboOffset"/>s applied.
/// This should be used instead of <see cref="ComboIndex"/> only when retrieving combo colours from the beatmap's skin.
/// </summary>
int ComboIndexWithOffsets { get; set; }
/// <summary>
/// Whether the HitObject starts a new combo.
/// </summary>