mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Make top-level osu! objects use new methods
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -30,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private Container scaleContainer;
|
private Container scaleContainer;
|
||||||
private InputManager inputManager;
|
private InputManager inputManager;
|
||||||
|
|
||||||
public DrawableHitCircle(HitCircle h)
|
public DrawableHitCircle([CanBeNull] HitCircle h = null)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Osu.Judgements;
|
using osu.Game.Rulesets.Osu.Judgements;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -49,6 +50,21 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
ShakeDuration = 30,
|
ShakeDuration = 30,
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void FreeAfterUse()
|
||||||
|
{
|
||||||
|
IndexInCurrentComboBindable.UnbindFrom(HitObject.IndexInCurrentComboBindable);
|
||||||
|
PositionBindable.UnbindFrom(HitObject.PositionBindable);
|
||||||
|
StackHeightBindable.UnbindFrom(HitObject.StackHeightBindable);
|
||||||
|
ScaleBindable.UnbindFrom(HitObject.ScaleBindable);
|
||||||
|
|
||||||
|
base.FreeAfterUse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(HitObject hitObject)
|
||||||
|
{
|
||||||
|
base.Apply(hitObject);
|
||||||
|
|
||||||
IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable);
|
IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable);
|
||||||
PositionBindable.BindTo(HitObject.PositionBindable);
|
PositionBindable.BindTo(HitObject.PositionBindable);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -32,14 +33,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private PlaySliderBody sliderBody => Body.Drawable as PlaySliderBody;
|
private PlaySliderBody sliderBody => Body.Drawable as PlaySliderBody;
|
||||||
|
|
||||||
public readonly IBindable<int> PathVersion = new Bindable<int>();
|
public IBindable<int> PathVersion => pathVersion;
|
||||||
|
private readonly Bindable<int> pathVersion = new Bindable<int>();
|
||||||
|
|
||||||
private Container<DrawableSliderHead> headContainer;
|
private Container<DrawableSliderHead> headContainer;
|
||||||
private Container<DrawableSliderTail> tailContainer;
|
private Container<DrawableSliderTail> tailContainer;
|
||||||
private Container<DrawableSliderTick> tickContainer;
|
private Container<DrawableSliderTick> tickContainer;
|
||||||
private Container<DrawableSliderRepeat> repeatContainer;
|
private Container<DrawableSliderRepeat> repeatContainer;
|
||||||
|
|
||||||
public DrawableSlider(Slider s)
|
public DrawableSlider([CanBeNull] Slider s = null)
|
||||||
: base(s)
|
: base(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -63,8 +65,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },
|
headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },
|
||||||
};
|
};
|
||||||
|
|
||||||
PathVersion.BindTo(HitObject.Path.Version);
|
|
||||||
|
|
||||||
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition, true);
|
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition, true);
|
||||||
StackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition, true);
|
StackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition, true);
|
||||||
ScaleBindable.BindValueChanged(scale => Ball.Scale = new Vector2(scale.NewValue), true);
|
ScaleBindable.BindValueChanged(scale => Ball.Scale = new Vector2(scale.NewValue), true);
|
||||||
@ -78,6 +78,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Tracking.BindValueChanged(updateSlidingSample);
|
Tracking.BindValueChanged(updateSlidingSample);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void FreeAfterUse()
|
||||||
|
{
|
||||||
|
PathVersion.UnbindFrom(HitObject.Path.Version);
|
||||||
|
|
||||||
|
base.FreeAfterUse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Apply(HitObject hitObject)
|
||||||
|
{
|
||||||
|
base.Apply(hitObject);
|
||||||
|
|
||||||
|
// Ensure that the version will change after the upcoming BindTo().
|
||||||
|
pathVersion.Value = int.MaxValue;
|
||||||
|
PathVersion.BindTo(HitObject.Path.Version);
|
||||||
|
}
|
||||||
|
|
||||||
private PausableSkinnableSound slidingSample;
|
private PausableSkinnableSound slidingSample;
|
||||||
|
|
||||||
protected override void LoadSamples()
|
protected override void LoadSamples()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
private Bindable<bool> isSpinning;
|
private Bindable<bool> isSpinning;
|
||||||
private bool spinnerFrequencyModulate;
|
private bool spinnerFrequencyModulate;
|
||||||
|
|
||||||
public DrawableSpinner(Spinner s)
|
public DrawableSpinner([CanBeNull] Spinner s = null)
|
||||||
: base(s)
|
: base(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user