From a1547f12d426c1139afc749d75bdef963026c86a Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:38:21 -0500 Subject: [PATCH] Applied suggestions + Update Framework --- osu-framework | 2 +- osu.Game/Screens/Menu/MenuSideFlashes.cs | 50 +++++++++++------------- osu.Game/osu.Game.csproj | 1 + 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/osu-framework b/osu-framework index 42e26d49b9..9967572490 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 42e26d49b9046fcb96c123b0dfb48e06d741e162 +Subproject commit 9967572490ed2d1fa3c746311753c0cf00c08607 diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 76db6d1a06..4968da9689 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -4,6 +4,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Game.Graphics.Containers; @@ -11,7 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; -using osu.Framework.Audio.Track; +using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; namespace osu.Game.Screens.Menu { @@ -19,13 +20,14 @@ namespace osu.Game.Screens.Menu { public override bool HandleInput => false; - private Bindable beatmap = new Bindable(); + private readonly Bindable beatmap = new Bindable(); private Box leftBox; private Box rightBox; private const float amplitude_dead_zone = 0.25f; private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; + private const float kiai_multiplier = (1 - (amplitude_dead_zone * 0.9f)) / 0.8f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; @@ -45,7 +47,7 @@ namespace osu.Game.Screens.Menu Width = 300, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Transparent), + ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Black.Opacity(0)), }, rightBox = new Box { @@ -55,46 +57,38 @@ namespace osu.Game.Screens.Menu Width = 300, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = ColourInfo.GradientHorizontal(Color4.Transparent, new Color4(255, 255, 255, box_max_alpha)), + ColourInfo = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0), new Color4(255, 255, 255, box_max_alpha)), } }; } protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { - if (!beatmap?.Value?.Track?.IsRunning ?? false) + if (newBeat < 0) + return; + TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; + if (newBeat % (kiai ? 2 : (int)timeSignature) == 0) { - leftBox.FadeOut(50); - rightBox.FadeOut(50); + 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(); } - else if (newBeat >= 0) + if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) { - - TrackAmplitudes amp = beatmap.Value.Track.PeakAmplitudes; - bool nextIsLeft = newBeat % 2 == 0; - if (kiai ? nextIsLeft : newBeat % (int)timeSignature == 0) - { - leftBox.ClearTransforms(); - leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); - using (leftBox.BeginDelayedSequence(box_fade_in_time)) - leftBox.FadeOut(beatLength, EasingTypes.In); - leftBox.DelayReset(); - } - if (kiai ? !nextIsLeft : newBeat % (int)timeSignature == 0) - { - rightBox.ClearTransforms(); - rightBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / alpha_multiplier), 65); - using (rightBox.BeginDelayedSequence(box_fade_in_time)) - rightBox.FadeOut(beatLength, EasingTypes.In); - rightBox.DelayReset(); - } + 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)) + rightBox.FadeOut(beatLength, EasingTypes.In); + rightBox.DelayReset(); } } [BackgroundDependencyLoader] private void load(OsuGameBase game) { - beatmap = game.Beatmap; + beatmap.BindTo(game.Beatmap); } } } \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index b94c19e1f8..a5e57f10db 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -183,6 +183,7 @@ +