mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Avoid API change to DrawableHitObject
This commit is contained in:
parent
156edf24c2
commit
33fad27ec2
@ -89,9 +89,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
private SkinnableSound slidingSample;
|
||||
|
||||
protected override void LoadSamples(bool changed)
|
||||
protected override void LoadSamples()
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
base.LoadSamples();
|
||||
|
||||
slidingSample?.Expire();
|
||||
slidingSample = null;
|
||||
|
@ -88,9 +88,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private const float spinning_sample_initial_frequency = 1.0f;
|
||||
private const float spinning_sample_modulated_base_frequency = 0.5f;
|
||||
|
||||
protected override void LoadSamples(bool changed)
|
||||
protected override void LoadSamples()
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
base.LoadSamples();
|
||||
|
||||
spinningSample?.Expire();
|
||||
spinningSample = null;
|
||||
|
@ -36,11 +36,12 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private bool pressHandledThisFrame;
|
||||
|
||||
private Bindable<HitType> type;
|
||||
private readonly Bindable<HitType> type;
|
||||
|
||||
public DrawableHit(Hit hit)
|
||||
: base(hit)
|
||||
{
|
||||
type = HitObject.TypeBindable.GetBoundCopy();
|
||||
FillMode = FillMode.Fit;
|
||||
|
||||
updateActionsFromType();
|
||||
@ -49,7 +50,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
type = HitObject.TypeBindable.GetBoundCopy();
|
||||
type.BindValueChanged(_ =>
|
||||
{
|
||||
updateActionsFromType();
|
||||
@ -63,12 +63,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private HitSampleInfo[] getRimSamples() => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_CLAP || s.Name == HitSampleInfo.HIT_WHISTLE).ToArray();
|
||||
|
||||
protected override void LoadSamples(bool changed)
|
||||
protected override void LoadSamples()
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
base.LoadSamples();
|
||||
|
||||
if (changed)
|
||||
type.Value = getRimSamples().Any() ? HitType.Rim : HitType.Centre;
|
||||
type.Value = getRimSamples().Any() ? HitType.Rim : HitType.Centre;
|
||||
}
|
||||
|
||||
private void updateSamplesFromTypeChange()
|
||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
protected Vector2 BaseSize;
|
||||
protected SkinnableDrawable MainPiece;
|
||||
|
||||
private Bindable<bool> isStrong;
|
||||
private readonly Bindable<bool> isStrong;
|
||||
|
||||
private readonly Container<DrawableStrongNestedHit> strongHitContainer;
|
||||
|
||||
@ -128,6 +128,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
: base(hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
isStrong = HitObject.IsStrongBindable.GetBoundCopy();
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.Custom;
|
||||
@ -140,7 +141,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
isStrong = HitObject.IsStrongBindable.GetBoundCopy();
|
||||
isStrong.BindValueChanged(_ =>
|
||||
{
|
||||
// will overwrite samples, should only be called on change.
|
||||
@ -154,12 +154,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
private HitSampleInfo[] getStrongSamples() => HitObject.Samples.Where(s => s.Name == HitSampleInfo.HIT_FINISH).ToArray();
|
||||
|
||||
protected override void LoadSamples(bool changed)
|
||||
protected override void LoadSamples()
|
||||
{
|
||||
base.LoadSamples(changed);
|
||||
base.LoadSamples();
|
||||
|
||||
if (changed)
|
||||
isStrong.Value = getStrongSamples().Any();
|
||||
isStrong.Value = getStrongSamples().Any();
|
||||
}
|
||||
|
||||
private void updateSamplesFromStrong()
|
||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
if (Result == null)
|
||||
throw new InvalidOperationException($"{GetType().ReadableName()} must provide a {nameof(JudgementResult)} through {nameof(CreateResult)}.");
|
||||
|
||||
LoadSamples(false);
|
||||
LoadSamples();
|
||||
}
|
||||
|
||||
protected override void LoadAsyncComplete()
|
||||
@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
}
|
||||
|
||||
samplesBindable = HitObject.SamplesBindable.GetBoundCopy();
|
||||
samplesBindable.CollectionChanged += (_, __) => LoadSamples(true);
|
||||
samplesBindable.CollectionChanged += (_, __) => LoadSamples();
|
||||
|
||||
apply(HitObject);
|
||||
}
|
||||
@ -160,8 +160,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// <summary>
|
||||
/// Invoked by the base <see cref="DrawableHitObject"/> to populate samples, once on initial load and potentially again on any change to the samples collection.
|
||||
/// </summary>
|
||||
/// <param name="changed">True if triggered from a change to the samples collection.</param>
|
||||
protected virtual void LoadSamples(bool changed)
|
||||
protected virtual void LoadSamples()
|
||||
{
|
||||
if (Samples != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user