From 4e83f12f34c8287a08dcec547ae5251285d55372 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sat, 20 May 2017 11:02:42 -0500 Subject: [PATCH 01/42] Initial implementation Note this won't work with the osu!bgm because it is not a beatmap --- osu.Game/Screens/Menu/MainMenu.cs | 3 +- osu.Game/Screens/Menu/MenuSideFlashes.cs | 95 ++++++++++++++++++++++++ osu.Game/osu.Game.csproj | 1 + 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/Menu/MenuSideFlashes.cs diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 71d020b0f2..269c20fff9 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -54,7 +54,8 @@ namespace osu.Game.Screens.Menu OnSolo = delegate { Push(consumeSongSelect()); }, OnMulti = delegate { Push(new Lobby()); }, OnExit = delegate { Exit(); }, - } + }, + new MenuSideFlashes(), } } }; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs new file mode 100644 index 0000000000..fa308dc2a6 --- /dev/null +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -0,0 +1,95 @@ +using OpenTK.Graphics; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Game.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Timing; +using System; + +namespace osu.Game.Screens.Menu +{ + public class MenuSideFlashes : BeatSyncedContainer + { + public override bool HandleInput => false; + + private Bindable beatmap = new Bindable(); + + private Box leftBox; + private Box rightBox; + + private const int amplitude_dead_zone = 9000; + private const float alpha_multiplier = (short.MaxValue - amplitude_dead_zone) / 0.55f; + private const int box_max_alpha = 200; + private const double box_fade_in_time = 65; + + public MenuSideFlashes() + { + RelativeSizeAxes = Axes.Both; + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + BlendingMode = BlendingMode.Additive; + Children = new Drawable[] + { + leftBox = new Box + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Y, + Width = 300, + Alpha = 0, + BlendingMode = BlendingMode.Additive, + ColourInfo = ColourInfo.GradientHorizontal(new Color4(255, 255, 255, box_max_alpha), Color4.Transparent), + }, + rightBox = new Box + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + RelativeSizeAxes = Axes.Y, + Width = 300, + Alpha = 0, + BlendingMode = BlendingMode.Additive, + ColourInfo = ColourInfo.GradientHorizontal(Color4.Transparent, 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) + { + leftBox.FadeOut(50); + rightBox.FadeOut(50); + } + else if (newBeat >= 0) + { + short[] lev = beatmap.Value.Track.ChannelPeakAmplitudes; + bool nextIsLeft = newBeat % 2 == 0; + if (kiai ? nextIsLeft : newBeat % (int)timeSignature == 0) + { + leftBox.ClearTransforms(); + leftBox.FadeTo(Math.Max(0, (lev[0] - 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, (lev[1] - amplitude_dead_zone) / 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; + } + } +} \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 18c483fe40..8fd7b398a2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -183,6 +183,7 @@ + From d5904499f740b0604a9e83f041162e85c7d0055a Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sat, 20 May 2017 11:41:16 -0500 Subject: [PATCH 02/42] Post merge fixes --- osu.Game/osu.Game.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ee906caa9b..49f453a495 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -78,6 +78,7 @@ + @@ -186,6 +187,7 @@ + From 38a566890f392e946321c8d4cb134d8b671190b6 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sat, 20 May 2017 11:44:19 -0500 Subject: [PATCH 03/42] Add licence header --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index fa308dc2a6..079b3c92c4 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -1,4 +1,7 @@ -using OpenTK.Graphics; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; From 059af0850b42ec57851194dffc226f1c9a844967 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Sun, 21 May 2017 23:47:08 -0500 Subject: [PATCH 04/42] Changes in-line with framework --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 079b3c92c4..76db6d1a06 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; +using osu.Framework.Audio.Track; namespace osu.Game.Screens.Menu { @@ -23,8 +24,8 @@ namespace osu.Game.Screens.Menu private Box leftBox; private Box rightBox; - private const int amplitude_dead_zone = 9000; - private const float alpha_multiplier = (short.MaxValue - amplitude_dead_zone) / 0.55f; + private const float amplitude_dead_zone = 0.25f; + private const float alpha_multiplier = (1 - amplitude_dead_zone) / 0.55f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; @@ -68,12 +69,13 @@ namespace osu.Game.Screens.Menu } else if (newBeat >= 0) { - short[] lev = beatmap.Value.Track.ChannelPeakAmplitudes; + + 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, (lev[0] - amplitude_dead_zone) / alpha_multiplier), 65); + 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(); @@ -81,7 +83,7 @@ namespace osu.Game.Screens.Menu if (kiai ? !nextIsLeft : newBeat % (int)timeSignature == 0) { rightBox.ClearTransforms(); - rightBox.FadeTo(Math.Max(0, (lev[1] - amplitude_dead_zone) / alpha_multiplier), 65); + 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(); From f9eb448f162915e1d7293652635a417a2dbed825 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 15:29:17 +0900 Subject: [PATCH 05/42] Implement DrawableNote hits. --- .../Objects/Drawables/DrawableNote.cs | 45 +++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index d0519c61a8..48cfcd66cd 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -1,10 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Input; +using osu.Game.Rulesets.Mania.Judgements; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; using osu.Game.Rulesets.Objects.Drawables; @@ -40,14 +43,50 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables } } - protected override void Update() + protected override void CheckJudgement(bool userTriggered) { - if (Time.Current > HitObject.StartTime) - Colour = Color4.Green; + if (!userTriggered) + { + if (Judgement.TimeOffset > HitObject.HitWindows.Bad / 2) + Judgement.Result = HitResult.Miss; + return; + } + + double offset = Math.Abs(Judgement.TimeOffset); + + if (offset > HitObject.HitWindows.Miss / 2) + return; + + ManiaHitResult? tmpResult = HitObject.HitWindows.ResultFor(offset); + + if (tmpResult.HasValue) + { + Judgement.Result = HitResult.Hit; + Judgement.ManiaResult = tmpResult.Value; + } + else + Judgement.Result = HitResult.Miss; } protected override void UpdateState(ArmedState state) { + switch (State) + { + case ArmedState.Hit: + Colour = Color4.Green; + break; + } + } + + protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + { + if (Judgement.Result != HitResult.None) + return false; + + if (args.Key != Key) + return false; + + return UpdateJudgement(true); } } } From 4200e05fe702acb5673cc3c99db7f773f3a94660 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Mon, 22 May 2017 16:42:14 +0900 Subject: [PATCH 06/42] Don't handle repeat keys. --- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 48cfcd66cd..42bb371975 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -86,6 +86,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables if (args.Key != Key) return false; + if (args.Repeat) + return false; + return UpdateJudgement(true); } } From a1547f12d426c1139afc749d75bdef963026c86a Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:38:21 -0500 Subject: [PATCH 07/42] 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 @@ + From f2b5be27c8581da525b50179638e4282eb28491c Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:53:32 -0500 Subject: [PATCH 08/42] CI Fixes --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 4968da9689..b961cd9adb 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -22,12 +22,12 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); - private Box leftBox; - private Box rightBox; + private readonly Box leftBox; + private readonly 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 float kiai_multiplier = (1 - amplitude_dead_zone * 0.95f) / 0.8f; private const int box_max_alpha = 200; private const double box_fade_in_time = 65; From 601b840713df654f2dd6855e2156c04673e0f999 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 04:55:33 -0500 Subject: [PATCH 09/42] Apply suggestions --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index b961cd9adb..7e2b6b988a 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -66,8 +66,9 @@ namespace osu.Game.Screens.Menu { if (newBeat < 0) return; + TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (newBeat % (kiai ? 2 : (int)timeSignature) == 0) + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature) == 0) { leftBox.ClearTransforms(); leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); @@ -75,6 +76,7 @@ namespace osu.Game.Screens.Menu leftBox.FadeOut(beatLength, EasingTypes.In); leftBox.DelayReset(); } + if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) { rightBox.ClearTransforms(); From 63196df541280dee0e60b498e03dd44dd0c8a5f4 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 05:05:54 -0500 Subject: [PATCH 10/42] Typo fix Forgot the pharenteses --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 7e2b6b988a..aee501461a 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Menu return; TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature) == 0) + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) { leftBox.ClearTransforms(); leftBox.FadeTo(Math.Max(0, (amp.LeftChannel - amplitude_dead_zone) / (kiai ? kiai_multiplier : alpha_multiplier)), 65); From 9235cbff8d4c543413bac65e5e53b12ef19f7cf9 Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Mon, 22 May 2017 05:59:16 -0500 Subject: [PATCH 11/42] Apply suggestions --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 44 +++++++++++++----------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index aee501461a..61d3ef10a8 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -22,6 +22,9 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); + 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 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 int box_max_alpha = 200; private const double box_fade_in_time = 65; + private const int box_width = 300; public MenuSideFlashes() { @@ -44,47 +48,47 @@ namespace osu.Game.Screens.Menu Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Y, - Width = 300, + Width = box_width, Alpha = 0, 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 { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, - Width = 300, + Width = box_width, Alpha = 0, 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) { if (newBeat < 0) return; - TrackAmplitudes amp = beatmap.Value.Track.CurrentAmplitudes; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - { - 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(); - } + this.kiai = kiai; + this.beatLength = beatLength; + if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) + flash(leftBox); if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - { - 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(); - } + flash(rightBox); + } + + private void flash(Drawable d) + { + 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] From 3e0aaa1aa0ab8a3bf1bda52674b0d82c63ec313d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 12:29:43 +0900 Subject: [PATCH 12/42] Add basic beat response to osu! logo --- .../Containers/BeatSyncedContainer.cs | 9 +- osu.Game/Screens/Menu/OsuLogo.cs | 173 ++++++++++-------- 2 files changed, 106 insertions(+), 76 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index dfb742f7d1..b9a7183338 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -16,12 +16,19 @@ namespace osu.Game.Graphics.Containers private int lastBeat; private ControlPoint lastControlPoint; + /// + /// The amount of time before a beat we should fire . + /// This allows for adding easing to animations that may be synchronised to the beat. + /// + protected double EarlyActivationMilliseconds; + protected override void Update() { if (beatmap.Value?.Track == null) return; - double currentTrackTime = beatmap.Value.Track.CurrentTime; + double currentTrackTime = beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; + ControlPoint overridePoint; ControlPoint controlPoint = beatmap.Value.Beatmap.TimingInfo.TimingPointAt(currentTrackTime, out overridePoint); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index e28adeacff..5f9a3bf655 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -12,21 +12,24 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; +using osu.Game.Beatmaps.Timing; namespace osu.Game.Screens.Menu { /// /// osu! logo and its attachments (pulsing, visualiser etc.) /// - public class OsuLogo : Container + public class OsuLogo : BeatSyncedContainer { public readonly Color4 OsuPink = OsuColour.FromHex(@"e967a1"); private readonly Sprite logo; private readonly CircularContainer logoContainer; private readonly Container logoBounceContainer; + private readonly Container logoBeatContainer; private readonly Container logoHoverContainer; private SampleChannel sampleClick; @@ -67,8 +70,12 @@ namespace osu.Game.Screens.Menu private const float default_size = 480; + private const double beat_in_time = 60; + public OsuLogo() { + EarlyActivationMilliseconds = beat_in_time; + Size = new Vector2(default_size); Anchor = Anchor.Centre; @@ -78,109 +85,116 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - logoBounceContainer = new Container + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoHoverContainer = new Container + logoBounceContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new BufferedContainer + logoHoverContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoContainer = new CircularContainer + new BufferedContainer + { + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + logoContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.88f), + Masking = true, + Children = new Drawable[] + { + colourAndTriangles = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuPink, + }, + new Triangles + { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + }, + } + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = Color4.White, + Alpha = 0, + }, + }, + }, + logo = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + } + }, + rippleContainer = new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.88f), + Children = new Drawable[] + { + ripple = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BlendingMode = BlendingMode.Additive, + Alpha = 0.15f + } + } + }, + impactContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Alpha = 0, + BorderColour = Color4.White, + RelativeSizeAxes = Axes.Both, + BorderThickness = 10, Masking = true, Children = new Drawable[] { - colourAndTriangles = new Container + new Box { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuPink, - }, - new Triangles - { - TriangleScale = 4, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - }, - } - }, - flashLayer = new Box - { - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = Color4.White, + AlwaysPresent = true, Alpha = 0, - }, - }, + } + } }, - logo = new Sprite + new MenuVisualisation { Anchor = Anchor.Centre, Origin = Anchor.Centre, - }, - } - }, - rippleContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ripple = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlendingMode = BlendingMode.Additive, - Alpha = 0.15f - } - } - }, - impactContainer = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0, - BorderColour = Color4.White, - RelativeSizeAxes = Axes.Both, - BorderThickness = 10, - Masking = true, - Children = new Drawable[] - { - new Box - { RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - Alpha = 0, + BlendingMode = BlendingMode.Additive, + Alpha = 0.2f, } } - }, - new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Alpha = 0.2f, } } } @@ -206,6 +220,15 @@ namespace osu.Game.Screens.Menu ripple.Loop(300); } + protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) + { + base.OnNewBeat(newBeat, beatLength, timeSignature, kiai); + + logoBeatContainer.ScaleTo(0.97f, beat_in_time, EasingTypes.Out); + using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) + logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) return false; From 7e5bb61a44daf7ce3e57de1bf5d476830b560d52 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 16:13:51 +0900 Subject: [PATCH 13/42] Fix line endings. --- .../Timing/TimingChange.cs | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Timing/TimingChange.cs b/osu.Game.Rulesets.Mania/Timing/TimingChange.cs index fb6f1d2db1..9153ba6991 100644 --- a/osu.Game.Rulesets.Mania/Timing/TimingChange.cs +++ b/osu.Game.Rulesets.Mania/Timing/TimingChange.cs @@ -1,23 +1,23 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Rulesets.Mania.Timing -{ - public class TimingChange - { - /// - /// The time at which this timing change happened. - /// - public double Time; - - /// - /// The beat length. - /// - public double BeatLength = 500; - - /// - /// The speed multiplier. - /// - public double SpeedMultiplier = 1; - } +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Rulesets.Mania.Timing +{ + public class TimingChange + { + /// + /// The time at which this timing change happened. + /// + public double Time; + + /// + /// The beat length. + /// + public double BeatLength = 500; + + /// + /// The speed multiplier. + /// + public double SpeedMultiplier = 1; + } } \ No newline at end of file From fe7ac20e292cbd014a1d6d15a41f3756da83c008 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 16:26:51 +0900 Subject: [PATCH 14/42] Read menu music from osz resource --- osu-resources | 2 +- .../Beatmaps/IO/LegacyFilesystemReader.cs | 2 + osu.Game/Beatmaps/IO/ArchiveReader.cs | 2 + osu.Game/Beatmaps/IO/OszArchiveReader.cs | 2 + osu.Game/Database/BeatmapDatabase.cs | 113 +++++++++--------- osu.Game/OsuGame.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 49 +++++++- osu.Game/Screens/Menu/MainMenu.cs | 32 +---- 8 files changed, 111 insertions(+), 93 deletions(-) diff --git a/osu-resources b/osu-resources index ffccbeb98d..9f46a456dc 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit ffccbeb98dc9e8f0965520270b5885e63f244c83 +Subproject commit 9f46a456dc3a56dcbff09671a3f588b16a464106 diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index 8c896646bf..8772fc9f28 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -37,5 +37,7 @@ namespace osu.Desktop.Beatmaps.IO { // no-op } + + public override Stream GetUnderlyingStream() => null; } } diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index 9d7d67007e..7ff5668b6f 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -63,5 +63,7 @@ namespace osu.Game.Beatmaps.IO return buffer; } } + + public abstract Stream GetUnderlyingStream(); } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index 6c550def8d..eb9e740779 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -49,5 +49,7 @@ namespace osu.Game.Beatmaps.IO archive.Dispose(); archiveStream.Dispose(); } + + public override Stream GetUnderlyingStream() => archiveStream; } } \ No newline at end of file diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index bd25ebe8a9..efd5631077 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -12,6 +12,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.IO; using osu.Game.IPC; +using osu.Game.Screens.Menu; using SQLite.Net; using SQLiteNetExtensions.Extensions; @@ -38,6 +39,10 @@ namespace osu.Game.Database { foreach (var b in GetAllWithChildren(b => b.DeletePending)) { + if (b.Hash == Intro.MENU_MUSIC_BEATMAP_HASH) + // this is a bit hacky, but will do for now. + continue; + try { Storage.Delete(b.Path); @@ -97,50 +102,49 @@ namespace osu.Game.Database typeof(BeatmapDifficulty), }; + public void Import(string path) + { + try + { + Import(ArchiveReader.GetReader(Storage, path)); + + // We may or may not want to delete the file depending on where it is stored. + // e.g. reconstructing/repairing database with beatmaps from default storage. + // Also, not always a single file, i.e. for LegacyFilesystemReader + // TODO: Add a check to prevent files from storage to be deleted. + try + { + File.Delete(path); + } + catch (Exception e) + { + Logger.Error(e, $@"Could not delete file at {path}"); + } + } + catch (Exception e) + { + e = e.InnerException ?? e; + Logger.Error(e, @"Could not import beatmap set"); + } + } + + public void Import(ArchiveReader archiveReader) + { + BeatmapSetInfo set = getBeatmapSet(archiveReader); + + //If we have an ID then we already exist in the database. + if (set.ID == 0) + Import(new[] { set }); + } + /// /// Import multiple from . /// /// Multiple locations on disk - public void Import(IEnumerable paths) + public void Import(params string[] paths) { foreach (string p in paths) - { - try - { - BeatmapSetInfo set = getBeatmapSet(p); - - //If we have an ID then we already exist in the database. - if (set.ID == 0) - Import(new[] { set }); - - // We may or may not want to delete the file depending on where it is stored. - // e.g. reconstructing/repairing database with beatmaps from default storage. - // Also, not always a single file, i.e. for LegacyFilesystemReader - // TODO: Add a check to prevent files from storage to be deleted. - try - { - File.Delete(p); - } - catch (Exception e) - { - Logger.Error(e, $@"Could not delete file at {p}"); - } - } - catch (Exception e) - { - e = e.InnerException ?? e; - Logger.Error(e, @"Could not import beatmap set"); - } - } - } - - /// - /// Import from . - /// - /// Location on disk - public void Import(string path) - { - Import(new[] { path }); + Import(p); } /// @@ -148,29 +152,26 @@ namespace osu.Game.Database /// /// Content location /// - private BeatmapSetInfo getBeatmapSet(string path) - { - string hash = null; + private BeatmapSetInfo getBeatmapSet(string path) => getBeatmapSet(ArchiveReader.GetReader(Storage, path)); + private BeatmapSetInfo getBeatmapSet(ArchiveReader archiveReader) + { BeatmapMetadata metadata; - using (var reader = ArchiveReader.GetReader(Storage, path)) - { - using (var stream = new StreamReader(reader.GetStream(reader.BeatmapFilenames[0]))) - metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - } + using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.BeatmapFilenames[0]))) + metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata; - if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader + string hash; + string path; + + using (var input = archiveReader.GetUnderlyingStream()) { - using (var input = Storage.GetStream(path)) - { - hash = input.GetMd5Hash(); - input.Seek(0, SeekOrigin.Begin); - path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); - if (!Storage.Exists(path)) - using (var output = Storage.GetStream(path, FileAccess.Write)) - input.CopyTo(output); - } + hash = input.GetMd5Hash(); + input.Seek(0, SeekOrigin.Begin); + path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash); + if (!Storage.Exists(path)) + using (var output = Storage.GetStream(path, FileAccess.Write)) + input.CopyTo(output); } var existing = Connection.Table().FirstOrDefault(b => b.Hash == hash); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 4cf436a8e4..f13043a745 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -82,7 +82,7 @@ namespace osu.Game if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith(@"-")); - Task.Run(() => BeatmapDatabase.Import(paths)); + Task.Run(() => BeatmapDatabase.Import(paths.ToArray())); } Dependencies.Cache(this); diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 01659edd72..5791b7f196 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -8,7 +8,10 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Framework.Graphics; +using osu.Framework.MathUtils; +using osu.Game.Beatmaps.IO; using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using OpenTK.Graphics; @@ -19,6 +22,8 @@ namespace osu.Game.Screens.Menu { private readonly OsuLogo logo; + public const string MENU_MUSIC_BEATMAP_HASH = "21c1271b91234385978b5418881fdd88"; + /// /// Whether we have loaded the menu previously. /// @@ -27,7 +32,6 @@ namespace osu.Game.Screens.Menu private MainMenu mainMenu; private SampleChannel welcome; private SampleChannel seeya; - private Track bgm; internal override bool HasLocalCursorDisplayed => true; @@ -60,15 +64,49 @@ namespace osu.Game.Screens.Menu private Bindable menuVoice; private Bindable menuMusic; + private Track track; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config) + private void load(AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps, Framework.Game game) { menuVoice = config.GetBindable(OsuSetting.MenuVoice); menuMusic = config.GetBindable(OsuSetting.MenuMusic); - bgm = audio.Track.Get(@"circles"); - bgm.Looping = true; + var trackManager = audio.Track; + + BeatmapSetInfo setInfo = null; + + if (!menuMusic) + { + var query = beatmaps.Query().Where(b => !b.DeletePending); + int count = query.Count(); + if (count > 0) + setInfo = query.ElementAt(RNG.Next(0, count - 1)); + } + + if (setInfo == null) + { + var query = beatmaps.Query().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH); + + setInfo = query.FirstOrDefault(); + + if (setInfo == null) + { + // we need to import the default menu background beatmap + beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"))); + + setInfo = query.First(); + + setInfo.DeletePending = true; + beatmaps.Update(setInfo, false); + } + } + + beatmaps.GetChildren(setInfo); + Beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); + + track = Beatmap.Track; + trackManager.SetExclusive(track); welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); @@ -83,8 +121,7 @@ namespace osu.Game.Screens.Menu Scheduler.AddDelayed(delegate { - if (menuMusic) - bgm.Start(); + track.Start(); LoadComponentAsync(mainMenu = new MainMenu()); diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 71d020b0f2..b74ee52f9c 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -1,18 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Threading.Tasks; using OpenTK; using OpenTK.Input; using osu.Framework.Allocation; -using osu.Framework.Audio.Track; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; -using osu.Framework.MathUtils; using osu.Framework.Screens; -using osu.Game.Configuration; -using osu.Game.Database; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -60,30 +54,11 @@ namespace osu.Game.Screens.Menu }; } - private Bindable menuMusic; - private TrackManager trackManager; - [BackgroundDependencyLoader] - private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) + private void load(OsuGame game) { - menuMusic = config.GetBindable(OsuSetting.MenuMusic); LoadComponentAsync(background); - if (!menuMusic) - { - trackManager = game.Audio.Track; - - var query = beatmaps.Query().Where(b => !b.DeletePending); - int count = query.Count(); - - if (count > 0) - { - var beatmap = query.ElementAt(RNG.Next(0, count - 1)); - beatmaps.GetChildren(beatmap); - Beatmap = beatmaps.GetWorkingBeatmap(beatmap.Beatmaps[0]); - } - } - buttons.OnSettings = game.ToggleSettings; preloadSongSelect(); @@ -108,14 +83,13 @@ namespace osu.Game.Screens.Menu buttons.FadeInFromZero(500); if (last is Intro && Beatmap != null) { - Task.Run(() => + if (!Beatmap.Track.IsRunning) { - trackManager.SetExclusive(Beatmap.Track); Beatmap.Track.Seek(Beatmap.Metadata.PreviewTime); if (Beatmap.Metadata.PreviewTime == -1) Beatmap.Track.Seek(Beatmap.Track.Length * 0.4f); Beatmap.Track.Start(); - }); + } } } From 73320f9a7ea8acd293830ee2af1053efc418f948 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 15:29:23 +0900 Subject: [PATCH 15/42] Don't bounce the ripple Also ripple better. --- osu.Game/Screens/Menu/OsuLogo.cs | 57 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 5f9a3bf655..738204e30e 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - logoBeatContainer = new Container + logoHoverContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -95,7 +95,23 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoHoverContainer = new Container + rippleContainer = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + ripple = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + BlendingMode = BlendingMode.Additive, + Alpha = 0 + } + } + }, + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] @@ -151,22 +167,6 @@ namespace osu.Game.Screens.Menu }, } }, - rippleContainer = new Container - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Children = new Drawable[] - { - ripple = new Sprite - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - BlendingMode = BlendingMode.Additive, - Alpha = 0.15f - } - } - }, impactContainer = new CircularContainer { Anchor = Anchor.Centre, @@ -211,22 +211,23 @@ namespace osu.Game.Screens.Menu ripple.Texture = textures.Get(@"Menu/logo"); } - protected override void LoadComplete() - { - base.LoadComplete(); - - ripple.ScaleTo(ripple.Scale * 1.1f, 500); - ripple.FadeOut(500); - ripple.Loop(300); - } - protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { base.OnNewBeat(newBeat, beatLength, timeSignature, kiai); - logoBeatContainer.ScaleTo(0.97f, beat_in_time, EasingTypes.Out); + if (newBeat < 0) return; + + logoBeatContainer.ScaleTo(0.98f, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); + + ripple.ClearTransforms(); + + ripple.ScaleTo(Vector2.One); + ripple.Alpha = 0.15f; + + ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); + ripple.FadeOut(beatLength); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From 2decb2b2ff929f5a782592a1563fb32073b429ef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 16:27:01 +0900 Subject: [PATCH 16/42] Add more flashiness during kiai time --- osu.Game/Screens/Menu/OsuLogo.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 738204e30e..74fc7a3f87 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -228,6 +228,15 @@ namespace osu.Game.Screens.Menu ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); ripple.FadeOut(beatLength); + + if (kiai && flashLayer.Alpha < 0.4f) + { + flashLayer.ClearTransforms(); + + flashLayer.FadeTo(0.14f, beat_in_time, EasingTypes.Out); + using (flashLayer.BeginDelayedSequence(beat_in_time)) + flashLayer.FadeOut(beatLength); + } } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) From a4823bca91514e34b39ebd5b62e50fd096ae7980 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 16:47:47 +0900 Subject: [PATCH 17/42] CI fixes. --- osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs | 2 +- osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs index 6d390464fe..cc8897840e 100644 --- a/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs +++ b/osu.Game.Rulesets.Mania/Timing/ControlPointContainer.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Mania.Timing /// public double TimeSpan { get; set; } - private readonly List drawableControlPoints = new List(); + private readonly List drawableControlPoints; public ControlPointContainer(IEnumerable timingChanges) { diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs index 4f87467706..82ceaeed1a 100644 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObject.cs @@ -31,12 +31,12 @@ namespace osu.Game.Rulesets.Taiko.Objects public const float DEFAULT_STRONG_CIRCLE_DIAMETER = DEFAULT_CIRCLE_DIAMETER * STRONG_CIRCLE_DIAMETER_SCALE; /// - /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. + /// The time taken from the initial (off-screen) spawn position to the centre of the hit target for a of 1000ms. /// private const double scroll_time = 6000; /// - /// Our adjusted taking into consideration local and other speed multipliers. + /// Our adjusted taking into consideration local and other speed multipliers. /// public double ScrollTime; From 0dd52e4e2930509788aa71a1eaaa47b2082a03d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 May 2017 17:26:28 +0900 Subject: [PATCH 18/42] Various refactoring --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 44 +++++++++++------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 61d3ef10a8..ced6d179d6 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . +// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Timing; using System; +using osu.Game.Graphics; using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; namespace osu.Game.Screens.Menu @@ -22,25 +23,22 @@ namespace osu.Game.Screens.Menu private readonly Bindable beatmap = new Bindable(); - 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 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.95f) / 0.8f; + private const int box_max_alpha = 200; private const double box_fade_in_time = 65; - private const int box_width = 300; + private const int box_width = 200; public MenuSideFlashes() { RelativeSizeAxes = Axes.Both; Anchor = Anchor.Centre; Origin = Anchor.Centre; - BlendingMode = BlendingMode.Additive; Children = new Drawable[] { leftBox = new Box @@ -51,7 +49,6 @@ namespace osu.Game.Screens.Menu Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = gradient_white_to_transparent_black, }, rightBox = new Box { @@ -61,40 +58,41 @@ namespace osu.Game.Screens.Menu Width = box_width, Alpha = 0, BlendingMode = BlendingMode.Additive, - ColourInfo = gradient_transparent_black_to_white, } }; } - private bool kiai; - private double beatLength; + [BackgroundDependencyLoader] + private void load(OsuGameBase game, OsuColour colours) + { + beatmap.BindTo(game.Beatmap); + + // linear colour looks better in this case, so let's use it for now. + Color4 gradientDark = colours.Blue.Opacity(0).ToLinear(); + Color4 gradientLight = colours.Blue.Opacity(0.3f).ToLinear(); + + leftBox.ColourInfo = ColourInfo.GradientHorizontal(gradientLight, gradientDark); + rightBox.ColourInfo = ColourInfo.GradientHorizontal(gradientDark, gradientLight); + } protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) { if (newBeat < 0) return; - this.kiai = kiai; - this.beatLength = beatLength; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - flash(leftBox); + flash(leftBox, beatLength, kiai); if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - flash(rightBox); + flash(rightBox, beatLength, kiai); } - private void flash(Drawable d) + private void flash(Drawable d, double beatLength, bool kiai) { 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] - private void load(OsuGameBase game) - { - beatmap.BindTo(game.Beatmap); - } } -} \ No newline at end of file +} From eafe215169b6ba92b813e280d2681e76b7d1b723 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 11:53:12 +0300 Subject: [PATCH 19/42] Simplify Hud visibility change --- osu.Game/Screens/Play/HUDOverlay.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1e57c2ba2a..34522d74ef 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -30,7 +30,6 @@ namespace osu.Game.Screens.Play public readonly SongProgress Progress; public readonly ModDisplay ModDisplay; - private Bindable showKeyCounter; private Bindable showHud; private static bool hasShownNotificationOnce; @@ -46,6 +45,7 @@ namespace osu.Game.Screens.Play protected HUDOverlay() { RelativeSizeAxes = Axes.Both; + AlwaysPresent = true; Add(content = new Container { @@ -67,24 +67,8 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader(true)] private void load(OsuConfigManager config, NotificationManager notificationManager) { - showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); - showKeyCounter.ValueChanged += keyCounterVisibility => - { - if (keyCounterVisibility) - KeyCounter.FadeIn(duration); - else - KeyCounter.FadeOut(duration); - }; - showKeyCounter.TriggerChange(); - showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += hudVisibility => - { - if (hudVisibility) - content.FadeIn(duration); - else - content.FadeOut(duration); - }; + showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); if (!showHud && !hasShownNotificationOnce) From 4b23cc47eae4d81a2a2a6d4072d5498b9de836ed Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 11:53:42 +0300 Subject: [PATCH 20/42] Moved KeyCounter visibility logic to it's own class --- osu.Game/Screens/Play/KeyCounterCollection.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 4a561e6036..e53a1dcd99 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -6,14 +6,22 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK.Graphics; using osu.Framework.Input; +using osu.Framework.Configuration; +using osu.Framework.Allocation; +using osu.Game.Configuration; namespace osu.Game.Screens.Play { public class KeyCounterCollection : FillFlowContainer { + private const int duration = 100; + + private Bindable showKeyCounter; + public KeyCounterCollection() { AlwaysReceiveInput = true; + AlwaysPresent = true; Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; @@ -34,6 +42,14 @@ namespace osu.Game.Screens.Play counter.ResetCount(); } + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + showKeyCounter = config.GetBindable(OsuSetting.KeyOverlay); + showKeyCounter.ValueChanged += keyCounterVisibility => FadeTo(keyCounterVisibility ? 1 : 0, duration); + showKeyCounter.TriggerChange(); + } + //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor private bool isCounting; public bool IsCounting From 76fe4af9a6c68650ae3ebdbdeb768b08d424638e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Tue, 23 May 2017 18:06:31 +0900 Subject: [PATCH 21/42] Fix visual test failing. --- osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index ec50f19f98..9dcba02849 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -41,7 +41,7 @@ namespace osu.Desktop.VisualTests.Tests Clear(); ManiaPlayfield playField; - Add(playField = new ManiaPlayfield(cols, new List()) + Add(playField = new ManiaPlayfield(cols, new List { new TimingChange { BeatLength = 200 } }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From c7a241246ecb912897aded1faf75203589f66614 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:09:32 +0300 Subject: [PATCH 22/42] Better letterbox settings transition --- .../Sections/Graphics/LayoutSettings.cs | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 9a5fd769cd..8b093c8d79 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Settings.Sections.Graphics { @@ -11,11 +12,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { protected override string Header => "Layout"; - private SettingsSlider letterboxPositionX; - private SettingsSlider letterboxPositionY; + private FillFlowContainer letterboxSettings; private Bindable letterboxing; + private const int letterbox_container_height = 75; + private const int duration = 200; + [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) { @@ -33,34 +36,30 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics LabelText = "Letterboxing", Bindable = letterboxing, }, - letterboxPositionX = new SettingsSlider + letterboxSettings = new FillFlowContainer { - LabelText = "Horizontal position", - Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX) - }, - letterboxPositionY = new SettingsSlider - { - LabelText = "Vertical position", - Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY) + Direction = FillDirection.Vertical, + RelativeSizeAxes = Axes.X, + Masking = true, + + Children = new Drawable[] + { + new SettingsSlider + { + LabelText = "Horizontal position", + Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX) + }, + new SettingsSlider + { + LabelText = "Vertical position", + Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY) + }, + } }, }; - letterboxing.ValueChanged += visibilityChanged; + letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint); letterboxing.TriggerChange(); } - - private void visibilityChanged(bool newVisibility) - { - if (newVisibility) - { - letterboxPositionX.Show(); - letterboxPositionY.Show(); - } - else - { - letterboxPositionX.Hide(); - letterboxPositionY.Hide(); - } - } } } From 2e28b10c3678518e496801d799b9b5f6239ad56f Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:24:16 +0300 Subject: [PATCH 23/42] CI fixes and removed useless property --- osu.Game/Screens/Play/HUDOverlay.cs | 3 +-- osu.Game/Screens/Play/KeyCounterCollection.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 34522d74ef..115611c244 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -45,7 +45,6 @@ namespace osu.Game.Screens.Play protected HUDOverlay() { RelativeSizeAxes = Axes.Both; - AlwaysPresent = true; Add(content = new Container { @@ -68,7 +67,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config, NotificationManager notificationManager) { showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += hudVisibility => FadeTo(hudVisibility ? 1 : 0, duration); + showHud.ValueChanged += hudVisibility => content.FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); if (!showHud && !hasShownNotificationOnce) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index e53a1dcd99..6e1c8a34e5 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -21,7 +21,6 @@ namespace osu.Game.Screens.Play public KeyCounterCollection() { AlwaysReceiveInput = true; - AlwaysPresent = true; Direction = FillDirection.Horizontal; AutoSizeAxes = Axes.Both; From 165d6ef1bb19e6c5079dbd95e2afced50f437adc Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 12:30:39 +0300 Subject: [PATCH 24/42] Make transition a bit smoother --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 8b093c8d79..8ff145823c 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; private const int letterbox_container_height = 75; - private const int duration = 200; + private const int duration = 300; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) From 564abc1a5bc171a7f62e5f0568fa17ec87efeffa Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Tue, 23 May 2017 14:32:45 +0300 Subject: [PATCH 25/42] using autosize instead of constant height --- .../Settings/Sections/Graphics/LayoutSettings.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 8ff145823c..ea9ccd3492 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -16,8 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable letterboxing; - private const int letterbox_container_height = 75; - private const int duration = 300; + private const int transition_duration = 400; [BackgroundDependencyLoader] private void load(FrameworkConfigManager config) @@ -40,6 +39,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + AutoSizeDuration = transition_duration, + AutoSizeEasing = EasingTypes.OutQuint, Masking = true, Children = new Drawable[] @@ -58,7 +60,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - letterboxing.ValueChanged += isVisible => letterboxSettings.ResizeHeightTo(isVisible ? letterbox_container_height : 0, duration, EasingTypes.OutQuint); + letterboxing.ValueChanged += isVisible => + { + letterboxSettings.ClearTransforms(); + letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; + + if(!isVisible) + letterboxSettings.ResizeHeightTo(0, transition_duration, EasingTypes.OutQuint); + }; letterboxing.TriggerChange(); } } From 7628cdf52244ab3113fa51b635387871a0d86d82 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 01:38:04 +0900 Subject: [PATCH 26/42] Return first control point in the list if the time is before it. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 5740c961b1..6809c417a4 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -82,7 +82,7 @@ namespace osu.Game.Beatmaps.ControlPoints return new T(); if (time < list[0].Time) - return new T(); + return list[0]; int index = list.BinarySearch(new T() { Time = time }); From 462bbd02bab617953b484a6a74e06bb9a71be87e Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 01:38:28 +0900 Subject: [PATCH 27/42] Simplify expression. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 6809c417a4..9dba9cfa19 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -92,8 +92,6 @@ namespace osu.Game.Beatmaps.ControlPoints index = ~index; - if (index == list.Count) - return list[list.Count - 1]; return list[index - 1]; } } From f57b234cc3694ad0ff9d334624280ccfbdcf6ec5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:44:47 +0900 Subject: [PATCH 28/42] Expose Beatmap in BeatSyncedContainer --- .../Graphics/Containers/BeatSyncedContainer.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index 5624ca07ef..c0defceac0 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Containers { public class BeatSyncedContainer : Container { - private readonly Bindable beatmap = new Bindable(); + protected readonly Bindable Beatmap = new Bindable(); private int lastBeat; private TimingControlPoint lastTimingPoint; @@ -25,13 +25,13 @@ namespace osu.Game.Graphics.Containers protected override void Update() { - if (beatmap.Value?.Track == null) + if (Beatmap.Value?.Track == null) return; - double currentTrackTime = beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; + double currentTrackTime = Beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds; - TimingControlPoint timingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); - EffectControlPoint effectPoint = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); + TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime); + EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime); if (timingPoint.BeatLength == 0) return; @@ -48,7 +48,7 @@ namespace osu.Game.Graphics.Containers double offsetFromBeat = (timingPoint.Time - currentTrackTime) % timingPoint.BeatLength; using (BeginDelayedSequence(offsetFromBeat, true)) - OnNewBeat(beatIndex, timingPoint, effectPoint, beatmap.Value.Track.CurrentAmplitudes); + OnNewBeat(beatIndex, timingPoint, effectPoint, Beatmap.Value.Track.CurrentAmplitudes); lastBeat = beatIndex; lastTimingPoint = timingPoint; @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.Containers [BackgroundDependencyLoader] private void load(OsuGameBase game) { - beatmap.BindTo(game.Beatmap); + Beatmap.BindTo(game.Beatmap); } protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) From 7e827c4f11bdf925113bf46fd777deb148798bc1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:45:01 +0900 Subject: [PATCH 29/42] Add amplitude adjust --- osu.Game/Screens/Menu/OsuLogo.cs | 150 ++++++++++++++++++------------- 1 file changed, 86 insertions(+), 64 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 8826f56180..4259165005 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Menu private readonly CircularContainer logoContainer; private readonly Container logoBounceContainer; private readonly Container logoBeatContainer; + private readonly Container logoAmplitudeContainer; private readonly Container logoHoverContainer; private SampleChannel sampleClick; @@ -112,88 +113,95 @@ namespace osu.Game.Screens.Menu } } }, - logoBeatContainer = new Container + logoAmplitudeContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - new BufferedContainer + logoBeatContainer = new Container { AutoSizeAxes = Axes.Both, Children = new Drawable[] { - logoContainer = new CircularContainer + new BufferedContainer + { + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + logoContainer = new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.88f), + Masking = true, + Children = new Drawable[] + { + colourAndTriangles = new Container + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuPink, + }, + new Triangles + { + TriangleScale = 4, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + }, + } + }, + flashLayer = new Box + { + RelativeSizeAxes = Axes.Both, + BlendingMode = BlendingMode.Additive, + Colour = Color4.White, + Alpha = 0, + }, + }, + }, + logo = new Sprite + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + }, + } + }, + impactContainer = new CircularContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, + Alpha = 0, + BorderColour = Color4.White, RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.88f), + BorderThickness = 10, Masking = true, Children = new Drawable[] { - colourAndTriangles = new Container + new Box { RelativeSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuPink, - }, - new Triangles - { - TriangleScale = 4, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - }, - } - }, - flashLayer = new Box - { - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Colour = Color4.White, + AlwaysPresent = true, Alpha = 0, - }, - }, + } + } }, - logo = new Sprite + new MenuVisualisation { Anchor = Anchor.Centre, Origin = Anchor.Centre, - }, - } - }, - impactContainer = new CircularContainer - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Alpha = 0, - BorderColour = Color4.White, - RelativeSizeAxes = Axes.Both, - BorderThickness = 10, - Masking = true, - Children = new Drawable[] - { - new Box - { RelativeSizeAxes = Axes.Both, - AlwaysPresent = true, - Alpha = 0, + BlendingMode = BlendingMode.Additive, + Alpha = 0.2f, } } - }, - new MenuVisualisation - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - BlendingMode = BlendingMode.Additive, - Alpha = 0.2f, } } } @@ -205,43 +213,57 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(TextureStore textures, AudioManager audio) + private void load(TextureStore textures, AudioManager audio, OsuGameBase game) { sampleClick = audio.Sample.Get(@"Menu/menuhit"); logo.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo"); } + private int lastBeatIndex; + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes); + lastBeatIndex = beatIndex; + var beatLength = timingPoint.BeatLength; + float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum); + if (beatIndex < 0) return; - logoBeatContainer.ScaleTo(0.98f, beat_in_time, EasingTypes.Out); + logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (logoBeatContainer.BeginDelayedSequence(beat_in_time)) logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint); ripple.ClearTransforms(); - ripple.ScaleTo(Vector2.One); - ripple.Alpha = 0.15f; + ripple.ScaleTo(logoAmplitudeContainer.Scale); + ripple.Alpha = 0.15f * amplitudeAdjust; - ripple.ScaleTo(ripple.Scale * 1.04f, beatLength, EasingTypes.OutQuint); - ripple.FadeOut(beatLength); + ripple.ScaleTo(logoAmplitudeContainer.Scale * (1 + 0.04f * amplitudeAdjust), beatLength, EasingTypes.OutQuint); + ripple.FadeOut(beatLength, EasingTypes.OutQuint); if (effectPoint.KiaiMode && flashLayer.Alpha < 0.4f) { flashLayer.ClearTransforms(); - flashLayer.FadeTo(0.14f, beat_in_time, EasingTypes.Out); + flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out); using (flashLayer.BeginDelayedSequence(beat_in_time)) flashLayer.FadeOut(beatLength); } } + protected override void Update() + { + base.Update(); + + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0; + logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); + } + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { if (!Interactive) return false; From 84499275ade05987a2b26ebb89b67ebc11c17775 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 01:58:07 +0900 Subject: [PATCH 30/42] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 79b335e9d4..777996fb97 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 79b335e9d4d6f8ff89524f06dbe324db3cf29513 +Subproject commit 777996fb9731ba1895a5ab1323cbbc97259ff741 From 813b09189c8f77fe272a63d32408b269e62b7e8e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 02:09:31 +0900 Subject: [PATCH 31/42] Remove unused parameter --- osu.Game/Screens/Menu/OsuLogo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 4259165005..f99e7e80c8 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -213,7 +213,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(TextureStore textures, AudioManager audio, OsuGameBase game) + private void load(TextureStore textures, AudioManager audio) { sampleClick = audio.Sample.Get(@"Menu/menuhit"); logo.Texture = textures.Get(@"Menu/logo"); From 9e7f384203862921fc6ea17d807d5137eb667e22 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:18:25 +0900 Subject: [PATCH 32/42] Fix returning incorrect control points for non-timing points. --- .../Beatmaps/ControlPoints/ControlPointInfo.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 9dba9cfa19..38b175eed9 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Lists; @@ -55,7 +56,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, () => TimingPoints[0]); /// /// Finds the maximum BPM represented by any timing control point. @@ -75,14 +76,21 @@ namespace osu.Game.Beatmaps.ControlPoints public double BPMMode => 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; - private T binarySearch(SortedList list, double time) + /// + /// Binary searches one of the control point lists to find the active contro point at . + /// + /// The list to search. + /// The time to find the control point at. + /// The control point to use when is before any control points. + /// + private T binarySearch(SortedList list, double time, Func prePoint = null) where T : ControlPoint, new() { if (list.Count == 0) return new T(); if (time < list[0].Time) - return list[0]; + return prePoint?.Invoke() ?? new T(); int index = list.BinarySearch(new T() { Time = time }); From 2d1df8fd8a7c1eaaf58de8d4e42429222d0a90e4 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:22:28 +0900 Subject: [PATCH 33/42] xmldoc fixes. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 38b175eed9..c8e5eba5dd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -77,12 +77,12 @@ namespace osu.Game.Beatmaps.ControlPoints 60000 / (TimingPoints.GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).FirstOrDefault()?.FirstOrDefault() ?? new TimingControlPoint()).BeatLength; /// - /// Binary searches one of the control point lists to find the active contro point at . + /// Binary searches one of the control point lists to find the active control point at . /// /// The list to search. /// The time to find the control point at. /// The control point to use when is before any control points. - /// + /// The active control point at . private T binarySearch(SortedList list, double time, Func prePoint = null) where T : ControlPoint, new() { From 41824e01796b5f4fbb4986f48a43446500c953d8 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:24:10 +0900 Subject: [PATCH 34/42] Add comment. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index c8e5eba5dd..d4f1c8df4b 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -100,6 +100,8 @@ namespace osu.Game.Beatmaps.ControlPoints index = ~index; + // BinarySearch will return the index of the first element _greater_ than the search + // This is the inactive point - the active point is the one before it (index - 1) return list[index - 1]; } } From 0a385055dc24aae6253de7971e77106c68f7af25 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Wed, 24 May 2017 02:53:08 +0900 Subject: [PATCH 35/42] Remove Func'd-ness. --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index d4f1c8df4b..76ff86d5c4 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The time to find the timing control point at. /// The timing control point. - public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, () => TimingPoints[0]); + public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault()); /// /// Finds the maximum BPM represented by any timing control point. @@ -81,16 +81,16 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The list to search. /// The time to find the control point at. - /// The control point to use when is before any control points. + /// The control point to use when is before any control points. If null, a new control point will be constructed. /// The active control point at . - private T binarySearch(SortedList list, double time, Func prePoint = null) + private T binarySearch(SortedList list, double time, T prePoint = null) where T : ControlPoint, new() { if (list.Count == 0) return new T(); if (time < list[0].Time) - return prePoint?.Invoke() ?? new T(); + return prePoint ?? new T(); int index = list.BinarySearch(new T() { Time = time }); From b477e5cd9e21dae9d6b6d97641b2777b47017f56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 02:53:21 +0900 Subject: [PATCH 36/42] Fix potential nullref --- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f99e7e80c8..116f7291e2 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -260,7 +260,7 @@ namespace osu.Game.Screens.Menu { base.Update(); - var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track.CurrentAmplitudes.Maximum : 0; + var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0; logoAmplitudeContainer.ScaleTo(1 - maxAmplitude * 0.04f, 50, EasingTypes.OutQuint); } @@ -312,4 +312,4 @@ namespace osu.Game.Screens.Menu impactContainer.ScaleTo(1.12f, 250); } } -} \ No newline at end of file +} From 09adb23591fb4b393dde7ca84d919c0ff3c8aaa7 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:22:30 +0200 Subject: [PATCH 37/42] Fix scheduled task not being canceled --- osu.Game/Screens/Select/SongSelect.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e9ead7c9c0..eb5fb6d258 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -319,7 +319,10 @@ namespace osu.Game.Screens.Select bool beatmapSetChange = false; if (beatmap.Equals(Beatmap?.BeatmapInfo)) + { + selectionChangedDebounce?.Cancel(); return; + } if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -330,7 +333,7 @@ namespace osu.Game.Screens.Select } selectionChangeNoBounce = beatmap; - + selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { From 0616256bd06f32b6199a6e883afca839505eff57 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:23:52 +0200 Subject: [PATCH 38/42] CI fix --- osu.Game/Screens/Select/SongSelect.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eb5fb6d258..7c45738d59 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -333,7 +333,7 @@ namespace osu.Game.Screens.Select } selectionChangeNoBounce = beatmap; - + selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { From 67774192dd5635c9777c103afc5da6b475cc778f Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:30:32 +0200 Subject: [PATCH 39/42] Formatting fixes --- osu.Game/Screens/Select/SongSelect.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 7c45738d59..d0c5e1adfd 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -316,13 +316,12 @@ namespace osu.Game.Screens.Select /// private void selectionChanged(BeatmapInfo beatmap) { - bool beatmapSetChange = false; + selectionChangedDebounce?.Cancel(); if (beatmap.Equals(Beatmap?.BeatmapInfo)) - { - selectionChangedDebounce?.Cancel(); return; - } + + bool beatmapSetChange = false; if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -334,7 +333,6 @@ namespace osu.Game.Screens.Select selectionChangeNoBounce = beatmap; - selectionChangedDebounce?.Cancel(); selectionChangedDebounce = Scheduler.AddDelayed(delegate { Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap); From 24f64c881556e46ef210c76f38d883aed9a79b51 Mon Sep 17 00:00:00 2001 From: MrTheMake Date: Wed, 24 May 2017 02:38:05 +0200 Subject: [PATCH 40/42] More formatting --- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 2d6d212130..130642b9c7 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -170,8 +170,8 @@ namespace osu.Game.Screens.Select List visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden).ToList(); if (visibleGroups.Count < 1) return; - BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; + BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)]; BeatmapPanel panel = group.BeatmapPanels[RNG.Next(group.BeatmapPanels.Count)]; selectGroup(group, panel); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index d0c5e1adfd..41fa53e8a3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -322,7 +322,6 @@ namespace osu.Game.Screens.Select return; bool beatmapSetChange = false; - if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); else From 207d6e4ac3f2303000bdb48ed7bbc12a1439071e Mon Sep 17 00:00:00 2001 From: ColdVolcano Date: Tue, 23 May 2017 20:01:20 -0500 Subject: [PATCH 41/42] Update to new syntax of OnNewBeat --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 26 +++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index ced6d179d6..0cf1fa54fa 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -3,17 +3,17 @@ using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; -using osu.Game.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.Timing; -using System; +using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; -using TrackAmplitudes = osu.Framework.Audio.Track.Track.TrackAmplitudes; +using osu.Game.Graphics.Containers; +using System; namespace osu.Game.Screens.Menu { @@ -75,22 +75,20 @@ namespace osu.Game.Screens.Menu rightBox.ColourInfo = ColourInfo.GradientHorizontal(gradientDark, gradientLight); } - protected override void OnNewBeat(int newBeat, double beatLength, TimeSignatures timeSignature, bool kiai) + protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes) { - if (newBeat < 0) + if (beatIndex < 0) return; - if (kiai ? newBeat % 2 == 0 : newBeat % (int)timeSignature == 0) - flash(leftBox, beatLength, kiai); - if (kiai ? newBeat % 2 == 1 : newBeat % (int)timeSignature == 0) - flash(rightBox, beatLength, kiai); + if (effectPoint.KiaiMode ? beatIndex % 2 == 0 : beatIndex % (int)timingPoint.TimeSignature == 0) + flash(leftBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes); + if (effectPoint.KiaiMode ? beatIndex % 2 == 1 : beatIndex % (int)timingPoint.TimeSignature == 0) + flash(rightBox, timingPoint.BeatLength, effectPoint.KiaiMode, amplitudes); } - private void flash(Drawable d, double beatLength, bool kiai) + private void flash(Drawable d, double beatLength, bool kiai, TrackAmplitudes amplitudes) { - 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); + d.FadeTo(Math.Max(0, ((d.Equals(leftBox) ? amplitudes.LeftChannel : amplitudes.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); } From 53f489b447c1108d67d7f666387ac42c00cc3b86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 May 2017 11:50:12 +0900 Subject: [PATCH 42/42] Remove using --- osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs index 76ff86d5c4..acf90931ac 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPointInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Lists;