Skip to content

Commit

Permalink
Should be able to calculate the preempt time in the effect applier.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Apr 16, 2023
1 parent ce5739c commit 663f3e3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public LyricClassicStageEffectApplier(IEnumerable<StageElement> elements, Classi
{
}

protected override double GetPreemptTime(IEnumerable<StageElement> elements)
{
// todo: implementation needed.
return 0;
}

protected override void UpdateInitialTransforms(TransformSequence<DrawableLyric> transformSequence, StageElement element)
{
throw new System.NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public NoteClassicStageEffectApplier(IEnumerable<StageElement> elements, Classic
{
}

protected override double GetPreemptTime(IEnumerable<StageElement> elements)
{
// todo: implementation needed.
return 0;
}

protected override void UpdateInitialTransforms(TransformSequence<DrawableNote> transformSequence, StageElement element)
{
throw new System.NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ public LyricPreviewStageEffectApplier(IEnumerable<StageElement> elements, Previe
{
}

protected override double GetPreemptTime(IEnumerable<StageElement> elements)
{
return Definition.FadingTime;
}

protected override void UpdateInitialTransforms(TransformSequence<DrawableLyric> transformSequence, StageElement element)
{
switch (element)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public NotePreviewStageEffectApplier(IEnumerable<StageElement> elements, Preview
{
}

protected override double GetPreemptTime(IEnumerable<StageElement> elements)
{
// todo: implementation needed.
return 0;
}

protected override void UpdateInitialTransforms(TransformSequence<DrawableNote> transformSequence, StageElement element)
{
throw new System.NotImplementedException();
Expand Down
10 changes: 8 additions & 2 deletions osu.Game.Rulesets.Karaoke/Objects/Stages/StageEffectApplier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
using osu.Game.Rulesets.Karaoke.Beatmaps.Stages;
Expand All @@ -14,14 +15,17 @@ public abstract class StageEffectApplier<TStageDefinition, TDrawableHitObject> :
where TStageDefinition : StageDefinition
where TDrawableHitObject : DrawableHitObject
{
private readonly IEnumerable<StageElement> elements;
private readonly StageElement[] elements;

protected readonly TStageDefinition Definition;
public readonly double PreemptTime;

protected StageEffectApplier(IEnumerable<StageElement> elements, TStageDefinition definition)
{
this.elements = elements;
this.elements = elements.ToArray();
Definition = definition;

PreemptTime = GetPreemptTime(this.elements);
}

/// <summary>
Expand Down Expand Up @@ -88,6 +92,8 @@ public void UpdateHitStateTransforms(DrawableHitObject drawableHitObject, ArmedS
transform.Then().FadeOut();
}

protected abstract double GetPreemptTime(IEnumerable<StageElement> elements);

protected abstract void UpdateInitialTransforms(TransformSequence<TDrawableHitObject> transformSequence, StageElement element);

protected abstract void UpdateStartTimeStateTransforms(TransformSequence<TDrawableHitObject> transformSequence, StageElement element);
Expand Down

0 comments on commit 663f3e3

Please sign in to comment.