mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Nest specific object classes within the mod
This commit is contained in:
parent
35e2e6a4e7
commit
d3742a91a8
@ -1,12 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods.Objects
|
|
||||||
{
|
|
||||||
public class StrictTrackingDrawableSliderTail : DrawableSliderTail
|
|
||||||
{
|
|
||||||
public override bool DisplayResult => true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
// 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.Threading;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods.Objects
|
|
||||||
{
|
|
||||||
public class StrictTrackingSlider : Slider
|
|
||||||
{
|
|
||||||
public StrictTrackingSlider(Slider original)
|
|
||||||
{
|
|
||||||
StartTime = original.StartTime;
|
|
||||||
Samples = original.Samples;
|
|
||||||
Path = original.Path;
|
|
||||||
NodeSamples = original.NodeSamples;
|
|
||||||
RepeatCount = original.RepeatCount;
|
|
||||||
Position = original.Position;
|
|
||||||
NewCombo = original.NewCombo;
|
|
||||||
ComboOffset = original.ComboOffset;
|
|
||||||
LegacyLastTickOffset = original.LegacyLastTickOffset;
|
|
||||||
TickDistanceMultiplier = original.TickDistanceMultiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var sliderEvents = SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset, cancellationToken);
|
|
||||||
|
|
||||||
foreach (var e in sliderEvents)
|
|
||||||
{
|
|
||||||
switch (e.Type)
|
|
||||||
{
|
|
||||||
case SliderEventType.Head:
|
|
||||||
AddNested(HeadCircle = new SliderHeadCircle
|
|
||||||
{
|
|
||||||
StartTime = e.Time,
|
|
||||||
Position = Position,
|
|
||||||
StackHeight = StackHeight,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SliderEventType.LegacyLastTick:
|
|
||||||
AddNested(TailCircle = new StrictTrackingSliderTailCircle(this)
|
|
||||||
{
|
|
||||||
RepeatIndex = e.SpanIndex,
|
|
||||||
StartTime = e.Time,
|
|
||||||
Position = EndPosition,
|
|
||||||
StackHeight = StackHeight
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SliderEventType.Repeat:
|
|
||||||
AddNested(new SliderRepeat(this)
|
|
||||||
{
|
|
||||||
RepeatIndex = e.SpanIndex,
|
|
||||||
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
|
|
||||||
Position = Position + Path.PositionAt(e.PathProgress),
|
|
||||||
StackHeight = StackHeight,
|
|
||||||
Scale = Scale,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateNestedSamples();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
// 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 osu.Game.Rulesets.Judgements;
|
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods.Objects
|
|
||||||
{
|
|
||||||
public class StrictTrackingSliderTailCircle : SliderTailCircle
|
|
||||||
{
|
|
||||||
public StrictTrackingSliderTailCircle(Slider slider)
|
|
||||||
: base(slider)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Judgement CreateJudgement() => new OsuJudgement();
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,12 +3,16 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Mods.Objects;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -65,5 +69,80 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
drawableRuleset.Playfield.RegisterPool<StrictTrackingSliderTailCircle, StrictTrackingDrawableSliderTail>(10, 100);
|
drawableRuleset.Playfield.RegisterPool<StrictTrackingSliderTailCircle, StrictTrackingDrawableSliderTail>(10, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class StrictTrackingSliderTailCircle : SliderTailCircle
|
||||||
|
{
|
||||||
|
public StrictTrackingSliderTailCircle(Slider slider)
|
||||||
|
: base(slider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Judgement CreateJudgement() => new OsuJudgement();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class StrictTrackingDrawableSliderTail : DrawableSliderTail
|
||||||
|
{
|
||||||
|
public override bool DisplayResult => true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class StrictTrackingSlider : Slider
|
||||||
|
{
|
||||||
|
public StrictTrackingSlider(Slider original)
|
||||||
|
{
|
||||||
|
StartTime = original.StartTime;
|
||||||
|
Samples = original.Samples;
|
||||||
|
Path = original.Path;
|
||||||
|
NodeSamples = original.NodeSamples;
|
||||||
|
RepeatCount = original.RepeatCount;
|
||||||
|
Position = original.Position;
|
||||||
|
NewCombo = original.NewCombo;
|
||||||
|
ComboOffset = original.ComboOffset;
|
||||||
|
LegacyLastTickOffset = original.LegacyLastTickOffset;
|
||||||
|
TickDistanceMultiplier = original.TickDistanceMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var sliderEvents = SliderEventGenerator.Generate(StartTime, SpanDuration, Velocity, TickDistance, Path.Distance, this.SpanCount(), LegacyLastTickOffset, cancellationToken);
|
||||||
|
|
||||||
|
foreach (var e in sliderEvents)
|
||||||
|
{
|
||||||
|
switch (e.Type)
|
||||||
|
{
|
||||||
|
case SliderEventType.Head:
|
||||||
|
AddNested(HeadCircle = new SliderHeadCircle
|
||||||
|
{
|
||||||
|
StartTime = e.Time,
|
||||||
|
Position = Position,
|
||||||
|
StackHeight = StackHeight,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SliderEventType.LegacyLastTick:
|
||||||
|
AddNested(TailCircle = new StrictTrackingSliderTailCircle(this)
|
||||||
|
{
|
||||||
|
RepeatIndex = e.SpanIndex,
|
||||||
|
StartTime = e.Time,
|
||||||
|
Position = EndPosition,
|
||||||
|
StackHeight = StackHeight
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SliderEventType.Repeat:
|
||||||
|
AddNested(new SliderRepeat(this)
|
||||||
|
{
|
||||||
|
RepeatIndex = e.SpanIndex,
|
||||||
|
StartTime = StartTime + (e.SpanIndex + 1) * SpanDuration,
|
||||||
|
Position = Position + Path.PositionAt(e.PathProgress),
|
||||||
|
StackHeight = StackHeight,
|
||||||
|
Scale = Scale,
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateNestedSamples();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user