mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Implement IApplicableToDrawableHitObject
for mods
A breaking change in `ModWithVisibilityAdjustment` if the method was overriden.
This commit is contained in:
parent
67d8e0059f
commit
af80418ee8
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -9,22 +8,19 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModBarrelRoll : ModBarrelRoll<OsuHitObject>, IApplicableToDrawableHitObjects
|
public class OsuModBarrelRoll : ModBarrelRoll<OsuHitObject>, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject d)
|
||||||
{
|
{
|
||||||
foreach (var d in drawables)
|
d.OnUpdate += _ =>
|
||||||
{
|
{
|
||||||
d.OnUpdate += _ =>
|
switch (d)
|
||||||
{
|
{
|
||||||
switch (d)
|
case DrawableHitCircle circle:
|
||||||
{
|
circle.CirclePiece.Rotation = -CurrentRotation;
|
||||||
case DrawableHitCircle circle:
|
break;
|
||||||
circle.CirclePiece.Rotation = -CurrentRotation;
|
}
|
||||||
break;
|
};
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -15,7 +14,7 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObjects, IApplicableToDrawableRuleset<OsuHitObject>
|
public class OsuModClassic : ModClassic, IApplicableToHitObject, IApplicableToDrawableHitObject, IApplicableToDrawableRuleset<OsuHitObject>
|
||||||
{
|
{
|
||||||
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
[SettingSource("No slider head accuracy requirement", "Scores sliders proportionally to the number of ticks hit.")]
|
||||||
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
public Bindable<bool> NoSliderHeadAccuracy { get; } = new BindableBool(true);
|
||||||
@ -54,24 +53,21 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
osuRuleset.Playfield.HitPolicy = new ObjectOrderedHitPolicy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject obj)
|
||||||
{
|
{
|
||||||
foreach (var obj in drawables)
|
switch (obj)
|
||||||
{
|
{
|
||||||
switch (obj)
|
case DrawableSlider slider:
|
||||||
{
|
slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value;
|
||||||
case DrawableSlider slider:
|
break;
|
||||||
slider.Ball.InputTracksVisualSize = !FixedFollowCircleHitArea.Value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case DrawableSliderHead head:
|
case DrawableSliderHead head:
|
||||||
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
|
head.TrackFollowCircle = !NoSliderHeadMovement.Value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableSliderTail tail:
|
case DrawableSliderTail tail:
|
||||||
tail.SamplePlaysOnlyOnHit = !AlwaysPlayTailSample.Value;
|
tail.SamplePlaysOnlyOnHit = !AlwaysPlayTailSample.Value;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -19,7 +17,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModFlashlight : ModFlashlight<OsuHitObject>, IApplicableToDrawableHitObjects
|
public class OsuModFlashlight : ModFlashlight<OsuHitObject>, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public override double ScoreMultiplier => 1.12;
|
public override double ScoreMultiplier => 1.12;
|
||||||
|
|
||||||
@ -31,12 +29,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight();
|
public override Flashlight CreateFlashlight() => flashlight = new OsuFlashlight();
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject drawable)
|
||||||
{
|
{
|
||||||
foreach (var s in drawables.OfType<DrawableSlider>())
|
if (drawable is DrawableSlider s)
|
||||||
{
|
|
||||||
s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange;
|
s.Tracking.ValueChanged += flashlight.OnSliderTrackingChange;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
public override void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
@ -13,7 +12,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModSpunOut : Mod, IApplicableToDrawableHitObjects
|
public class OsuModSpunOut : Mod, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
public override string Name => "Spun Out";
|
public override string Name => "Spun Out";
|
||||||
public override string Acronym => "SO";
|
public override string Acronym => "SO";
|
||||||
@ -23,15 +22,12 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override double ScoreMultiplier => 0.9;
|
public override double ScoreMultiplier => 0.9;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
||||||
|
|
||||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public void ApplyToDrawableHitObject(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
foreach (var hitObject in drawables)
|
if (hitObject is DrawableSpinner spinner)
|
||||||
{
|
{
|
||||||
if (hitObject is DrawableSpinner spinner)
|
spinner.HandleUserInput = false;
|
||||||
{
|
spinner.OnUpdate += onSpinnerUpdate;
|
||||||
spinner.HandleUserInput = false;
|
|
||||||
spinner.OnUpdate += onSpinnerUpdate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// A <see cref="Mod"/> which applies visibility adjustments to <see cref="DrawableHitObject"/>s
|
/// A <see cref="Mod"/> which applies visibility adjustments to <see cref="DrawableHitObject"/>s
|
||||||
/// with an optional increased visibility adjustment depending on the user's "increase first object visibility" setting.
|
/// with an optional increased visibility adjustment depending on the user's "increase first object visibility" setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ModWithVisibilityAdjustment : Mod, IReadFromConfig, IApplicableToBeatmap, IApplicableToDrawableHitObjects
|
public abstract class ModWithVisibilityAdjustment : Mod, IReadFromConfig, IApplicableToBeatmap, IApplicableToDrawableHitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The first adjustable object.
|
/// The first adjustable object.
|
||||||
@ -73,19 +73,16 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public virtual void ApplyToDrawableHitObject(DrawableHitObject dho)
|
||||||
{
|
{
|
||||||
foreach (var dho in drawables)
|
dho.ApplyCustomUpdateState += (o, state) =>
|
||||||
{
|
{
|
||||||
dho.ApplyCustomUpdateState += (o, state) =>
|
// Increased visibility is applied to the entire first object, including all of its nested hitobjects.
|
||||||
{
|
if (IncreaseFirstObjectVisibility.Value && isObjectEqualToOrNestedIn(o.HitObject, FirstObject))
|
||||||
// Increased visibility is applied to the entire first object, including all of its nested hitobjects.
|
ApplyIncreasedVisibilityState(o, state);
|
||||||
if (IncreaseFirstObjectVisibility.Value && isObjectEqualToOrNestedIn(o.HitObject, FirstObject))
|
else
|
||||||
ApplyIncreasedVisibilityState(o, state);
|
ApplyNormalVisibilityState(o, state);
|
||||||
else
|
};
|
||||||
ApplyNormalVisibilityState(o, state);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user