mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 05:53:10 +08:00
Add combo/colour metadata to CatchBaseHit
This commit is contained in:
parent
b9ab034f94
commit
4e0aed4b8a
@ -24,6 +24,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
yield return new Fruit
|
||||
{
|
||||
StartTime = obj.StartTime,
|
||||
NewCombo = (obj as IHasCombo)?.NewCombo ?? false,
|
||||
Position = ((IHasXPosition)obj).X / OsuPlayfield.BASE_SIZE.X
|
||||
};
|
||||
}
|
||||
|
36
osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
Normal file
36
osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
{
|
||||
internal class CatchBeatmapProcessor : BeatmapProcessor<CatchBaseHit>
|
||||
{
|
||||
public override void PostProcess(Beatmap<CatchBaseHit> beatmap)
|
||||
{
|
||||
if (beatmap.ComboColors.Count == 0)
|
||||
return;
|
||||
|
||||
int comboIndex = 0;
|
||||
int colourIndex = 0;
|
||||
|
||||
CatchBaseHit lastObj = null;
|
||||
|
||||
foreach (var obj in beatmap.HitObjects)
|
||||
{
|
||||
if (obj.NewCombo)
|
||||
{
|
||||
if (lastObj != null) lastObj.LastInCombo = true;
|
||||
|
||||
comboIndex = 0;
|
||||
colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count;
|
||||
}
|
||||
|
||||
obj.ComboIndex = comboIndex++;
|
||||
obj.ComboColour = beatmap.ComboColors[colourIndex];
|
||||
|
||||
lastObj = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,11 +2,22 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
public abstract class CatchBaseHit : HitObject
|
||||
{
|
||||
public float Position { get; set; }
|
||||
|
||||
public Color4 ComboColour { get; set; } = Color4.Gray;
|
||||
public int ComboIndex { get; set; }
|
||||
|
||||
public virtual bool NewCombo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The next fruit starts a new combo. Used for explodey.
|
||||
/// </summary>
|
||||
public virtual bool LastInCombo { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this);
|
||||
|
||||
protected override BeatmapProcessor<CatchBaseHit> CreateBeatmapProcessor() => new CatchBeatmapProcessor();
|
||||
|
||||
protected override BeatmapConverter<CatchBaseHit> CreateBeatmapConverter() => new CatchBeatmapConverter();
|
||||
|
||||
protected override Playfield CreatePlayfield() => new CatchPlayfield();
|
||||
|
@ -50,6 +50,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Beatmaps\CatchBeatmapConverter.cs" />
|
||||
<Compile Include="Beatmaps\CatchBeatmapProcessor.cs" />
|
||||
<Compile Include="CatchDifficultyCalculator.cs" />
|
||||
<Compile Include="CatchInputManager.cs" />
|
||||
<Compile Include="Scoring\CatchScoreProcessor.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user