mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Move combo index processing to BeatmapProcessor
This commit is contained in:
parent
cb3d0db555
commit
c38c26eacb
@ -16,29 +16,13 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
{
|
{
|
||||||
public override void PostProcess(Beatmap<CatchHitObject> beatmap)
|
public override void PostProcess(Beatmap<CatchHitObject> beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap.ComboColours.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int index = 0;
|
|
||||||
int colourIndex = 0;
|
|
||||||
|
|
||||||
CatchHitObject lastObj = null;
|
|
||||||
|
|
||||||
initialiseHyperDash(beatmap.HitObjects);
|
initialiseHyperDash(beatmap.HitObjects);
|
||||||
|
|
||||||
|
base.PostProcess(beatmap);
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
foreach (var obj in beatmap.HitObjects)
|
foreach (var obj in beatmap.HitObjects)
|
||||||
{
|
|
||||||
if (obj.NewCombo)
|
|
||||||
{
|
|
||||||
if (lastObj != null) lastObj.LastInCombo = true;
|
|
||||||
colourIndex = (colourIndex + 1) % beatmap.ComboColours.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.IndexInBeatmap = index++;
|
obj.IndexInBeatmap = index++;
|
||||||
obj.AccentColour = beatmap.ComboColours[colourIndex];
|
|
||||||
|
|
||||||
lastObj = obj;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialiseHyperDash(List<CatchHitObject> objects)
|
private void initialiseHyperDash(List<CatchHitObject> objects)
|
||||||
|
@ -13,24 +13,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
|||||||
public override void PostProcess(Beatmap<OsuHitObject> beatmap)
|
public override void PostProcess(Beatmap<OsuHitObject> beatmap)
|
||||||
{
|
{
|
||||||
applyStacking(beatmap);
|
applyStacking(beatmap);
|
||||||
|
base.PostProcess(beatmap);
|
||||||
if (beatmap.ComboColours.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int comboIndex = 0;
|
|
||||||
int colourIndex = 0;
|
|
||||||
|
|
||||||
foreach (var obj in beatmap.HitObjects)
|
|
||||||
{
|
|
||||||
if (obj.NewCombo)
|
|
||||||
{
|
|
||||||
comboIndex = 0;
|
|
||||||
colourIndex = (colourIndex + 1) % beatmap.ComboColours.Count;
|
|
||||||
}
|
|
||||||
|
|
||||||
obj.IndexInCurrentCombo = comboIndex++;
|
|
||||||
obj.ComboColour = beatmap.ComboColours[colourIndex];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyStacking(Beatmap<OsuHitObject> beatmap)
|
private void applyStacking(Beatmap<OsuHitObject> beatmap)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -19,6 +21,29 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The Beatmap to process.</param>
|
/// <param name="beatmap">The Beatmap to process.</param>
|
||||||
public virtual void PostProcess(Beatmap<TObject> beatmap) { }
|
public virtual void PostProcess(Beatmap<TObject> beatmap)
|
||||||
|
{
|
||||||
|
IHasComboIndex lastObj = null;
|
||||||
|
|
||||||
|
foreach (var obj in beatmap.HitObjects.OfType<IHasComboIndex>())
|
||||||
|
{
|
||||||
|
if (obj.NewCombo)
|
||||||
|
{
|
||||||
|
obj.IndexInCurrentCombo = 0;
|
||||||
|
if (lastObj != null)
|
||||||
|
{
|
||||||
|
lastObj.LastInCombo = true;
|
||||||
|
obj.ComboIndex = lastObj.ComboIndex + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (lastObj != null)
|
||||||
|
{
|
||||||
|
obj.IndexInCurrentCombo = lastObj.IndexInCurrentCombo + 1;
|
||||||
|
obj.ComboIndex = lastObj.ComboIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastObj = obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs
Normal file
26
osu.Game/Rulesets/Objects/Types/IHasComboIndex.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Objects.Types
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A HitObject that is part of a combo and has extended information about its position relative to other combo objects.
|
||||||
|
/// </summary>
|
||||||
|
public interface IHasComboIndex : IHasCombo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The offset of this hitobject in the current combo.
|
||||||
|
/// </summary>
|
||||||
|
int IndexInCurrentCombo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The offset of this hitobject in the current combo.
|
||||||
|
/// </summary>
|
||||||
|
int ComboIndex { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this is the last object in the current combo.
|
||||||
|
/// </summary>
|
||||||
|
bool LastInCombo { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -374,6 +374,7 @@
|
|||||||
<Compile Include="Overlays\Social\SocialPanel.cs" />
|
<Compile Include="Overlays\Social\SocialPanel.cs" />
|
||||||
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
||||||
<Compile Include="Rulesets\Objects\HitWindows.cs" />
|
<Compile Include="Rulesets\Objects\HitWindows.cs" />
|
||||||
|
<Compile Include="Rulesets\Objects\Types\IHasComboIndex.cs" />
|
||||||
<Compile Include="Rulesets\Replays\Legacy\LegacyReplayFrame.cs" />
|
<Compile Include="Rulesets\Replays\Legacy\LegacyReplayFrame.cs" />
|
||||||
<Compile Include="Rulesets\Replays\Legacy\ReplayButtonState.cs" />
|
<Compile Include="Rulesets\Replays\Legacy\ReplayButtonState.cs" />
|
||||||
<Compile Include="Rulesets\Replays\ReplayFrame.cs" />
|
<Compile Include="Rulesets\Replays\ReplayFrame.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user