From 72959691e9e2aa5958521717dd940a2601d46ee6 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 17:16:17 +0300 Subject: [PATCH 01/26] Introduce KeyCounterMemento --- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/KeyCounter.cs | 7 +++++++ osu.Game/Screens/Play/KeyCounterCollection.cs | 10 +++++++--- osu.Game/Screens/Play/KeyCounterMemento.cs | 17 +++++++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 osu.Game/Screens/Play/KeyCounterMemento.cs diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4f3fe15211..c6a411c0bb 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; - Progress.AudioClock = offsetClock; + Progress.AudioClock = KeyCounter.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 2c31e61114..01f1d6dafd 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Framework.Timing; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -55,6 +56,8 @@ namespace osu.Game.Screens.Play public Color4 KeyUpTextColor { get; set; } = Color4.White; public int FadeTime { get; set; } + public IClock AudioClock { get; set; } + protected KeyCounter(string name) { Name = name; @@ -129,5 +132,9 @@ namespace osu.Game.Screens.Play } public void ResetCount() => CountPresses = 0; + + public KeyCounterMemento SaveState() => new KeyCounterMemento(AudioClock.CurrentTime, CountPresses); + + public void RestoreState(KeyCounterMemento memento) => CountPresses = memento.CountPresses; } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 721d925d63..5f1e502cf7 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -3,14 +3,15 @@ using System; using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Configuration; 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.Framework.Timing; using osu.Game.Configuration; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -36,6 +37,7 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; + key.AudioClock = AudioClock; } public void ResetCount() @@ -117,6 +119,8 @@ namespace osu.Game.Screens.Play public override bool HandleKeyboardInput => receptor == null; public override bool HandleMouseInput => receptor == null; + public IClock AudioClock { get; set; } + private Receptor receptor; public Receptor GetReceptor() diff --git a/osu.Game/Screens/Play/KeyCounterMemento.cs b/osu.Game/Screens/Play/KeyCounterMemento.cs new file mode 100644 index 0000000000..daf217cb62 --- /dev/null +++ b/osu.Game/Screens/Play/KeyCounterMemento.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Play +{ + public class KeyCounterMemento + { + public KeyCounterMemento(double currentTime, int countPresses) + { + CurrentTime = currentTime; + CountPresses = countPresses; + } + + public double CurrentTime { get; } + public int CountPresses { get; } + } +} From 0632c59e604449e197fb5b13acf88bd4ee88c3d9 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 17:35:42 +0300 Subject: [PATCH 02/26] Save KeyCounter state when keypress happens --- osu.Game/Screens/Play/KeyCounter.cs | 6 ++++++ osu.Game/Screens/Play/KeyCounterCollection.cs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 01f1d6dafd..99685c238f 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -15,6 +16,8 @@ namespace osu.Game.Screens.Play { public abstract class KeyCounter : Container { + public event Action KeyPressed; + private Sprite buttonSprite; private Sprite glowSprite; private Container textLayer; @@ -46,7 +49,10 @@ namespace osu.Game.Screens.Play isLit = value; updateGlowSprite(value); if (value && IsCounting) + { CountPresses++; + KeyPressed?.Invoke(); + } } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 5f1e502cf7..e472e8d9c9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -2,6 +2,7 @@ // 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.Allocation; using osu.Framework.Configuration; @@ -22,6 +23,8 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); + private readonly Dictionary> keyCountersState = new Dictionary>(); + public KeyCounterCollection() { Direction = FillDirection.Horizontal; @@ -38,6 +41,9 @@ namespace osu.Game.Screens.Play key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; + + keyCountersState.Add(key.Name, new List()); + key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } public void ResetCount() From 1d9bf420821bb33d39873d51ab3ad60a8a8ab856 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 18:38:10 +0300 Subject: [PATCH 03/26] Fix clock assigning during KeyCounterCollection creation --- osu.Game/Screens/Play/HUDOverlay.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index c6a411c0bb..b813fb7cba 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(), + KeyCounter = CreateKeyCounter(offsetClock), HoldToQuit = CreateQuitButton(), } } @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play BindRulesetContainer(rulesetContainer); Progress.Objects = rulesetContainer.Objects; - Progress.AudioClock = KeyCounter.AudioClock = offsetClock; + Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; Progress.OnSeek = pos => adjustableClock.Seek(pos); @@ -193,12 +193,13 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20 } }; - protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection + protected virtual KeyCounterCollection CreateKeyCounter(IClock offsetClock) => new KeyCounterCollection { FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(10), + AudioClock = offsetClock }; protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6) From 7f3ad37edec8eb9df2fc4e8338fac0612b2c1ad8 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 19:42:18 +0300 Subject: [PATCH 04/26] Restore keycounter state on replay seek --- osu.Game/Screens/Play/HUDOverlay.cs | 8 ++++++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index b813fb7cba..7fc4d637e0 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(offsetClock), + KeyCounter = CreateKeyCounter(adjustableClock), HoldToQuit = CreateQuitButton(), } } @@ -81,7 +81,11 @@ namespace osu.Game.Screens.Play Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; - Progress.OnSeek = pos => adjustableClock.Seek(pos); + Progress.OnSeek = pos => + { + adjustableClock.Seek(pos); + KeyCounter.RestoreKeyCounterState(pos); + }; ModDisplay.Current.BindTo(working.Mods); diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index e472e8d9c9..8ee3e97e54 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -46,6 +46,15 @@ namespace osu.Game.Screens.Play key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } + public void RestoreKeyCounterState(double time) + { + foreach (var counter in Children) + { + var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time); + counter.RestoreState(targetState); + } + } + public void ResetCount() { foreach (var counter in Children) From ecd51d70f991bd204728c3a392ab4217c79af094 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 23:13:06 +0300 Subject: [PATCH 05/26] Rename Memento class --- osu.Game/Screens/Play/KeyCounter.cs | 4 ++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMemento.cs | 17 ----------------- osu.Game/Screens/Play/KeyCounterState.cs | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 osu.Game/Screens/Play/KeyCounterMemento.cs create mode 100644 osu.Game/Screens/Play/KeyCounterState.cs diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 99685c238f..7e9c04110c 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -139,8 +139,8 @@ namespace osu.Game.Screens.Play public void ResetCount() => CountPresses = 0; - public KeyCounterMemento SaveState() => new KeyCounterMemento(AudioClock.CurrentTime, CountPresses); + public KeyCounterState SaveState() => new KeyCounterState(AudioClock.CurrentTime, CountPresses); - public void RestoreState(KeyCounterMemento memento) => CountPresses = memento.CountPresses; + public void RestoreState(KeyCounterState state) => CountPresses = state.Count; } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 8978181ce4..cdb42ec514 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); - private readonly Dictionary> keyCountersState = new Dictionary>(); + private readonly Dictionary> keyCountersState = new Dictionary>(); public KeyCounterCollection() { @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; - keyCountersState.Add(key.Name, new List()); + keyCountersState.Add(key.Name, new List()); key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play { foreach (var counter in Children) { - var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.CurrentTime <= time); + var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.Time <= time); counter.RestoreState(targetState); } } diff --git a/osu.Game/Screens/Play/KeyCounterMemento.cs b/osu.Game/Screens/Play/KeyCounterMemento.cs deleted file mode 100644 index daf217cb62..0000000000 --- a/osu.Game/Screens/Play/KeyCounterMemento.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Screens.Play -{ - public class KeyCounterMemento - { - public KeyCounterMemento(double currentTime, int countPresses) - { - CurrentTime = currentTime; - CountPresses = countPresses; - } - - public double CurrentTime { get; } - public int CountPresses { get; } - } -} diff --git a/osu.Game/Screens/Play/KeyCounterState.cs b/osu.Game/Screens/Play/KeyCounterState.cs new file mode 100644 index 0000000000..e5c0703319 --- /dev/null +++ b/osu.Game/Screens/Play/KeyCounterState.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Screens.Play +{ + public class KeyCounterState + { + public KeyCounterState(double time, int count) + { + Time = time; + Count = count; + } + + public readonly double Time; + public readonly int Count; + } +} From 332ad5bb67df65bce9dac3fe2aed748e11b8e112 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 23:58:21 +0300 Subject: [PATCH 06/26] Move states to KeyCounter --- osu.Game/Screens/Play/KeyCounter.cs | 24 ++++++++++++++----- osu.Game/Screens/Play/KeyCounterCollection.cs | 15 +++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 7e9c04110c..f5d218b4cf 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 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.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -16,13 +17,13 @@ namespace osu.Game.Screens.Play { public abstract class KeyCounter : Container { - public event Action KeyPressed; - private Sprite buttonSprite; private Sprite glowSprite; private Container textLayer; private SpriteText countSpriteText; + private readonly List states = new List(); + public bool IsCounting { get; set; } = true; private int countPresses; public int CountPresses @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Play if (value && IsCounting) { CountPresses++; - KeyPressed?.Invoke(); + SaveState(); } } } @@ -139,8 +140,19 @@ namespace osu.Game.Screens.Play public void ResetCount() => CountPresses = 0; - public KeyCounterState SaveState() => new KeyCounterState(AudioClock.CurrentTime, CountPresses); + public void SaveState() + { + var lastState = states.LastOrDefault(); - public void RestoreState(KeyCounterState state) => CountPresses = state.Count; + if (lastState == null || lastState.Time < AudioClock.CurrentTime) + states.Add(new KeyCounterState(AudioClock.CurrentTime, CountPresses)); + } + + public void RestoreState(double time) + { + var targetState = states.LastOrDefault(state => state.Time <= time) ?? states.LastOrDefault(); + var targetCount = targetState?.Count ?? 0; + CountPresses = targetCount; + } } } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index cdb42ec514..c4974dbaa8 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -2,18 +2,17 @@ // 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.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Timing; -using OpenTK.Graphics; using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; +using osu.Framework.Timing; using osu.Game.Configuration; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Screens.Play { @@ -24,8 +23,6 @@ namespace osu.Game.Screens.Play public readonly Bindable Visible = new Bindable(true); private readonly Bindable configVisibility = new Bindable(); - private readonly Dictionary> keyCountersState = new Dictionary>(); - public KeyCounterCollection() { Direction = FillDirection.Horizontal; @@ -42,18 +39,12 @@ namespace osu.Game.Screens.Play key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; key.AudioClock = AudioClock; - - keyCountersState.Add(key.Name, new List()); - key.KeyPressed += () => keyCountersState[key.Name].Add(key.SaveState()); } public void RestoreKeyCounterState(double time) { foreach (var counter in Children) - { - var targetState = keyCountersState[counter.Name].LastOrDefault(state => state.Time <= time); - counter.RestoreState(targetState); - } + counter.RestoreState(time); } public void ResetCount() From 1e6220e3c0a066457d54f1ad52e0c94b2be92b3d Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 13:22:52 +0300 Subject: [PATCH 07/26] Call KeyCounter.RestoreState itself --- osu.Game/Screens/Play/HUDOverlay.cs | 6 +----- osu.Game/Screens/Play/KeyCounter.cs | 16 ++++++++++------ osu.Game/Screens/Play/KeyCounterCollection.cs | 8 +------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 6fce7c9a70..0187a21d01 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -82,11 +82,7 @@ namespace osu.Game.Screens.Play Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; - Progress.OnSeek = pos => - { - adjustableClock.Seek(pos); - KeyCounter.RestoreKeyCounterState(pos); - }; + Progress.OnSeek = pos => adjustableClock.Seek(pos); ModDisplay.Current.BindTo(working.Mods); diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index f5d218b4cf..031fe11f88 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Timing; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -23,6 +22,7 @@ namespace osu.Game.Screens.Play private SpriteText countSpriteText; private readonly List states = new List(); + private KeyCounterState lastState; public bool IsCounting { get; set; } = true; private int countPresses; @@ -63,8 +63,6 @@ namespace osu.Game.Screens.Play public Color4 KeyUpTextColor { get; set; } = Color4.White; public int FadeTime { get; set; } - public IClock AudioClock { get; set; } - protected KeyCounter(string name) { Name = name; @@ -142,10 +140,16 @@ namespace osu.Game.Screens.Play public void SaveState() { - var lastState = states.LastOrDefault(); + if (lastState == null || lastState.Time < Clock.CurrentTime) + states.Add(lastState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + } - if (lastState == null || lastState.Time < AudioClock.CurrentTime) - states.Add(new KeyCounterState(AudioClock.CurrentTime, CountPresses)); + protected override void Update() + { + base.Update(); + + if (lastState?.Time > Clock.CurrentTime) + RestoreState(Clock.CurrentTime); } public void RestoreState(double time) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index c4974dbaa8..2a5ecd474d 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,13 +38,7 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - key.AudioClock = AudioClock; - } - - public void RestoreKeyCounterState(double time) - { - foreach (var counter in Children) - counter.RestoreState(time); + key.Clock = (IFrameBasedClock)AudioClock; } public void ResetCount() From 8bb83a8fd982cf3a4c4708ae8e4a98c2c413f7b2 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 22:16:14 +0300 Subject: [PATCH 08/26] Fix nullref in KeyCounterCollection --- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 2a5ecd474d..f701c468e9 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,7 +38,8 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - key.Clock = (IFrameBasedClock)AudioClock; + if (AudioClock != null && AudioClock is IFrameBasedClock basedClock) + key.Clock = basedClock; } public void ResetCount() From 3134e14b37b3d177f254accd935c26c0122730ec Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 28 Jul 2018 23:24:03 +0300 Subject: [PATCH 09/26] Test KeyCounter.RestoreState --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 29 ++++++++++++++++++++- osu.Game/Screens/Play/KeyCounter.cs | 7 +---- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index b98875cd6a..931c62a64a 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -3,7 +3,9 @@ using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.Input.EventArgs; using osu.Framework.MathUtils; +using osu.Framework.Timing; using osu.Game.Screens.Play; using OpenTK.Input; @@ -12,15 +14,18 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseKeyCounter : OsuTestCase { + private const Key rewind_test_key = Key.Z; + public TestCaseKeyCounter() { + KeyCounterKeyboard rewindTestKeyCounterKeyboard; KeyCounterCollection kc = new KeyCounterCollection { Origin = Anchor.Centre, Anchor = Anchor.Centre, Children = new KeyCounter[] { - new KeyCounterKeyboard(Key.Z), + rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(rewind_test_key), new KeyCounterKeyboard(Key.X), new KeyCounterMouse(MouseButton.Left), new KeyCounterMouse(MouseButton.Right), @@ -34,6 +39,28 @@ namespace osu.Game.Tests.Visual }); AddSliderStep("Fade time", 0, 200, 50, v => kc.FadeTime = v); + var expectedCountPresses = rewindTestKeyCounterKeyboard.CountPresses + 1; + AddStep($"Press {rewind_test_key} key", () => + { + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = rewind_test_key, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = rewind_test_key }); + }); + + AddAssert($"Check {rewind_test_key} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == expectedCountPresses); + + IFrameBasedClock counterClock = null; + AddStep($"Rewind {rewind_test_key} counter", () => + { + counterClock = rewindTestKeyCounterKeyboard.Clock; + rewindTestKeyCounterKeyboard.Clock = new DecoupleableInterpolatingFramedClock(); + }); + + AddAssert($"Check {rewind_test_key} counter after rewind", () => + { + rewindTestKeyCounterKeyboard.Clock = counterClock; + return rewindTestKeyCounterKeyboard.CountPresses == 0; + }); + Add(kc); } } diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 031fe11f88..cb9ff28aff 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -152,11 +152,6 @@ namespace osu.Game.Screens.Play RestoreState(Clock.CurrentTime); } - public void RestoreState(double time) - { - var targetState = states.LastOrDefault(state => state.Time <= time) ?? states.LastOrDefault(); - var targetCount = targetState?.Count ?? 0; - CountPresses = targetCount; - } + public void RestoreState(double time) => CountPresses = states.LastOrDefault(state => state.Time <= time)?.Count ?? 0; } } From 8a9b3f6459324a0af0e1f2ec2c09e51392ef4144 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Wed, 15 Aug 2018 22:18:48 +0300 Subject: [PATCH 10/26] Remove rewinded keycounter states --- osu.Game/Screens/Play/KeyCounter.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index cb9ff28aff..301c25f1fd 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -152,6 +152,15 @@ namespace osu.Game.Screens.Play RestoreState(Clock.CurrentTime); } - public void RestoreState(double time) => CountPresses = states.LastOrDefault(state => state.Time <= time)?.Count ?? 0; + public void RestoreState(double time) + { + var targetState = states.LastOrDefault(state => state.Time <= time); + var targetIndex = states.IndexOf(targetState); + + states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); + + lastState = targetState; + CountPresses = targetState?.Count ?? 0; + } } } From 7a1fdd9dc8a146ffdb951c6588c001ede4d0c11e Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 6 Sep 2018 01:01:36 +0300 Subject: [PATCH 11/26] Reset KeyCounter if targetState was not found --- osu.Game/Screens/Play/KeyCounter.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 301c25f1fd..0771cc614c 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -136,7 +136,11 @@ namespace osu.Game.Screens.Play } } - public void ResetCount() => CountPresses = 0; + public void ResetCount() + { + CountPresses = 0; + states.Clear(); + } public void SaveState() { @@ -155,6 +159,12 @@ namespace osu.Game.Screens.Play public void RestoreState(double time) { var targetState = states.LastOrDefault(state => state.Time <= time); + if (targetState == null) + { + ResetCount(); + return; + } + var targetIndex = states.IndexOf(targetState); states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); From dae54d252df331bd7a0dd026235e0b4035bdff54 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 7 Sep 2018 21:35:32 +0300 Subject: [PATCH 12/26] Remove redundant checks in RestoreState --- osu.Game/Screens/Play/KeyCounter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 0771cc614c..0f621e6bb3 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -170,7 +170,7 @@ namespace osu.Game.Screens.Play states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); lastState = targetState; - CountPresses = targetState?.Count ?? 0; + CountPresses = targetState.Count; } } } From 125b569ccbf06ee2d488879812b761e999d58c87 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 7 Sep 2018 21:39:41 +0300 Subject: [PATCH 13/26] Change AudioClock type to IFrameBasedClock and comment its usage --- osu.Game/Screens/Play/HUDOverlay.cs | 4 ++-- osu.Game/Screens/Play/KeyCounterCollection.cs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 0187a21d01..eb137f5447 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Play Direction = FillDirection.Vertical, Children = new Drawable[] { - KeyCounter = CreateKeyCounter(adjustableClock), + KeyCounter = CreateKeyCounter(adjustableClock as IFrameBasedClock), HoldToQuit = CreateQuitButton(), } } @@ -194,7 +194,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding { Top = 20 } }; - protected virtual KeyCounterCollection CreateKeyCounter(IClock offsetClock) => new KeyCounterCollection + protected virtual KeyCounterCollection CreateKeyCounter(IFrameBasedClock offsetClock) => new KeyCounterCollection { FadeTime = 50, Anchor = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index f701c468e9..2a737d974b 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -38,8 +38,9 @@ namespace osu.Game.Screens.Play key.FadeTime = FadeTime; key.KeyDownTextColor = KeyDownTextColor; key.KeyUpTextColor = KeyUpTextColor; - if (AudioClock != null && AudioClock is IFrameBasedClock basedClock) - key.Clock = basedClock; + // Use the same clock object as SongProgress for saving KeyCounter state + if (AudioClock != null) + key.Clock = AudioClock; } public void ResetCount() @@ -121,7 +122,7 @@ namespace osu.Game.Screens.Play public override bool HandleKeyboardInput => receptor == null; public override bool HandleMouseInput => receptor == null; - public IClock AudioClock { get; set; } + public IFrameBasedClock AudioClock { get; set; } private Receptor receptor; From 0f9aa834e55db032a784175c35390bd4c7900a12 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 8 Sep 2018 16:31:00 +0900 Subject: [PATCH 14/26] Fix osu! logo being present throughout the whole game --- osu.Game/Screens/Menu/OsuLogo.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index f0f765a4c9..5ad6427fd8 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -84,11 +84,10 @@ namespace osu.Game.Screens.Menu private const double early_activation = 60; + public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks; + public OsuLogo() { - // Required to make Schedule calls run in OsuScreen even when we are not visible. - AlwaysPresent = true; - EarlyActivationMilliseconds = early_activation; Size = new Vector2(default_size); From f280e910bbbe0fe7a16c090a78a6940d0f48798e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 04:20:11 +0900 Subject: [PATCH 15/26] Bump squirrel version --- osu.Desktop/osu.Desktop.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index e2fc4d14f6..067a78132a 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + From dd7f667fe3622e77bf3661b8210de806eb9ee2f2 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sat, 15 Sep 2018 00:18:42 +0200 Subject: [PATCH 16/26] Disable scrolling speed control for osu!catch --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index d49be69856..d16f5cbb07 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; + protected override bool UserScrollSpeedAdjustment => false; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { From 65b2bceef237f2ea950ec312a5a7a8d51131f0dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 14:51:04 +0900 Subject: [PATCH 17/26] Simplify implementation --- osu.Game/Screens/Play/KeyCounter.cs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 0f621e6bb3..5652c1b54f 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play private SpriteText countSpriteText; private readonly List states = new List(); - private KeyCounterState lastState; + private KeyCounterState currentState; public bool IsCounting { get; set; } = true; private int countPresses; @@ -144,33 +144,24 @@ namespace osu.Game.Screens.Play public void SaveState() { - if (lastState == null || lastState.Time < Clock.CurrentTime) - states.Add(lastState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + if (currentState == null || currentState.Time < Clock.CurrentTime) + states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); } protected override void Update() { base.Update(); - if (lastState?.Time > Clock.CurrentTime) - RestoreState(Clock.CurrentTime); + if (currentState?.Time > Clock.CurrentTime) + restoreStateTo(Clock.CurrentTime); } - public void RestoreState(double time) + private void restoreStateTo(double time) { - var targetState = states.LastOrDefault(state => state.Time <= time); - if (targetState == null) - { - ResetCount(); - return; - } + states.RemoveAll(state => state.Time > time); - var targetIndex = states.IndexOf(targetState); - - states.RemoveRange(targetIndex + 1, states.Count - (targetIndex + 1)); - - lastState = targetState; - CountPresses = targetState.Count; + currentState = states.LastOrDefault(); + CountPresses = currentState?.Count ?? 0; } } } From e636cfe79eb537eb77f613ba34e9074be915e6f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:24:06 +0900 Subject: [PATCH 18/26] Fix dynamic compilation not working --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 931c62a64a..30580a3690 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; @@ -14,7 +14,12 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseKeyCounter : OsuTestCase { - private const Key rewind_test_key = Key.Z; + public override IReadOnlyList RequiredTypes => new[] + { + typeof(KeyCounterKeyboard), + typeof(KeyCounterMouse), + typeof(KeyCounterCollection) + }; public TestCaseKeyCounter() { From 7b57439976d6af4def64b08b8753c0340dfab3b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:25:37 +0900 Subject: [PATCH 19/26] Add proper testing --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 60 ++++++++++++++++----- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index 30580a3690..f31a687d2d 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -1,6 +1,9 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . +// Copyright (c) 2007-2018 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 NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Input.EventArgs; @@ -30,13 +33,14 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Children = new KeyCounter[] { - rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(rewind_test_key), + rewindTestKeyCounterKeyboard = new KeyCounterKeyboard(Key.X), new KeyCounterKeyboard(Key.X), new KeyCounterMouse(MouseButton.Left), new KeyCounterMouse(MouseButton.Right), }, }; + AddStep("Add random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); @@ -44,29 +48,57 @@ namespace osu.Game.Tests.Visual }); AddSliderStep("Fade time", 0, 200, 50, v => kc.FadeTime = v); - var expectedCountPresses = rewindTestKeyCounterKeyboard.CountPresses + 1; - AddStep($"Press {rewind_test_key} key", () => + Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key; + double time1 = 0; + + AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = rewind_test_key, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = rewind_test_key }); + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); }); - AddAssert($"Check {rewind_test_key} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == expectedCountPresses); + AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 1); - IFrameBasedClock counterClock = null; - AddStep($"Rewind {rewind_test_key} counter", () => + AddStep($"Press {testKey} key", () => { - counterClock = rewindTestKeyCounterKeyboard.Clock; - rewindTestKeyCounterKeyboard.Clock = new DecoupleableInterpolatingFramedClock(); + rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); + rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + time1 = Clock.CurrentTime; }); - AddAssert($"Check {rewind_test_key} counter after rewind", () => + AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 2); + + IFrameBasedClock oldClock = null; + + AddStep($"Rewind {testKey} counter once", () => { - rewindTestKeyCounterKeyboard.Clock = counterClock; - return rewindTestKeyCounterKeyboard.CountPresses == 0; + oldClock = rewindTestKeyCounterKeyboard.Clock; + rewindTestKeyCounterKeyboard.Clock = new FramedOffsetClock(new FixedClock(time1 - 10)); }); + AddAssert($"Check {testKey} counter after rewind", () => rewindTestKeyCounterKeyboard.CountPresses == 1); + + AddStep($"Rewind {testKey} counter to zero", () => rewindTestKeyCounterKeyboard.Clock = new FramedOffsetClock(new FixedClock(0))); + + AddAssert($"Check {testKey} counter after rewind", () => rewindTestKeyCounterKeyboard.CountPresses == 0); + + AddStep("Restore clock", () => rewindTestKeyCounterKeyboard.Clock = oldClock); + Add(kc); } + + private class FixedClock : IClock + { + private readonly double time; + + public FixedClock(double time) + { + this.time = time; + } + + public double CurrentTime => time; + public double Rate => 1; + public bool IsRunning => false; + } } } From 79b56cb35ca11bdc81eb93ccab4eb096519ea21f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 16:34:08 +0900 Subject: [PATCH 20/26] Make saveState private --- osu.Game/Screens/Play/KeyCounter.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 5652c1b54f..d1efe4cab7 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Play if (value && IsCounting) { CountPresses++; - SaveState(); + saveState(); } } } @@ -142,12 +142,6 @@ namespace osu.Game.Screens.Play states.Clear(); } - public void SaveState() - { - if (currentState == null || currentState.Time < Clock.CurrentTime) - states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); - } - protected override void Update() { base.Update(); @@ -156,6 +150,12 @@ namespace osu.Game.Screens.Play restoreStateTo(Clock.CurrentTime); } + private void saveState() + { + if (currentState == null || currentState.Time < Clock.CurrentTime) + states.Add(currentState = new KeyCounterState(Clock.CurrentTime, CountPresses)); + } + private void restoreStateTo(double time) { states.RemoveAll(state => state.Time > time); From 2d74c088ce70607d55c0193539b1008e8c6bdd56 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 17:03:51 +0900 Subject: [PATCH 21/26] Add newline --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index d16f5cbb07..102ec7fb3b 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; protected override bool UserScrollSpeedAdjustment => false; + public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { From 6a1e2c6fa58bae2cf5ca1829a0434dfbaa5cccd9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 15 Sep 2018 18:49:01 +0900 Subject: [PATCH 22/26] Update efcore packages --- osu.Desktop/osu.Desktop.csproj | 4 ++-- osu.Game/osu.Game.csproj | 2 +- osu.TestProject.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 067a78132a..803927bc6f 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 83ab5534c6..05291cf3d0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.TestProject.props b/osu.TestProject.props index 58de6ec030..506d634555 100644 --- a/osu.TestProject.props +++ b/osu.TestProject.props @@ -11,7 +11,7 @@ - + From 92c6b570ea171d5ac574d015f883c4e04f3eea2c Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:42:04 -0400 Subject: [PATCH 23/26] Make Transform incompatible with Wiggle --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 5b69247451..f049459cb5 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,6 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new Type[] { typeof(OsuModTransform) }; private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles From 3e02a36938084dd44b199f6d29997b5e8b9b96f6 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:43:22 -0400 Subject: [PATCH 24/26] Make Wiggle incompatible with Transform --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 30837d7db9..5ac0cc601a 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -20,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; + public override Type[] IncompatibleMods => new Type[] { typeof(OsuModWiggle) }; + private float theta; public void ApplyToDrawableHitObjects(IEnumerable drawables) From 1a8665864c9d847185b3a4350dab5584ad0af517 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 08:55:29 -0400 Subject: [PATCH 25/26] Remove redundant explicit array type info --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 5ac0cc601a..440b314e5f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new Type[] { typeof(OsuModWiggle) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModWiggle) }; private float theta; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index f049459cb5..2e601c9078 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - public override Type[] IncompatibleMods => new Type[] { typeof(OsuModTransform) }; + public override Type[] IncompatibleMods => new[] { typeof(OsuModTransform) }; private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles From 00d0613053a5ccaaabd04a73e48a7c8fca369417 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Sep 2018 00:09:17 +0900 Subject: [PATCH 26/26] Fix new resharper redundant parenthesis inspections --- osu.Game/Storyboards/CommandTimeline.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 7de0756dbd..8a032064d3 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -16,10 +16,10 @@ namespace osu.Game.Storyboards public bool HasCommands => commands.Count > 0; private Cached startTimeBacking; - public double StartTime => startTimeBacking.IsValid ? startTimeBacking : (startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue); + public double StartTime => startTimeBacking.IsValid ? startTimeBacking : startTimeBacking.Value = HasCommands ? commands.Min(c => c.StartTime) : double.MinValue; private Cached endTimeBacking; - public double EndTime => endTimeBacking.IsValid ? endTimeBacking : (endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue); + public double EndTime => endTimeBacking.IsValid ? endTimeBacking : endTimeBacking.Value = HasCommands ? commands.Max(c => c.EndTime) : double.MaxValue; public T StartValue => HasCommands ? commands.OrderBy(c => c.StartTime).First().StartValue : default(T); public T EndValue => HasCommands ? commands.OrderByDescending(c => c.EndTime).First().EndValue : default(T);