mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Simplify DrawableNote
This commit is contained in:
parent
e0ca44c908
commit
d3db19c3ce
@ -5,6 +5,7 @@ using System.Diagnostics;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Mania.Skinning.Default;
|
using osu.Game.Rulesets.Mania.Skinning.Default;
|
||||||
@ -34,13 +35,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
private readonly Drawable headPiece;
|
private readonly Drawable headPiece;
|
||||||
|
|
||||||
public readonly Bindable<int> SnapBindable = new Bindable<int>();
|
private readonly Bindable<int> Snap = new Bindable<int>();
|
||||||
|
|
||||||
public int Snap
|
|
||||||
{
|
|
||||||
get => SnapBindable.Value;
|
|
||||||
set => SnapBindable.Value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawableNote(Note hitObject)
|
public DrawableNote(Note hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
@ -61,10 +56,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
if (snapFinder != null)
|
if (snapFinder != null)
|
||||||
{
|
{
|
||||||
HitObject.StartTimeBindable.BindValueChanged(_ => Snap = snapFinder.FindSnap(HitObject), true);
|
HitObject.StartTimeBindable.BindValueChanged(_ => Snap.Value = snapFinder.FindSnap(HitObject), true);
|
||||||
|
|
||||||
SnapBindable.BindValueChanged(snap => updateSnapColour(configColourCodedNotes.Value, snap.NewValue), true);
|
Snap.BindValueChanged(_ => updateSnapColour(), true);
|
||||||
configColourCodedNotes.BindValueChanged(colourCode => updateSnapColour(colourCode.NewValue, Snap));
|
configColourCodedNotes.BindValueChanged(_ => updateSnapColour());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,18 +101,13 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
public virtual void OnReleased(ManiaAction action)
|
public virtual void OnReleased(ManiaAction action)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSnapColour(bool colourCode, int snap)
|
private void updateSnapColour()
|
||||||
{
|
{
|
||||||
if (colourCode)
|
Colour = configColourCodedNotes.Value
|
||||||
{
|
? (ColourInfo)BindableBeatDivisor.GetColourFor(Snap.Value, colours)
|
||||||
Colour = BindableBeatDivisor.GetColourFor(Snap, colours);
|
: (ColourInfo)Colour4.White;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Colour = Colour4.White;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user