mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:23:00 +08:00
created option to override values before UpdateState is called
This commit is contained in:
parent
a58b5ff5f2
commit
f547c7986d
@ -44,6 +44,14 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
d.ApplyCustomUpdateState += ApplyHiddenState;
|
||||
}
|
||||
|
||||
protected void ApplyHiddenValues(DrawableHitObject drawable)
|
||||
{
|
||||
if (!(drawable is DrawableOsuHitObject d))
|
||||
return;
|
||||
|
||||
d.FadeIn = preEmpt * fade_in_duration_multiplier;
|
||||
}
|
||||
|
||||
protected void ApplyHiddenState(DrawableHitObject drawable, ArmedState state)
|
||||
{
|
||||
if (!(drawable is DrawableOsuHitObject d))
|
||||
@ -58,8 +66,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
// new duration from completed fade in to end (before fading out)
|
||||
var longFadeDuration = ((d.HitObject as IHasEndTime)?.EndTime ?? d.HitObject.StartTime) - fadeOutStartTime;
|
||||
|
||||
d.FadeIn = fadeInDuration;
|
||||
|
||||
switch (drawable)
|
||||
{
|
||||
case DrawableHitCircle circle:
|
||||
|
@ -120,6 +120,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
State.ValueChanged += state =>
|
||||
{
|
||||
// apply any custom values
|
||||
ApplyCustomValues?.Invoke(this);
|
||||
|
||||
UpdateState(state);
|
||||
|
||||
// apply any custom state overrides
|
||||
@ -250,6 +253,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
nestedHitObjects.Add(h);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind to apply custom values.
|
||||
/// </summary>
|
||||
public event Action<DrawableHitObject> ApplyCustomValues;
|
||||
|
||||
/// <summary>
|
||||
/// Bind to apply a custom state which can override the default implementation.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user