mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 06:42:56 +08:00
Add ghost ticks to exhibit current divisor on BeatDivisorControl
This commit is contained in:
parent
87ff28b022
commit
ebda35c3c9
@ -398,28 +398,25 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
ClearInternal();
|
||||
CurrentNumber.ValueChanged -= moveMarker;
|
||||
|
||||
foreach (int divisor in beatDivisor.ValidDivisors.Value.Presets)
|
||||
int largestDivisor = beatDivisor.ValidDivisors.Value.Presets.Max();
|
||||
for (int tickIndex = 0; tickIndex <= largestDivisor; tickIndex++)
|
||||
{
|
||||
AddInternal(new Tick(divisor)
|
||||
int divisor = largestDivisor;
|
||||
foreach (int validDivisor in beatDivisor.ValidDivisors.Value.Presets)
|
||||
{
|
||||
if (divisor > validDivisor && (tickIndex * validDivisor) % largestDivisor == 0)
|
||||
divisor = validDivisor;
|
||||
}
|
||||
bool solidTick = divisor * (largestDivisor - tickIndex) == largestDivisor;
|
||||
AddInternal(new Tick(solidTick, divisor)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Colour = BindableBeatDivisor.GetColourFor(divisor, colours),
|
||||
X = getMappedPosition(divisor),
|
||||
X = tickIndex / (float)largestDivisor,
|
||||
});
|
||||
}
|
||||
|
||||
// Add a fake 1/1 at the end to give context.
|
||||
AddInternal(new Tick(1)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.Centre,
|
||||
Depth = float.MaxValue,
|
||||
Alpha = 0.05f,
|
||||
Colour = BindableBeatDivisor.GetColourFor(1, colours),
|
||||
});
|
||||
|
||||
AddInternal(marker = new Marker());
|
||||
CurrentNumber.ValueChanged += moveMarker;
|
||||
CurrentNumber.TriggerChange();
|
||||
@ -428,6 +425,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
private void moveMarker(ValueChangedEvent<int> divisor)
|
||||
{
|
||||
marker.MoveToX(getMappedPosition(divisor.NewValue), 100, Easing.OutQuint);
|
||||
|
||||
foreach (Tick child in InternalChildren.OfType<Tick>())
|
||||
{
|
||||
float newAlpha = child.Solid ? 1f : divisor.NewValue % child.Divisor == 0 ? 0.2f : 0f;
|
||||
child.FadeTo(newAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
@ -497,8 +500,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
private partial class Tick : Circle
|
||||
{
|
||||
public Tick(int divisor)
|
||||
public bool Solid;
|
||||
public int Divisor;
|
||||
public Tick(bool solid, int divisor)
|
||||
{
|
||||
Solid = solid;
|
||||
Divisor = divisor;
|
||||
Size = new Vector2(6f, 12) * BindableBeatDivisor.GetSize(divisor);
|
||||
InternalChild = new Box { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user