Rename property, reword xmldoc and improve readability of update code

This commit is contained in:
Dean Herbert
2021-07-21 17:32:56 +09:00
parent 300b3f22b1
commit 399c3b0be8
7 changed files with 25 additions and 27 deletions

View File

@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Catch.Objects
set => ComboIndexBindable.Value = value; set => ComboIndexBindable.Value = value;
} }
public int BeatmapSkinComboIndex { get; set; } public int ComboIndexWithOffsets { get; set; }
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>(); public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();

View File

@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Objects
set => ComboIndexBindable.Value = value; set => ComboIndexBindable.Value = value;
} }
public int BeatmapSkinComboIndex { get; set; } public int ComboIndexWithOffsets { get; set; }
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>(); public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();

View File

@ -323,12 +323,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
new OsuBeatmapProcessor(converted).PreProcess(); new OsuBeatmapProcessor(converted).PreProcess();
new OsuBeatmapProcessor(converted).PostProcess(); new OsuBeatmapProcessor(converted).PostProcess();
Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).BeatmapSkinComboIndex); Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).ComboIndexWithOffsets);
Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).BeatmapSkinComboIndex); Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).ComboIndexWithOffsets);
Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).BeatmapSkinComboIndex); Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).ComboIndexWithOffsets);
Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).BeatmapSkinComboIndex); Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).ComboIndexWithOffsets);
Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).BeatmapSkinComboIndex); Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).ComboIndexWithOffsets);
Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).BeatmapSkinComboIndex); Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).ComboIndexWithOffsets);
} }
} }
@ -346,12 +346,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
new CatchBeatmapProcessor(converted).PreProcess(); new CatchBeatmapProcessor(converted).PreProcess();
new CatchBeatmapProcessor(converted).PostProcess(); new CatchBeatmapProcessor(converted).PostProcess();
Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).BeatmapSkinComboIndex); Assert.AreEqual(4, ((IHasComboInformation)converted.HitObjects.ElementAt(0)).ComboIndexWithOffsets);
Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).BeatmapSkinComboIndex); Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(2)).ComboIndexWithOffsets);
Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).BeatmapSkinComboIndex); Assert.AreEqual(5, ((IHasComboInformation)converted.HitObjects.ElementAt(4)).ComboIndexWithOffsets);
Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).BeatmapSkinComboIndex); Assert.AreEqual(6, ((IHasComboInformation)converted.HitObjects.ElementAt(6)).ComboIndexWithOffsets);
Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).BeatmapSkinComboIndex); Assert.AreEqual(11, ((IHasComboInformation)converted.HitObjects.ElementAt(8)).ComboIndexWithOffsets);
Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).BeatmapSkinComboIndex); Assert.AreEqual(14, ((IHasComboInformation)converted.HitObjects.ElementAt(11)).ComboIndexWithOffsets);
} }
} }

View File

@ -100,7 +100,7 @@ namespace osu.Game.Tests.Gameplay
set => ComboIndexBindable.Value = value; set => ComboIndexBindable.Value = value;
} }
public int BeatmapSkinComboIndex { get; set; } public int ComboIndexWithOffsets { get; set; }
public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>(); public Bindable<bool> LastInComboBindable { get; } = new Bindable<bool>();

View File

@ -34,21 +34,19 @@ namespace osu.Game.Beatmaps
isFirst = false; isFirst = false;
} }
obj.ComboIndex = lastObj?.ComboIndex ?? 0;
obj.ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
obj.IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
if (obj.NewCombo) if (obj.NewCombo)
{ {
obj.IndexInCurrentCombo = 0; obj.IndexInCurrentCombo = 0;
obj.ComboIndex = (lastObj?.ComboIndex ?? 0) + 1; obj.ComboIndex++;
obj.BeatmapSkinComboIndex = (lastObj?.BeatmapSkinComboIndex ?? 0) + obj.ComboOffset + 1; obj.ComboIndexWithOffsets += obj.ComboOffset + 1;
if (lastObj != null) if (lastObj != null)
lastObj.LastInCombo = true; lastObj.LastInCombo = true;
} }
else if (lastObj != null)
{
obj.IndexInCurrentCombo = lastObj.IndexInCurrentCombo + 1;
obj.ComboIndex = lastObj.ComboIndex;
obj.BeatmapSkinComboIndex = lastObj.BeatmapSkinComboIndex;
}
lastObj = obj; lastObj = obj;
} }

View File

@ -27,10 +27,10 @@ namespace osu.Game.Rulesets.Objects.Types
int ComboIndex { get; set; } int ComboIndex { get; set; }
/// <summary> /// <summary>
/// A <see cref="ComboIndex"/> with the <see cref="IHasCombo.ComboOffset"/> of this and all previous hitobjects applied to it. /// The offset of this combo in relation to the beatmap, with all aggregate <see cref="IHasCombo.ComboOffset"/>s applied.
/// This is used primarily for beatmap skins during combo colour retrieval, rather than the regular <see cref="ComboIndex"/>. /// This should be used instead of <see cref="ComboIndex"/> only when retrieving combo colours from the beatmap's skin.
/// </summary> /// </summary>
int BeatmapSkinComboIndex { get; set; } int ComboIndexWithOffsets { get; set; }
/// <summary> /// <summary>
/// Whether the HitObject starts a new combo. /// Whether the HitObject starts a new combo.

View File

@ -63,7 +63,7 @@ namespace osu.Game.Skinning
} }
protected override IBindable<Color4> GetComboColour(IHasComboColours source, int comboIndex, IHasComboInformation combo) protected override IBindable<Color4> GetComboColour(IHasComboColours source, int comboIndex, IHasComboInformation combo)
=> base.GetComboColour(source, combo.BeatmapSkinComboIndex, combo); => base.GetComboColour(source, combo.ComboIndexWithOffsets, combo);
public override ISample GetSample(ISampleInfo sampleInfo) public override ISample GetSample(ISampleInfo sampleInfo)
{ {