mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 17:37:23 +09:00
Apply suggestions
This commit is contained in:
parent
63196df541
commit
9235cbff8d
@ -22,6 +22,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
|
private static readonly ColourInfo gradient_white_to_transparent_black = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0));
|
||||||
|
private static readonly ColourInfo gradient_transparent_black_to_white = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha));
|
||||||
|
|
||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
private readonly Box rightBox;
|
private readonly Box rightBox;
|
||||||
|
|
||||||
@ -30,6 +33,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private const float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f;
|
private const float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f;
|
||||||
private const int box_max_alpha = 200;
|
private const int box_max_alpha = 200;
|
||||||
private const double box_fade_in_time = 65;
|
private const double box_fade_in_time = 65;
|
||||||
|
private const int box_width = 300;
|
||||||
|
|
||||||
public MenuSideFlashes()
|
public MenuSideFlashes()
|
||||||
{
|
{
|
||||||
@ -44,47 +48,47 @@ namespace osu.Game.Screens.Menu
|
|||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = 300,
|
Width = box_width,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
BlendingMode = BlendingMode.Additive,
|
BlendingMode = BlendingMode.Additive,
|
||||||
ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)),
|
ColourInfo = gradient_white_to_transparent_black,
|
||||||
},
|
},
|
||||||
rightBox = new Box
|
rightBox = new Box
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = 300,
|
Width = box_width,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
BlendingMode = BlendingMode.Additive,
|
BlendingMode = BlendingMode.Additive,
|
||||||
ColourInfo = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)),
|
ColourInfo = gradient_transparent_black_to_white,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool kiai;
|
||||||
|
private double beatLength;
|
||||||
|
|
||||||
protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai)
|
protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai)
|
||||||
{
|
{
|
||||||
if (newBeat < 0)
|
if (newBeat < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes;
|
this.kiai = kiai;
|
||||||
if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0)
|
this.beatLength = beatLength;
|
||||||
{
|
|
||||||
leftBox.ClearTransforms();
|
|
||||||
leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65);
|
|
||||||
using (leftBox.BeginDelayedSequence(box_fade_in_time))
|
|
||||||
leftBox.FadeOut(beatLength, EasingTypes.In);
|
|
||||||
leftBox.DelayReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0)
|
||||||
|
flash(leftBox);
|
||||||
if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0)
|
if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0)
|
||||||
{
|
flash(rightBox);
|
||||||
rightBox.ClearTransforms();
|
}
|
||||||
rightBox.FadeTo(Math.Max(0, (amp.RightChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65);
|
|
||||||
using (rightBox.BeginDelayedSequence(box_fade_in_time))
|
private void flash(Drawable d)
|
||||||
rightBox.FadeOut(beatLength, EasingTypes.In);
|
{
|
||||||
rightBox.DelayReset();
|
TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes;
|
||||||
}
|
d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amp.LeftChannel : amp.RightChannel) - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), box_fade_in_time);
|
||||||
|
using (d.BeginDelayedSequence(box_fade_in_time))
|
||||||
|
d.FadeOut(beatLength, EasingTypes.In);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user