From 72959691e9e2aa5958521717dd940a2601d46ee6 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sun, 22 Jul 2018 17:16:17 +0300 Subject: [PATCH 001/132] 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 002/132] 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 003/132] 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 004/132] 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 005/132] 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 006/132] 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 007/132] 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 008/132] 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 009/132] 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 23a37d06cf7ef515d8af336d12812c4fa089567a Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 11:34:20 +0200 Subject: [PATCH 010/132] Implement the arrange mod. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 56 +++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 1 + 2 files changed, 57 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs new file mode 100644 index 0000000000..78f956416a --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Arrange"; + public override string ShortenedName => "Arrange"; + public override FontAwesome Icon => FontAwesome.fa_arrows; + public override ModType Type => ModType.DifficultyIncrease; + public override string Description => "Everything rotates. EVERYTHING"; + public override bool Ranked => true; + public override double ScoreMultiplier => 1.05; + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); + } + + private float theta = 0; + + private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) + { + var hitObject = (OsuHitObject) drawable.HitObject; + + Vector2 origPos; + + if (hitObject is RepeatPoint rp) + { + return; + } + else + { + origPos = drawable.Position; + } + + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - 1000, true)) + { + drawable + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) + .MoveTo(origPos, hitObject.TimeFadeIn + 1000, Easing.InOutSine); + } + + if (hitObject is HitCircle || hitObject is Slider) + theta += 0.4f; + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index b8ba1e2945..0d4d75d8d5 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -103,6 +103,7 @@ namespace osu.Game.Rulesets.Osu new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new OsuModHidden(), new OsuModFlashlight(), + new OsuModArrange(), }; case ModType.Special: return new Mod[] From 4d306ef837884ea75337a5ea80e68e50e8e1a6be Mon Sep 17 00:00:00 2001 From: miterosan Date: Mon, 30 Jul 2018 11:39:21 +0200 Subject: [PATCH 011/132] Add comments and clean up code. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 78f956416a..b322169e76 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -31,24 +31,23 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - Vector2 origPos; - - if (hitObject is RepeatPoint rp) - { + // repeat points get their position data from the slider. + if (hitObject is RepeatPoint) return; - } - else - { - origPos = drawable.Position; - } - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - 1000, true)) + Vector2 originalPosition = drawable.Position; + + // avoiding that the player can see the abroupt move. + const int pre_time_offset = 1000; + + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) - .MoveTo(origPos, hitObject.TimeFadeIn + 1000, Easing.InOutSine); + .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); } + // That way slider ticks come all from the same direction. if (hitObject is HitCircle || hitObject is Slider) theta += 0.4f; } From 5bb12b574b2ff0e8344ff5dfd878b37c95876ec2 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:26:06 +0200 Subject: [PATCH 012/132] The arrange mod is not ranked I think. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index b322169e76..634f2ed653 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -17,7 +17,6 @@ namespace osu.Game.Rulesets.Osu.Mods public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.DifficultyIncrease; public override string Description => "Everything rotates. EVERYTHING"; - public override bool Ranked => true; public override double ScoreMultiplier => 1.05; public void ApplyToDrawableHitObjects(IEnumerable drawables) From 67c64ac4599bb9e75d955be105a69c8bbb29b5da Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:26:26 +0200 Subject: [PATCH 013/132] Put the arrange mod into the fun section. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 634f2ed653..df5495cf00 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Arrange"; public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; - public override ModType Type => ModType.DifficultyIncrease; + public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index cac9b2db52..6d44d4993c 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -104,7 +104,6 @@ namespace osu.Game.Rulesets.Osu new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()), new OsuModHidden(), new OsuModFlashlight(), - new OsuModArrange(), }; case ModType.Conversion: return new Mod[] @@ -118,6 +117,10 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; + case ModType.Fun: + return new Mod[] { + new OsuModArrange(), + }; default: return new Mod[] { }; } From 159ce8e93e970478724c2de4a82dff613f1add5c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:29:32 +0200 Subject: [PATCH 014/132] Add license header --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index df5495cf00..f7756831ac 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -1,4 +1,7 @@ -using System; +// 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 osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; From 25791b631784c386387d44b0a0f1d48ebff44ec3 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:30:46 +0200 Subject: [PATCH 015/132] remove space. --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 6d44d4993c..c80ecbf6df 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; - case ModType.Fun: + case ModType.Fun: return new Mod[] { new OsuModArrange(), }; From 546bdf061850b4a0ab38b915e4b1d9788223593a Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 4 Aug 2018 00:36:59 +0200 Subject: [PATCH 016/132] remove default value init .-. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index f7756831ac..d319433b5c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Mods drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); } - private float theta = 0; + private float theta; private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { From f02d1f9013720196f4613d0307a729c5e7aabfb0 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:10:42 +0200 Subject: [PATCH 017/132] move the 250 appear disance to a const var. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index d319433b5c..4a93067128 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -41,12 +41,13 @@ namespace osu.Game.Rulesets.Osu.Mods // avoiding that the player can see the abroupt move. const int pre_time_offset = 1000; + const float appearDistance = 250; using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * 250) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) } // That way slider ticks come all from the same direction. From 876d410fa1bece8a373c99b95d7fc148223c9a30 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:13:04 +0200 Subject: [PATCH 018/132] Add missing ; --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 4a93067128..dec7d386d3 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Osu.Mods { drawable .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance); } // That way slider ticks come all from the same direction. From d32ffc1ebcd3fb2304ae1b1128fbcf7ba00a90fb Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:14:52 +0200 Subject: [PATCH 019/132] Swtich order of the moveto and the movetooffset. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index dec7d386d3..464486884b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -46,8 +46,9 @@ namespace osu.Game.Rulesets.Osu.Mods using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) { drawable + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance); + } // That way slider ticks come all from the same direction. From 7653ce80cd3b7c17d85dcc261ecf563b1791706a Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:16:10 +0200 Subject: [PATCH 020/132] add a period after EVERYTHING --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 464486884b..7fae89f3dc 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; - public override string Description => "Everything rotates. EVERYTHING"; public override double ScoreMultiplier => 1.05; + public override string Description => "Everything rotates. EVERYTHING."; public void ApplyToDrawableHitObjects(IEnumerable drawables) { From 8ad8c2b6d0fc800648ccd95210263aa60541559c Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:16:25 +0200 Subject: [PATCH 021/132] Reset the ScoreMultiplier to 1 --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 7fae89f3dc..440da5df4f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -19,8 +19,8 @@ namespace osu.Game.Rulesets.Osu.Mods public override string ShortenedName => "Arrange"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; - public override double ScoreMultiplier => 1.05; public override string Description => "Everything rotates. EVERYTHING."; + public override double ScoreMultiplier => 1; public void ApplyToDrawableHitObjects(IEnumerable drawables) { From d1ffb7c2d78b2fbce64954d7f8ac8f61c5aafb0d Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:38:27 +0200 Subject: [PATCH 022/132] Use timepreempt and put appeartime and move duration into their own vars. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 440da5df4f..dd4bb727a2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -39,15 +39,15 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; - // avoiding that the player can see the abroupt move. - const int pre_time_offset = 1000; - const float appearDistance = 250; + const float appear_distance = 250; + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double moveDuration = hitObject.TimePreempt + 1; - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimeFadeIn - pre_time_offset, true)) + using (drawable.BeginAbsoluteSequence(appearTime, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance) - .MoveTo(originalPosition, hitObject.TimeFadeIn + pre_time_offset, Easing.InOutSine); + .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) + .MoveTo(originalPosition, moveDuration, Easing.InOutSine); } From 89a18e4aac47644e61373862ed3492530a80a948 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 5 Aug 2018 15:39:12 +0200 Subject: [PATCH 023/132] remove nl and add comment for -1 and +1 --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index dd4bb727a2..5dabf6bfe1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -40,6 +40,8 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; const float appear_distance = 250; + + //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double moveDuration = hitObject.TimePreempt + 1; @@ -48,7 +50,6 @@ namespace osu.Game.Rulesets.Osu.Mods drawable .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) .MoveTo(originalPosition, moveDuration, Easing.InOutSine); - } // That way slider ticks come all from the same direction. From 8a9b3f6459324a0af0e1f2ec2c09e51392ef4144 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Wed, 15 Aug 2018 22:18:48 +0300 Subject: [PATCH 024/132] 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 d070a3e2d8feca209c46bf33cd791b350076544c Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 20:46:03 +0200 Subject: [PATCH 025/132] Only affect hitcicles, slider and spinner --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 5dabf6bfe1..49e98ea861 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -24,7 +24,13 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState); + drawables.Where(drawable => ( + drawable is DrawableHitCircle || + drawable is DrawableSlider || + drawable is DrawableSpinner + )).ForEach(drawable => + drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState + ); } private float theta; @@ -33,13 +39,10 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - // repeat points get their position data from the slider. - if (hitObject is RepeatPoint) - return; + float appear_distance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; - - const float appear_distance = 250; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance; //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; @@ -48,13 +51,11 @@ namespace osu.Game.Rulesets.Osu.Mods using (drawable.BeginAbsoluteSequence(appearTime, true)) { drawable - .MoveToOffset(new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance) + .MoveToOffset(appearOffset) .MoveTo(originalPosition, moveDuration, Easing.InOutSine); } - // That way slider ticks come all from the same direction. - if (hitObject is HitCircle || hitObject is Slider) - theta += 0.4f; + theta += 0.4f; } } } From c374755cc88d296e00092e2a36096b2334ce47c4 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:16:45 +0200 Subject: [PATCH 026/132] only affect spinner, hitcircle and slider and nothing else. --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 49e98ea861..83f6e7843e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -22,13 +22,15 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; + private readonly IReadOnlyList TargetHitObjectTypes = new List() { + typeof(HitCircle), + typeof(Slider), + typeof(Spinner), + }; + public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.Where(drawable => ( - drawable is DrawableHitCircle || - drawable is DrawableSlider || - drawable is DrawableSpinner - )).ForEach(drawable => + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState ); } @@ -39,6 +41,9 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; + if (!TargetHitObjectTypes.Contains(hitObject.GetType())) + return; + float appear_distance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; From 173d12c1ec191cfcedc6398b127084720f3d1e5c Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:17:18 +0200 Subject: [PATCH 027/132] rename arrange to transform --- osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs index 83f6e7843e..fd227b0285 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs @@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Mods { internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects { - public override string Name => "Arrange"; - public override string ShortenedName => "Arrange"; + public override string Name => "Transform"; + public override string ShortenedName => "TR"; public override FontAwesome Icon => FontAwesome.fa_arrows; public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; From 5c5191b9c3773e4bedbbc7d3db622bd1db29a811 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:19:28 +0200 Subject: [PATCH 028/132] Rename the mod class to transform. --- .../Mods/{OsuModArrange.cs => OsuModTransform.cs} | 6 +++++- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) rename osu.Game.Rulesets.Osu/Mods/{OsuModArrange.cs => OsuModTransform.cs} (92%) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs similarity index 92% rename from osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs rename to osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index fd227b0285..4b48e1af2c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModArrange.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using System.Collections.Generic; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; @@ -10,10 +11,13 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; +using osu.Game.Rulesets.Osu.UI; +using osu.Game.Rulesets.UI; +using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { - internal class OsuModArrange : Mod, IApplicableToDrawableHitObjects + internal class OsuModTransform : Mod, IApplicableToDrawableHitObjects { public override string Name => "Transform"; public override string ShortenedName => "TR"; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index c80ecbf6df..9e3214530f 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu }; case ModType.Fun: return new Mod[] { - new OsuModArrange(), + new OsuModTransform(), }; default: return new Mod[] { }; From 6600f7b30e145d7cac2222655943d9d5961b1e04 Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:27:20 +0200 Subject: [PATCH 029/132] correct the namings and styling --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 4b48e1af2c..6fa4ed434e 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -11,9 +11,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using OpenTK; -using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; -using osu.Game.Rulesets.Osu.Objects.Drawables; namespace osu.Game.Rulesets.Osu.Mods { @@ -26,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - private readonly IReadOnlyList TargetHitObjectTypes = new List() { + private readonly IReadOnlyList targetHitObjectTypes = new List() { typeof(HitCircle), typeof(Slider), typeof(Spinner), @@ -34,7 +31,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => + drawables.ForEach(drawable => drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState ); } @@ -45,13 +42,13 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject) drawable.HitObject; - if (!TargetHitObjectTypes.Contains(hitObject.GetType())) + if (!targetHitObjectTypes.Contains(hitObject.GetType())) return; - float appear_distance = (float)hitObject.TimePreempt * 0.5f; + float appearDistance = (float)hitObject.TimePreempt * 0.5f; Vector2 originalPosition = drawable.Position; - Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appear_distance; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; From 0a48f8eadd76d7e06ecf97a575aa5a49d0b382fd Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 22 Aug 2018 21:39:59 +0200 Subject: [PATCH 030/132] remove empty object ctar args --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 6fa4ed434e..e31c7b12f9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - private readonly IReadOnlyList targetHitObjectTypes = new List() { + private readonly IReadOnlyList targetHitObjectTypes = new List { typeof(HitCircle), typeof(Slider), typeof(Spinner), From 8112a51d5fc1b2e9c4d51c7224562377d7e71f04 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:23:27 +0200 Subject: [PATCH 031/132] Only apply the transformation once and make the distance and theta dynamic. --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 59 ++++++++----------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index e31c7b12f9..e76da68bee 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -22,46 +22,35 @@ namespace osu.Game.Rulesets.Osu.Mods public override ModType Type => ModType.Fun; public override string Description => "Everything rotates. EVERYTHING."; public override double ScoreMultiplier => 1; - - private readonly IReadOnlyList targetHitObjectTypes = new List { - typeof(HitCircle), - typeof(Slider), - typeof(Spinner), - }; + private float theta; public void ApplyToDrawableHitObjects(IEnumerable drawables) { - drawables.ForEach(drawable => - drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState - ); - } - - private float theta; - - private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) - { - var hitObject = (OsuHitObject) drawable.HitObject; - - if (!targetHitObjectTypes.Contains(hitObject.GetType())) - return; - - float appearDistance = (float)hitObject.TimePreempt * 0.5f; - - Vector2 originalPosition = drawable.Position; - Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; - - //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. - double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; - double moveDuration = hitObject.TimePreempt + 1; - - using (drawable.BeginAbsoluteSequence(appearTime, true)) + foreach (var drawable in drawables) { - drawable - .MoveToOffset(appearOffset) - .MoveTo(originalPosition, moveDuration, Easing.InOutSine); - } + var hitObject = (OsuHitObject) drawable.HitObject; - theta += 0.4f; + float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2; + + Vector2 originalPosition = drawable.Position; + Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; + + //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double moveDuration = hitObject.TimePreempt + 1; + + using (drawable.BeginAbsoluteSequence(appearTime, true)) + { + drawable + .MoveToOffset(appearOffset) + .MoveTo(originalPosition, moveDuration, Easing.InOutSine); + } + + theta += (float) hitObject.TimeFadeIn / 1000; + } } + + + } } From 8b016f05e6cb18e110de0d1bba636ae5dd360304 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:24:57 +0200 Subject: [PATCH 032/132] Remove unessesary nl --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index e76da68bee..4892ba8dc1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -49,8 +49,5 @@ namespace osu.Game.Rulesets.Osu.Mods theta += (float) hitObject.TimeFadeIn / 1000; } } - - - } } From 726a51018915a55a399e67a573e70aa105b33219 Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 24 Aug 2018 22:33:14 +0200 Subject: [PATCH 033/132] remove not needed usings --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 4892ba8dc1..5839d51500 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -2,9 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using System.Collections.Generic; -using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; From 4c42d4031440623a7ac1d62a7b2201691df0c6bb Mon Sep 17 00:00:00 2001 From: miterosan Date: Wed, 5 Sep 2018 21:09:09 +0200 Subject: [PATCH 034/132] Correct the comment from explosion to object --- osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 5839d51500..30837d7db9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods Vector2 originalPosition = drawable.Position; Vector2 appearOffset = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * appearDistance; - //the - 1 and + 1 prevents the hit explosion to appear in the wrong position. + //the - 1 and + 1 prevents the hit objects to appear in the wrong position. double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double moveDuration = hitObject.TimePreempt + 1; From 7a1fdd9dc8a146ffdb951c6588c001ede4d0c11e Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 6 Sep 2018 01:01:36 +0300 Subject: [PATCH 035/132] 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 036/132] 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 037/132] 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 038/132] 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 27ac7685e164dafd1c555a3f8b8667bf0d9cf7b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 9 Sep 2018 22:12:37 +0900 Subject: [PATCH 039/132] Bring music controller in front of notification overlay --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 6fcb948298..8610a8d74d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -355,7 +355,7 @@ namespace osu.Game loadComponentSingleFile(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add); loadComponentSingleFile(musicController = new MusicController { - Depth = -4, + Depth = -5, Position = new Vector2(0, Toolbar.HEIGHT), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, From 0be3ba946fdb4f2d02d4b60adf5c2a7231d83de5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Sep 2018 13:40:46 +0900 Subject: [PATCH 040/132] Fix system user attempting to show in profile overlay --- osu.Game/Online/Chat/InfoMessage.cs | 6 +----- osu.Game/Overlays/UserProfileOverlay.cs | 4 +++- osu.Game/Users/User.cs | 9 +++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 2ff901deb1..4e14b097f7 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -15,11 +15,7 @@ namespace osu.Game.Online.Chat Timestamp = DateTimeOffset.Now; Content = message; - Sender = new User - { - Username = @"system", - Colour = @"0000ff", - }; + Sender = User.SystemUser; } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index ea077ff645..f428e8cfc6 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -77,9 +77,11 @@ namespace osu.Game.Overlays public void ShowUser(User user, bool fetchOnline = true) { + if (user == User.SystemUser) return; + Show(); - if (user.Id == Header?.User.Id) + if (user.Id == Header?.User?.Id) return; userReq?.Cancel(); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index f42df4023f..3a90605da7 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -144,5 +144,14 @@ namespace osu.Game.Users public Badge[] Badges; public override string ToString() => Username; + + /// + /// A user instance for displaying locally created system messages. + /// + public static User SystemUser { get; } = new User + { + Username = "system", + Id = 0 + }; } } From 4341d258af3d9ab94cf95cf20e02c921aa426894 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 13 Sep 2018 14:03:21 +0900 Subject: [PATCH 041/132] Make readonly instead --- osu.Game/Online/Chat/InfoMessage.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 2 +- osu.Game/Users/User.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 4e14b097f7..103a999591 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -15,7 +15,7 @@ namespace osu.Game.Online.Chat Timestamp = DateTimeOffset.Now; Content = message; - Sender = User.SystemUser; + Sender = User.SYSTEM_USER; } } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index f428e8cfc6..c106446fe0 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays public void ShowUser(User user, bool fetchOnline = true) { - if (user == User.SystemUser) return; + if (user == User.SYSTEM_USER) return; Show(); diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 3a90605da7..6c3d2bfa63 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -148,7 +148,7 @@ namespace osu.Game.Users /// /// A user instance for displaying locally created system messages. /// - public static User SystemUser { get; } = new User + public static readonly User SYSTEM_USER = new User { Username = "system", Id = 0 From 221a99d886cfe9aaacf6515dcd65c0c0673b90e1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 08:54:58 +0200 Subject: [PATCH 042/132] fix StatusPill not setting text when initially set with NONE --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index c7e97cef55..511ce9aa58 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -14,10 +14,10 @@ namespace osu.Game.Beatmaps.Drawables { private readonly OsuSpriteText statusText; - private BeatmapSetOnlineStatus status = BeatmapSetOnlineStatus.None; + private BeatmapSetOnlineStatus status; public BeatmapSetOnlineStatus Status { - get { return status; } + get => status; set { if (value == status) return; @@ -49,6 +49,8 @@ namespace osu.Game.Beatmaps.Drawables Padding = textPadding, }, }; + + Status = BeatmapSetOnlineStatus.None; } } } From 13b988053a116306855e48316bc00bbf62fa413c Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:10:58 +0200 Subject: [PATCH 043/132] add status column to BeatmapInfo + BeatmapSetInfo --- osu.Game/Beatmaps/BeatmapInfo.cs | 11 +- osu.Game/Beatmaps/BeatmapSetInfo.cs | 6 +- .../20180913080842_AddRankStatus.Designer.cs | 380 ++++++++++++++++++ .../20180913080842_AddRankStatus.cs | 33 ++ .../Migrations/OsuDbContextModelSnapshot.cs | 9 +- 5 files changed, 430 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs create mode 100644 osu.Game/Migrations/20180913080842_AddRankStatus.cs diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 303a19aab3..5a5229e29f 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -27,13 +27,15 @@ namespace osu.Game.Beatmaps [JsonProperty("id")] public int? OnlineBeatmapID { - get { return onlineBeatmapID; } - set { onlineBeatmapID = value > 0 ? value : null; } + get => onlineBeatmapID; + set => onlineBeatmapID = value > 0 ? value : null; } [JsonIgnore] public int BeatmapSetInfoID { get; set; } + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; + [Required] public BeatmapSetInfo BeatmapSet { get; set; } @@ -82,7 +84,7 @@ namespace osu.Game.Beatmaps [JsonIgnore] public string StoredBookmarks { - get { return string.Join(",", Bookmarks); } + get => string.Join(",", Bookmarks); set { if (string.IsNullOrEmpty(value)) @@ -93,8 +95,7 @@ namespace osu.Game.Beatmaps Bookmarks = value.Split(',').Select(v => { - int val; - bool result = int.TryParse(v, out val); + bool result = int.TryParse(v, out int val); return new { result, val }; }).Where(p => p.result).Select(p => p.val).ToArray(); } diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index ebebe42097..e131be0b70 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -17,9 +17,11 @@ namespace osu.Game.Beatmaps public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs new file mode 100644 index 0000000000..5ab43da046 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.Designer.cs @@ -0,0 +1,380 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20180913080842_AddRankStatus")] + partial class AddRankStatus + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20180913080842_AddRankStatus.cs b/osu.Game/Migrations/20180913080842_AddRankStatus.cs new file mode 100644 index 0000000000..bba4944bb7 --- /dev/null +++ b/osu.Game/Migrations/20180913080842_AddRankStatus.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddRankStatus : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapSetInfo", + nullable: false, + defaultValue: -3); // NONE + + migrationBuilder.AddColumn( + name: "Status", + table: "BeatmapInfo", + nullable: false, + defaultValue: -3); // NONE + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapSetInfo"); + + migrationBuilder.DropColumn( + name: "Status", + table: "BeatmapInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 6dbeaed62f..fde5c9fd82 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,7 +1,8 @@ // - +using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using osu.Game.Database; namespace osu.Game.Migrations @@ -13,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846"); + .HasAnnotation("ProductVersion", "2.1.2-rtm-30932"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -78,6 +79,8 @@ namespace osu.Game.Migrations b.Property("StarDifficulty"); + b.Property("Status"); + b.Property("StoredBookmarks"); b.Property("TimelineZoom"); @@ -173,6 +176,8 @@ namespace osu.Game.Migrations b.Property("Protected"); + b.Property("Status"); + b.HasKey("ID"); b.HasIndex("DeletePending"); From 5414ce9932887b082b37f5e663d4b7e3653a8de7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 10:18:20 +0200 Subject: [PATCH 044/132] add StatusPill to BeatmapInfoWedge and DrawabelCarouselBeatmapSet --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 19 ++++++++++++++++- .../Carousel/DrawableCarouselBeatmapSet.cs | 21 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index d26702fcf9..febd136e25 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -127,6 +127,7 @@ namespace osu.Game.Screens.Select public OsuSpriteText VersionLabel { get; private set; } public OsuSpriteText TitleLabel { get; private set; } public OsuSpriteText ArtistLabel { get; private set; } + public BeatmapSetOnlineStatusPill StatusPill { get; private set; } public FillFlowContainer MapperContainer { get; private set; } public FillFlowContainer InfoLabelContainer { get; private set; } @@ -190,7 +191,7 @@ namespace osu.Game.Screens.Select }, new FillFlowContainer { - Name = "Top-aligned metadata", + Name = "Topleft-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, @@ -207,6 +208,22 @@ namespace osu.Game.Screens.Select } }, new FillFlowContainer + { + Name = "Topright-aligned metadata", + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + Direction = FillDirection.Vertical, + Margin = new MarginPadding { Top = 14, Left = 10, Right = 18, Bottom = 20 }, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Status = beatmapInfo.Status, + } + } + }, + new FillFlowContainer { Name = "Centre-aligned metadata", Anchor = Anchor.CentreLeft, diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 23f338b530..52d34a935f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -78,11 +78,26 @@ namespace osu.Game.Screens.Select.Carousel TextSize = 17, Shadow = true, }, - new FillFlowContainer + new FillFlowContainer { - Margin = new MarginPadding { Top = 5 }, + Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, - Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + Margin = new MarginPadding { Top = 5 }, + Children = new Drawable[] + { + new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + { + Origin = Anchor.CentreLeft, + Anchor = Anchor.CentreLeft, + Margin = new MarginPadding{ Right = 5 }, + Status = beatmapSet.Status + }, + new FillFlowContainer + { + AutoSizeAxes = Axes.Both, + Children = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList() + }, + } } } } From 638a2e5ba84490663b576d9ed31980495fcbf692 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 11:57:33 +0200 Subject: [PATCH 045/132] populate Status for Beatmap + BeatmapSet also added Status to APIBeatmap + APIBeatmapSet --- osu.Game/Beatmaps/BeatmapInfo.cs | 2 +- osu.Game/Beatmaps/BeatmapManager.cs | 17 +++++++++++------ osu.Game/Beatmaps/BeatmapSetInfo.cs | 2 +- .../Online/API/Requests/Responses/APIBeatmap.cs | 10 +++++++++- .../API/Requests/Responses/APIBeatmapSet.cs | 15 ++++++++------- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 5a5229e29f..1aa4818393 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -35,7 +35,7 @@ namespace osu.Game.Beatmaps public int BeatmapSetInfoID { get; set; } public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; - + [Required] public BeatmapSetInfo BeatmapSet { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 21df9a6c68..aa653d88f9 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.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 System; @@ -104,7 +104,7 @@ namespace osu.Game.Beatmaps validateOnlineIds(beatmapSet.Beatmaps); foreach (BeatmapInfo b in beatmapSet.Beatmaps) - fetchAndPopulateOnlineIDs(b, beatmapSet.Beatmaps); + fetchAndPopulateOnlineValues(b, beatmapSet.Beatmaps); // check if a set already exists with the same online id, delete if it does. if (beatmapSet.OnlineBeatmapSetID != null) @@ -388,21 +388,22 @@ namespace osu.Game.Beatmaps } /// - /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. + /// Query the API to populate missing values like OnlineBeatmapID / OnlineBeatmapSetID or (Rank-)Status. /// /// The beatmap to populate. /// The other beatmaps contained within this set. /// Whether to re-query if the provided beatmap already has populated values. /// True if population was successful. - private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) + private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { if (api?.State != APIState.Online) return false; - if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) + if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null + && beatmap.Status != BeatmapSetOnlineStatus.None && beatmap.BeatmapSet.Status != BeatmapSetOnlineStatus.None) return true; - Logger.Log("Attempting online lookup for IDs...", LoggingTarget.Database); + Logger.Log("Attempting online lookup for the missing values...", LoggingTarget.Database); try { @@ -414,6 +415,9 @@ namespace osu.Game.Beatmaps Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + beatmap.Status = res.Status; + beatmap.BeatmapSet.Status = res.BeatmapSet.Status; + if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID)) { Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database); @@ -422,6 +426,7 @@ namespace osu.Game.Beatmaps beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; + return true; } catch (Exception e) diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index e131be0b70..7a7d010a31 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps get => onlineBeatmapSetID; set => onlineBeatmapSetID = value > 0 ? value : null; } - + public BeatmapSetOnlineStatus Status { get; set; } = BeatmapSetOnlineStatus.None; public BeatmapMetadata Metadata { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 99e4392374..193ccf1f6b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -15,6 +15,12 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset_id")] public int OnlineBeatmapSetID { get; set; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + + [JsonProperty(@"beatmapset")] + public APIBeatmapSet BeatmapSet { get; set; } + [JsonProperty(@"playcount")] private int playCount { get; set; } @@ -59,11 +65,13 @@ namespace osu.Game.Online.API.Requests.Responses Ruleset = rulesets.GetRuleset(ruleset), StarDifficulty = starDifficulty, OnlineBeatmapID = OnlineBeatmapID, + Version = version, + Status = Status, BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = OnlineBeatmapSetID, + Status = BeatmapSet?.Status ?? BeatmapSetOnlineStatus.None }, - Version = version, BaseDifficulty = new BeatmapDifficulty { DrainRate = drainRate, diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index bbaaa0c756..8446285070 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -20,10 +20,13 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"id")] public int? OnlineBeatmapSetID { - get { return onlineBeatmapSetID; } - set { onlineBeatmapSetID = value > 0 ? value : null; } + get => onlineBeatmapSetID; + set => onlineBeatmapSetID = value > 0 ? value : null; } + [JsonProperty(@"status")] + public BeatmapSetOnlineStatus Status { get; set; } + [JsonProperty(@"preview_url")] private string preview { get; set; } @@ -42,9 +45,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"storyboard")] private bool hasStoryboard { get; set; } - [JsonProperty(@"status")] - private BeatmapSetOnlineStatus status { get; set; } - [JsonProperty(@"submitted_date")] private DateTimeOffset submitted { get; set; } @@ -57,7 +57,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"user_id")] private long creatorId { - set { Author.Id = value; } + set => Author.Id = value; } [JsonProperty(@"beatmaps")] @@ -69,6 +69,7 @@ namespace osu.Game.Online.API.Requests.Responses { OnlineBeatmapSetID = OnlineBeatmapSetID, Metadata = this, + Status = Status, OnlineInfo = new BeatmapSetOnlineInfo { Covers = covers, @@ -76,7 +77,7 @@ namespace osu.Game.Online.API.Requests.Responses PlayCount = playCount, FavouriteCount = favouriteCount, BPM = bpm, - Status = status, + Status = Status, HasVideo = hasVideo, HasStoryboard = hasStoryboard, Submitted = submitted, From 04853b8c8366a20f605477cbd5cd60f1f8b46ac8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 13 Sep 2018 13:49:57 +0200 Subject: [PATCH 046/132] don't show StatusPill without a difficulty --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index febd136e25..ae5134c0da 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,8 +261,11 @@ namespace osu.Game.Screens.Select } } }; - artistBinding.ValueChanged += value => setMetadata(metadata.Source); - artistBinding.TriggerChange(); + artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); + + // no difficulty means it can't have a status to show + if (beatmapInfo.Version == null) + StatusPill.Hide(); } private void setMetadata(string source) From f280e910bbbe0fe7a16c090a78a6940d0f48798e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 04:20:11 +0900 Subject: [PATCH 047/132] 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 1c2cc3837a59d6023fa086db90ea1ccd50e9fdd6 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Thu, 13 Sep 2018 21:52:15 +0200 Subject: [PATCH 048/132] Compute combo for nested Objects. Display fruit depending on Combo for osu!catch --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 2 +- osu.Game/Beatmaps/BeatmapProcessor.cs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 621fc100c2..2346a55bbe 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Catch.Objects public int IndexInBeatmap { get; set; } - public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4); + public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(ComboIndex % 4); public virtual bool NewCombo { get; set; } diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 9d7cd673dc..84bf6ada18 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,6 +44,15 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + foreach (var hitObject in Beatmap.HitObjects) + { + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var obj in hitObject.NestedHitObjects.OfType()) + { + obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; + obj.ComboIndex = objectComboInfo.ComboIndex; + } + } } } } From b1f6828a1a29e7ccd7004fe15c039c8153cc29a3 Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Wed, 5 Sep 2018 20:30:03 +0200 Subject: [PATCH 049/132] Added OsuModWiggle class and adjusted OsuRuleset.cs --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 82 ++++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 5 ++ 2 files changed, 87 insertions(+) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs new file mode 100644 index 0000000000..5e6cb22ec3 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -0,0 +1,82 @@ +// 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 osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using OpenTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModWiggle : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Wiggle"; + public override string ShortenedName => "WG"; + public override FontAwesome Icon => FontAwesome.fa_arrows_alt; + public override ModType Type => ModType.Fun; + public override string Description => "They just won't stay still..."; + public override double ScoreMultiplier => 1; + + private readonly int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private readonly int wiggle_strength = 10; // Higher = stronger wiggles + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + foreach(var drawable in drawables) + drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState; + } + + private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) + { + var hitObject = (OsuHitObject)drawable.HitObject; + Vector2 origPos = drawable.Position; + + Random distRand = new Random(hitObject.ComboOffset); + Random angleRand = new Random(hitObject.IndexInCurrentCombo); + + // Wiggle all objects during TimePreempt + int amountWiggles = (int)hitObject.TimePreempt / wiggle_delay; + + for (int i = 0; i < amountWiggles; i++) + { + using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt + i * wiggle_delay, true)) + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); + drawable.MoveTo(wiggledPos, wiggle_delay); + } + } + + // Keep wiggling sliders and spinners for their duration + double objDuration; + if (hitObject is Slider slider) + { + objDuration = slider.Duration; + } + else if (hitObject is Spinner spinner) + { + objDuration = spinner.Duration; + } + else + return; + + amountWiggles = (int)(objDuration / wiggle_delay); + + for (int i = 0; i < amountWiggles; i++) + { + using (drawable.BeginAbsoluteSequence(hitObject.StartTime + i * wiggle_delay, true)) + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); + drawable.MoveTo(wiggledPos, wiggle_delay); + } + } + } + } +} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index fa6e9a018a..a16f6494e7 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -117,6 +117,11 @@ namespace osu.Game.Rulesets.Osu new OsuModRelax(), new OsuModAutopilot(), }; + case ModType.Fun: + return new Mod[] + { + new OsuModWiggle(), + }; default: return new Mod[] { }; } From 9d94aa4e6260cac120abb67f15c43ba6be3367ff Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 17:38:47 +0900 Subject: [PATCH 050/132] Fix formatting and constants --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 5e6cb22ec3..d03908fef1 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -21,12 +21,12 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - private readonly int wiggle_delay = 90; // (ms) Higher = fewer wiggles - private readonly int wiggle_strength = 10; // Higher = stronger wiggles - + private const int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private const int wiggle_strength = 10; // Higher = stronger wiggles + public void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach(var drawable in drawables) + foreach (var drawable in drawables) drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState; } @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Mods { var hitObject = (OsuHitObject)drawable.HitObject; Vector2 origPos = drawable.Position; - + Random distRand = new Random(hitObject.ComboOffset); Random angleRand = new Random(hitObject.IndexInCurrentCombo); From 00daaef27a8885284372fcbd738df89b78454d76 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 17:57:27 +0900 Subject: [PATCH 051/132] Use a slightly more suiting icon --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index d03908fef1..46ccfc5a35 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Wiggle"; public override string ShortenedName => "WG"; - public override FontAwesome Icon => FontAwesome.fa_arrows_alt; + public override FontAwesome Icon => FontAwesome.fa_certificate; public override ModType Type => ModType.Fun; public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; From ef31698f5653a82219a5ad3f9d29e86da362caaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 18:18:40 +0900 Subject: [PATCH 052/132] Further code tidying --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 55 ++++++++-------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 46ccfc5a35..206d7e649f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; @@ -21,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Description => "They just won't stay still..."; public override double ScoreMultiplier => 1; - private const int wiggle_delay = 90; // (ms) Higher = fewer wiggles + private const int wiggle_duration = 90; // (ms) Higher = fewer wiggles private const int wiggle_strength = 10; // Higher = stronger wiggles public void ApplyToDrawableHitObjects(IEnumerable drawables) @@ -32,51 +33,35 @@ namespace osu.Game.Rulesets.Osu.Mods private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state) { - var hitObject = (OsuHitObject)drawable.HitObject; - Vector2 origPos = drawable.Position; + var osuObject = (OsuHitObject)drawable.HitObject; + Vector2 origin = drawable.Position; - Random distRand = new Random(hitObject.ComboOffset); - Random angleRand = new Random(hitObject.IndexInCurrentCombo); + Random distRand = new Random(osuObject.ComboOffset); + Random angleRand = new Random(osuObject.IndexInCurrentCombo); // Wiggle all objects during TimePreempt - int amountWiggles = (int)hitObject.TimePreempt / wiggle_delay; + int amountWiggles = (int)osuObject.TimePreempt / wiggle_duration; + + void wiggle() + { + float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration); + } for (int i = 0; i < amountWiggles; i++) - { - using (drawable.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt + i * wiggle_delay, true)) - { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); - Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); - drawable.MoveTo(wiggledPos, wiggle_delay); - } - } + using (drawable.BeginAbsoluteSequence(osuObject.StartTime - osuObject.TimePreempt + i * wiggle_duration, true)) + wiggle(); // Keep wiggling sliders and spinners for their duration - double objDuration; - if (hitObject is Slider slider) - { - objDuration = slider.Duration; - } - else if (hitObject is Spinner spinner) - { - objDuration = spinner.Duration; - } - else + if (!(osuObject is IHasEndTime endTime)) return; - amountWiggles = (int)(objDuration / wiggle_delay); + amountWiggles = (int)(endTime.Duration / wiggle_duration); for (int i = 0; i < amountWiggles; i++) - { - using (drawable.BeginAbsoluteSequence(hitObject.StartTime + i * wiggle_delay, true)) - { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); - Vector2 wiggledPos = new Vector2((float)(nextDist * Math.Cos(nextAngle) + origPos.X), (float)(nextDist * Math.Sin(nextAngle) + origPos.Y)); - drawable.MoveTo(wiggledPos, wiggle_delay); - } - } + using (drawable.BeginAbsoluteSequence(osuObject.StartTime + i * wiggle_duration, true)) + wiggle(); } } } From ec6185cd3196776c2eacc120ebcb50e937b175db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 14 Sep 2018 18:20:19 +0900 Subject: [PATCH 053/132] Reduce random allocations --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 206d7e649f..5b69247451 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -36,16 +36,15 @@ namespace osu.Game.Rulesets.Osu.Mods var osuObject = (OsuHitObject)drawable.HitObject; Vector2 origin = drawable.Position; - Random distRand = new Random(osuObject.ComboOffset); - Random angleRand = new Random(osuObject.IndexInCurrentCombo); + Random objRand = new Random((int)osuObject.StartTime); // Wiggle all objects during TimePreempt int amountWiggles = (int)osuObject.TimePreempt / wiggle_duration; void wiggle() { - float nextAngle = (float)(angleRand.NextDouble() * 2 * Math.PI); - float nextDist = (float)(distRand.NextDouble() * wiggle_strength); + float nextAngle = (float)(objRand.NextDouble() * 2 * Math.PI); + float nextDist = (float)(objRand.NextDouble() * wiggle_strength); drawable.MoveTo(new Vector2((float)(nextDist * Math.Cos(nextAngle) + origin.X), (float)(nextDist * Math.Sin(nextAngle) + origin.Y)), wiggle_duration); } From 9f546bd48447d7d3b65f43088391b8ba318e37f5 Mon Sep 17 00:00:00 2001 From: LastExceed Date: Fri, 14 Sep 2018 13:50:35 +0200 Subject: [PATCH 054/132] close tab on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 2e3c9f9c5f..6764b5e77b 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -13,6 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using OpenTK; +using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using System; @@ -143,6 +144,13 @@ namespace osu.Game.Overlays.Chat textBold.FadeOut(transition_length, Easing.OutQuint); } + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + if (args.Button == MouseButton.Middle) + closeButton.Action(); + return base.OnMouseUp(state, args); + } + protected override bool OnHover(InputState state) { if (IsRemovable) From 347cb0a1b5bdaf64f90a4dfc699a1dd2b30d5856 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:41:29 +0200 Subject: [PATCH 055/132] Check for type conversion, mais the update recursive --- osu.Game/Beatmaps/BeatmapProcessor.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 84bf6ada18..1a767942eb 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,13 +44,24 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { + void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + { + if (obj is IHasComboInformation) + { + var objectComboInfo = (IHasComboInformation)obj; + objectComboInfo.ComboIndex = comboIndex; + objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; + foreach (var nestedObjet in obj.NestedHitObjects) + UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + } + } foreach (var hitObject in Beatmap.HitObjects) { - var objectComboInfo = (IHasComboInformation)hitObject; - foreach (var obj in hitObject.NestedHitObjects.OfType()) + if (hitObject is IHasComboInformation) { - obj.IndexInCurrentCombo = objectComboInfo.IndexInCurrentCombo; - obj.ComboIndex = objectComboInfo.ComboIndex; + var objectComboInfo = (IHasComboInformation)hitObject; + foreach (var nested in hitObject.NestedHitObjects) + UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From c8d3776c79767b24b6772ee87014f5bd67008c8f Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:46:04 +0200 Subject: [PATCH 056/132] Remove uneeded brackets --- osu.Game/Beatmaps/BeatmapProcessor.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 1a767942eb..35420efa8e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -56,14 +56,12 @@ namespace osu.Game.Beatmaps } } foreach (var hitObject in Beatmap.HitObjects) - { if (hitObject is IHasComboInformation) { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } - } } } } From 3e7006ec1fe25a650b8ef33107d91b71dd3a4f7e Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Fri, 14 Sep 2018 19:52:32 +0200 Subject: [PATCH 057/132] Fix fonction name --- osu.Game/Beatmaps/BeatmapProcessor.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 35420efa8e..7007c41402 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -44,7 +44,7 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void UpdateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) { if (obj is IHasComboInformation) { @@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; foreach (var nestedObjet in obj.NestedHitObjects) - UpdateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); } } foreach (var hitObject in Beatmap.HitObjects) @@ -60,7 +60,7 @@ namespace osu.Game.Beatmaps { var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) - UpdateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); + updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } } } From dd7f667fe3622e77bf3661b8210de806eb9ee2f2 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sat, 15 Sep 2018 00:18:42 +0200 Subject: [PATCH 058/132] 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 059/132] 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 060/132] 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 061/132] 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 062/132] 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 063/132] 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 064/132] 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 065/132] 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 066/132] 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 067/132] 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 eb86f9de5e2e2db53bf756d5724f0da6ce5125f7 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:28:19 -0400 Subject: [PATCH 068/132] Check for skins folder also --- osu.Desktop/OsuGameDesktop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 79ac24a1da..9d75c49a6a 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -92,7 +92,7 @@ namespace osu.Desktop { protected override string LocateBasePath() { - bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")) && Directory.Exists(Path.Combine(p, "Skins")); string stableInstallPath; From 75e6bbc4d895987c2837846febf242be96fa7e80 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:33:31 -0400 Subject: [PATCH 069/132] Revert "Check for skins folder also" This reverts commit eb86f9de5e2e2db53bf756d5724f0da6ce5125f7. --- osu.Desktop/OsuGameDesktop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 9d75c49a6a..79ac24a1da 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -92,7 +92,7 @@ namespace osu.Desktop { protected override string LocateBasePath() { - bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")) && Directory.Exists(Path.Combine(p, "Skins")); + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); string stableInstallPath; From 42b2c322226b6ed2c1a9ba5ba5744762adee9d0d Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:47:50 -0400 Subject: [PATCH 070/132] Catch directory not found exception --- osu.Game/Database/ArchiveModelManager.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index f4f169f27c..ce0ec5caed 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,7 +438,15 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); + return Task.Factory.StartNew(() => { + try { + Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); + } catch (DirectoryNotFoundException) { + // This handles situations like when the user does not have a Skins folder + // which would have this exception thrown from stable.GetDirectories + Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + } + }, TaskCreationOptions.LongRunning); } #endregion From d469748612a9034be91c0d8874610333b24b0b1f Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 15 Sep 2018 09:53:59 -0400 Subject: [PATCH 071/132] Reformat code --- osu.Game/Database/ArchiveModelManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ce0ec5caed..ee9bf70aeb 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,10 +438,14 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => { - try { + return Task.Factory.StartNew(() => + { + try + { Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); - } catch (DirectoryNotFoundException) { + } + catch (DirectoryNotFoundException) + { // This handles situations like when the user does not have a Skins folder // which would have this exception thrown from stable.GetDirectories Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); From 00d0613053a5ccaaabd04a73e48a7c8fca369417 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 16 Sep 2018 00:09:17 +0900 Subject: [PATCH 072/132] 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); From fce9740f2810468c58fd87b588831766c0664dfa Mon Sep 17 00:00:00 2001 From: LastExceed Date: Sat, 15 Sep 2018 18:00:47 +0200 Subject: [PATCH 073/132] return true since we are handling the action --- osu.Game/Overlays/Chat/ChatTabControl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 6764b5e77b..048659746d 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat { if (args.Button == MouseButton.Middle) closeButton.Action(); - return base.OnMouseUp(state, args); + return true; } protected override bool OnHover(InputState state) From 8bfd981a50526768f0c0b17f5edc444fc4ff8cbf Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 17 Sep 2018 21:05:28 -0400 Subject: [PATCH 074/132] Handle directory checking before entering task --- osu.Game/Database/ArchiveModelManager.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index ee9bf70aeb..06a8b490ef 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -438,19 +438,14 @@ namespace osu.Game.Database return Task.CompletedTask; } - return Task.Factory.StartNew(() => + if (!stable.ExistsDirectory(ImportFromStablePath)) { - try - { - Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()); - } - catch (DirectoryNotFoundException) - { - // This handles situations like when the user does not have a Skins folder - // which would have this exception thrown from stable.GetDirectories - Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); - } - }, TaskCreationOptions.LongRunning); + // This handles situations like when the user does not have a Skins folder + Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + return Task.CompletedTask; + } + + return Task.Factory.StartNew(() => Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()), TaskCreationOptions.LongRunning); } #endregion From aba1de8b1ab1c29c85a126cbc065b9d52c884c30 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 18 Sep 2018 12:54:07 +0900 Subject: [PATCH 075/132] Cleanup --- osu.Game/Beatmaps/BeatmapProcessor.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapProcessor.cs b/osu.Game/Beatmaps/BeatmapProcessor.cs index 7007c41402..9db2c5f08e 100644 --- a/osu.Game/Beatmaps/BeatmapProcessor.cs +++ b/osu.Game/Beatmaps/BeatmapProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps @@ -44,24 +45,25 @@ namespace osu.Game.Beatmaps public virtual void PostProcess() { - void updateNestedCombo(Rulesets.Objects.HitObject obj, int comboIndex, int indexInCurrentCombo) + void updateNestedCombo(HitObject obj, int comboIndex, int indexInCurrentCombo) { - if (obj is IHasComboInformation) + if (obj is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)obj; objectComboInfo.ComboIndex = comboIndex; objectComboInfo.IndexInCurrentCombo = indexInCurrentCombo; - foreach (var nestedObjet in obj.NestedHitObjects) - updateNestedCombo(nestedObjet, comboIndex, indexInCurrentCombo); + foreach (var nestedObject in obj.NestedHitObjects) + updateNestedCombo(nestedObject, comboIndex, indexInCurrentCombo); } } + foreach (var hitObject in Beatmap.HitObjects) - if (hitObject is IHasComboInformation) + { + if (hitObject is IHasComboInformation objectComboInfo) { - var objectComboInfo = (IHasComboInformation)hitObject; foreach (var nested in hitObject.NestedHitObjects) updateNestedCombo(nested, objectComboInfo.ComboIndex, objectComboInfo.IndexInCurrentCombo); } + } } } } From 27ea6102bc5d38ce773f15d4260c69e99e01a3db Mon Sep 17 00:00:00 2001 From: LastExceed Date: Tue, 18 Sep 2018 08:07:19 +0200 Subject: [PATCH 076/132] only return true on Mclick --- osu.Game/Overlays/Chat/ChatTabControl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 048659746d..524cae5600 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,9 +146,10 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - if (args.Button == MouseButton.Middle) + var isMclick = args.Button == MouseButton.Middle; + if (isMclick) closeButton.Action(); - return true; + return isMclick; } protected override bool OnHover(InputState state) From ad3196264307e2ee566972168dbd539b2f20c52e Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 18 Sep 2018 15:27:21 +0900 Subject: [PATCH 077/132] Cleanup, use similar code to everywhere else --- osu.Game/Overlays/Chat/ChatTabControl.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 524cae5600..d9327e73e8 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -146,10 +146,13 @@ namespace osu.Game.Overlays.Chat protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - var isMclick = args.Button == MouseButton.Middle; - if (isMclick) + if (args.Button == MouseButton.Middle) + { closeButton.Action(); - return isMclick; + return true; + } + + return false; } protected override bool OnHover(InputState state) From e3cc25a96a32735dc00bdbb983c632dd020f8013 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:21:10 +0200 Subject: [PATCH 078/132] Implement ConstantScrollingSpeedVisualiser --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 ++ osu.Game/Configuration/SpeedChangeVisualisationMethod.cs | 4 +++- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 3 +++ .../Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 102ec7fb3b..85e14eaad0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -55,6 +55,8 @@ namespace osu.Game.Rulesets.Catch.UI RelativeSizeAxes = Axes.Both, }, }); + + VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450) / 1.2; } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj); diff --git a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs b/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs index d38b1a89c5..39c6e5649c 100644 --- a/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs +++ b/osu.Game/Configuration/SpeedChangeVisualisationMethod.cs @@ -10,6 +10,8 @@ namespace osu.Game.Configuration [Description("Sequential")] Sequential, [Description("Overlapping")] - Overlapping + Overlapping, + [Description("Constant")] + Constant } } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index c64fca6eff..3ce1ab9960 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -54,6 +54,9 @@ namespace osu.Game.Rulesets.UI.Scrolling case SpeedChangeVisualisationMethod.Overlapping: speedChangeVisualiser = new OverlappingSpeedChangeVisualiser(ControlPoints); break; + case SpeedChangeVisualisationMethod.Constant: + speedChangeVisualiser = new ConstantSpeedChangeVisualiser(); + break; } } diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs index 25dea8dfbf..f12e274022 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers foreach (var obj in hitObjects) { - var finalPosition = hitObjectPositions[obj] - timelinePosition; + var finalPosition = (hitObjectPositions[obj] - timelinePosition); switch (direction) { From 2afcdb14515813fdf55082d1bbfe3a751369f911 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:23:25 +0200 Subject: [PATCH 079/132] Add the file --- .../ConstantSpeedChangeVisualiser.cs | 69 +++++++++++++++++++ .../SequentialSpeedChangeVisualiser.cs | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs new file mode 100644 index 0000000000..422617e836 --- /dev/null +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs @@ -0,0 +1,69 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Framework.Lists; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Timing; +using OpenTK; + +namespace osu.Game.Rulesets.UI.Scrolling.Visualisers +{ + public class ConstantSpeedChangeVisualiser : ISpeedChangeVisualiser + { + public void ComputeInitialStates(IEnumerable hitObjects, ScrollingDirection direction, double timeRange, Vector2 length) + { + foreach (var obj in hitObjects) + { + obj.LifetimeStart = obj.HitObject.StartTime - timeRange; + + if (obj.HitObject is IHasEndTime endTime) + { + var hitObjectLength = (endTime.EndTime - obj.HitObject.StartTime) / timeRange; + + switch (direction) + { + case ScrollingDirection.Up: + case ScrollingDirection.Down: + obj.Height = (float)(hitObjectLength * length.Y); + break; + case ScrollingDirection.Left: + case ScrollingDirection.Right: + obj.Width = (float)(hitObjectLength * length.X); + break; + } + } + + ComputeInitialStates(obj.NestedHitObjects, direction, timeRange, length); + + // Nested hitobjects don't need to scroll, but they do need accurate positions + UpdatePositions(obj.NestedHitObjects, direction, obj.HitObject.StartTime, timeRange, length); + } + } + + public void UpdatePositions(IEnumerable hitObjects, ScrollingDirection direction, double currentTime, double timeRange, Vector2 length) + { + foreach (var obj in hitObjects) + { + var position = (obj.HitObject.StartTime - currentTime) / timeRange; + + switch (direction) + { + case ScrollingDirection.Up: + obj.Y = (float)(position * length.Y); + break; + case ScrollingDirection.Down: + obj.Y = (float)(-position * length.Y); + break; + case ScrollingDirection.Left: + obj.X = (float)(position * length.X); + break; + case ScrollingDirection.Right: + obj.X = (float)(-position * length.X); + break; + } + } + } + } +} diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs index f12e274022..25dea8dfbf 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/SequentialSpeedChangeVisualiser.cs @@ -61,7 +61,7 @@ namespace osu.Game.Rulesets.UI.Scrolling.Visualisers foreach (var obj in hitObjects) { - var finalPosition = (hitObjectPositions[obj] - timelinePosition); + var finalPosition = hitObjectPositions[obj] - timelinePosition; switch (direction) { From 6d229716e763317dd58d3471f2a580fb8e35f674 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:42:55 +0200 Subject: [PATCH 080/132] Remove unused using directives --- .../UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs index 422617e836..9e910d6b11 100644 --- a/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs +++ b/osu.Game/Rulesets/UI/Scrolling/Visualisers/ConstantSpeedChangeVisualiser.cs @@ -2,10 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Lists; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Timing; using OpenTK; namespace osu.Game.Rulesets.UI.Scrolling.Visualisers From c8e9d9375f1742c33939684483939247fb1b8e63 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 17:05:26 +0900 Subject: [PATCH 081/132] Use new InputStateChangeEvent for RulesetInputManager --- osu.Game/Input/Handlers/ReplayInputHandler.cs | 27 ++++++++++++++- osu.Game/Rulesets/UI/RulesetInputManager.cs | 33 +++++++------------ 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index 5f53868b28..0a62c6ca72 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -3,10 +3,13 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Input.Handlers; using osu.Framework.Input.StateChanges; +using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Platform; +using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Input.Handlers @@ -40,7 +43,29 @@ namespace osu.Game.Input.Handlers public void Apply(InputState state, IInputStateChangeHandler handler) { - handler.HandleCustomInput(state, this); + if (!(state is RulesetInputManagerInputState inputState)) + throw new InvalidOperationException($"{nameof(ReplayState)} should only be applied to a {nameof(RulesetInputManagerInputState)}"); + + var lastPressed = inputState.LastReplayState?.PressedActions ?? new List(); + var released = lastPressed.Except(PressedActions).ToArray(); + var pressed = PressedActions.Except(lastPressed).ToArray(); + + inputState.LastReplayState = this; + + handler.HandleInputStateChange(new ReplayStateChangeEvent(state, this, released, pressed)); + } + } + + public class ReplayStateChangeEvent : InputStateChangeEvent + { + public readonly T[] ReleasedActions; + public readonly T[] PressedActions; + + public ReplayStateChangeEvent(InputState state, IInput input, T[] releasedActions, T[] pressedActions) + : base(state, input) + { + ReleasedActions = releasedActions; + PressedActions = pressedActions; } } } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index b05efce146..7167621291 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -10,7 +10,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.StateChanges; +using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Configuration; @@ -56,33 +58,20 @@ namespace osu.Game.Rulesets.UI #region Action mapping (for replays) - private List lastPressedActions = new List(); - - public override void HandleCustomInput(InputState state, IInput input) + public override void HandleInputStateChange(InputStateChangeEvent inputStateChange) { - if (!(input is ReplayState replayState)) + if (inputStateChange is ReplayStateChangeEvent replayStateChanged) { - base.HandleCustomInput(state, input); - return; - } + foreach (var action in replayStateChanged.ReleasedActions) + KeyBindingContainer.TriggerReleased(action); - if (state is RulesetInputManagerInputState inputState) + foreach (var action in replayStateChanged.PressedActions) + KeyBindingContainer.TriggerPressed(action); + } + else { - inputState.LastReplayState = replayState; + base.HandleInputStateChange(inputStateChange); } - - // Here we handle states specifically coming from a replay source. - // These have extra action information rather than keyboard keys or mouse buttons. - - List newActions = replayState.PressedActions; - - foreach (var released in lastPressedActions.Except(newActions)) - KeyBindingContainer.TriggerReleased(released); - - foreach (var pressed in newActions.Except(lastPressedActions)) - KeyBindingContainer.TriggerPressed(pressed); - - lastPressedActions = newActions; } #endregion From a3e6973b41268f88c44a7670bf1116f9a903d3b2 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 17:48:37 +0900 Subject: [PATCH 082/132] Replace usage of now removed TriggerKeyPress and similar methods. --- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 3 +- .../Visual/TestCaseGameplayMenuOverlay.cs | 73 +++++++++++-------- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 11 ++- osu.Game/Rulesets/UI/RulesetInputManager.cs | 3 - osu.Game/Screens/Play/KeyCounterCollection.cs | 22 +++--- 5 files changed, 63 insertions(+), 49 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index f3b7d60cf0..8d27502b3c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Input.States; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; @@ -77,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Mods wasLeft = !wasLeft; } - osuInputManager.HandleCustomInput(new InputState(), state); + state.Apply(osuInputManager.CurrentState, osuInputManager); } public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 45b5ec2c11..0f78315861 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -8,14 +8,14 @@ using System.Linq; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; using osu.Framework.Logging; using osu.Game.Screens.Play; +using OpenTK; namespace osu.Game.Tests.Visual { [Description("player pause/fail screens")] - public class TestCaseGameplayMenuOverlay : OsuTestCase + public class TestCaseGameplayMenuOverlay : ManualInputManagerTestCase { public override IReadOnlyList RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseContainer) }; @@ -73,12 +73,18 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Hover first button", () => failOverlay.Buttons.First().TriggerOnMouseMove(null)); + AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First())); AddStep("Hide overlay", () => failOverlay.Hide()); AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected)); } + private void press(Key key) + { + InputManager.PressKey(key); + InputManager.ReleaseKey(key); + } + /// /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// @@ -86,7 +92,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Press enter", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Enter })); + AddStep("Press enter", () => press(Key.Enter)); AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -99,7 +105,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Up arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -112,7 +118,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -125,11 +131,11 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); - AddStep("Up arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); AddStep("Hide overlay", () => failOverlay.Hide()); @@ -142,11 +148,11 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => failOverlay.Show()); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); - AddStep("Down arrow", () => failOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); AddStep("Hide overlay", () => failOverlay.Hide()); @@ -161,8 +167,8 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); + AddStep("Down arrow", () => press(Key.Down)); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected); AddAssert("Second button selected", () => secondButton.Selected); @@ -174,12 +180,16 @@ namespace osu.Game.Tests.Visual /// private void testKeySelectionAfterMouseSelection() { - AddStep("Show overlay", () => pauseOverlay.Show()); + AddStep("Show overlay", () => + { + pauseOverlay.Show(); + InputManager.MoveMouseTo(Vector2.Zero); + }); var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); - AddStep("Up arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Up })); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); + AddStep("Up arrow", () => press(Key.Up)); AddAssert("Second button not selected", () => !secondButton.Selected); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); @@ -195,9 +205,9 @@ namespace osu.Game.Tests.Visual var secondButton = pauseOverlay.Buttons.Skip(1).First(); - AddStep("Hover second button", () => secondButton.TriggerOnMouseMove(null)); - AddStep("Unhover second button", () => secondButton.TriggerOnHoverLost(null)); - AddStep("Down arrow", () => pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down })); + AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); + AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero)); + AddStep("Down arrow", () => press(Key.Down)); AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); // Initial state condition AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -235,23 +245,28 @@ namespace osu.Game.Tests.Visual AddStep("Select second button", () => { - pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down }); - pauseOverlay.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Down }); + press(Key.Down); + press(Key.Down); }); - var retryButton = pauseOverlay.Buttons.Skip(1).First(); - bool triggered = false; + Action lastAction = null; AddStep("Press enter", () => { - var lastAction = pauseOverlay.OnRetry; + lastAction = pauseOverlay.OnRetry; pauseOverlay.OnRetry = () => triggered = true; - - retryButton.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = Key.Enter }); - pauseOverlay.OnRetry = lastAction; + press(Key.Enter); }); - AddAssert("Action was triggered", () => triggered); + AddAssert("Action was triggered", () => + { + if (lastAction != null) + { + pauseOverlay.OnRetry = lastAction; + lastAction = null; + } + return triggered; + }); AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); } } diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index f31a687d2d..178b47ed33 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq; 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; @@ -15,7 +14,7 @@ using OpenTK.Input; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseKeyCounter : OsuTestCase + public class TestCaseKeyCounter : ManualInputManagerTestCase { public override IReadOnlyList RequiredTypes => new[] { @@ -53,16 +52,16 @@ namespace osu.Game.Tests.Visual AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + InputManager.PressKey(testKey); + InputManager.ReleaseKey(testKey); }); AddAssert($"Check {testKey} counter after keypress", () => rewindTestKeyCounterKeyboard.CountPresses == 1); AddStep($"Press {testKey} key", () => { - rewindTestKeyCounterKeyboard.TriggerOnKeyDown(null, new KeyDownEventArgs { Key = testKey, Repeat = false }); - rewindTestKeyCounterKeyboard.TriggerOnKeyUp(null, new KeyUpEventArgs { Key = testKey }); + InputManager.PressKey(testKey); + InputManager.ReleaseKey(testKey); time1 = Clock.CurrentTime; }); diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 7167621291..af1dc98fec 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -10,8 +9,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.EventArgs; -using osu.Framework.Input.Events; -using osu.Framework.Input.StateChanges; using osu.Framework.Input.StateChanges.Events; using osu.Framework.Input.States; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 2a737d974b..76c102c840 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -7,8 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Configuration; using OpenTK; @@ -152,13 +151,18 @@ namespace osu.Game.Screens.Play public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => Target.Children.Any(c => c.TriggerOnKeyDown(state, args)); - - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => Target.Children.Any(c => c.TriggerOnKeyUp(state, args)); - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => Target.Children.Any(c => c.TriggerOnMouseDown(state, args)); - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => Target.Children.Any(c => c.TriggerOnMouseUp(state, args)); + protected override bool Handle(UIEvent e) + { + switch (e) + { + case KeyDownEvent _: + case KeyUpEvent _: + case MouseDownEvent _: + case MouseUpEvent _: + return Target.Children.Any(c => c.TriggerEvent(e)); + } + return base.Handle(e); + } } } } From b790e1621738ee012c580b6e071af29f41d7a2a8 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 18 Sep 2018 18:05:25 +0900 Subject: [PATCH 083/132] Use Click instead of now removed TriggerOnClick --- osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 6 +++--- osu.Game/Overlays/MainSettings.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 8 ++++---- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 0f78315861..417b0f94d7 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -228,7 +228,7 @@ namespace osu.Game.Tests.Visual var lastAction = pauseOverlay.OnRetry; pauseOverlay.OnRetry = () => triggered = true; - retryButton.TriggerOnClick(); + retryButton.Click(); pauseOverlay.OnRetry = lastAction; }); diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 18391c1177..b3072a02d9 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, }; - Action = () => playButton.TriggerOnClick(); + Action = () => playButton.Click(); Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); } diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index c9c90b4555..3f79fa98e5 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -199,7 +199,7 @@ namespace osu.Game.Overlays.Dialog switch (action) { case GlobalAction.Select: - Buttons.OfType().FirstOrDefault()?.TriggerOnClick(); + Buttons.OfType().FirstOrDefault()?.Click(); return true; } @@ -252,7 +252,7 @@ namespace osu.Game.Overlays.Dialog if (!actionInvoked) // In the case a user did not choose an action before a hide was triggered, press the last button. // This is presumed to always be a sane default "cancel" action. - buttonsContainer.Last().TriggerOnClick(); + buttonsContainer.Last().Click(); base.PopOut(); content.FadeOut(EXIT_DURATION, Easing.InSine); @@ -261,7 +261,7 @@ namespace osu.Game.Overlays.Dialog private void pressButtonAtIndex(int index) { if (index < Buttons.Count()) - Buttons.Skip(index).First().TriggerOnClick(); + Buttons.Skip(index).First().Click(); } } } diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index 6e8b4494dc..b22904e724 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -155,7 +155,7 @@ namespace osu.Game.Overlays switch (action) { case GlobalAction.Back: - TriggerOnClick(); + Click(); return true; } diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index b9a799328e..dba0a3ac50 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -115,7 +115,7 @@ namespace osu.Game.Screens.Menu case GlobalAction.Back: return goBack(); case GlobalAction.Select: - logo?.TriggerOnClick(); + logo?.Click(); return true; default: return false; @@ -133,7 +133,7 @@ namespace osu.Game.Screens.Menu sampleBack?.Play(); return true; case ButtonSystemState.Play: - backButton.TriggerOnClick(); + backButton.Click(); return true; default: return false; @@ -150,10 +150,10 @@ namespace osu.Game.Screens.Menu State = ButtonSystemState.TopLevel; return true; case ButtonSystemState.TopLevel: - buttonsTopLevel.First().TriggerOnClick(); + buttonsTopLevel.First().Click(); return false; case ButtonSystemState.Play: - buttonsPlay.First().TriggerOnClick(); + buttonsPlay.First().Click(); return false; } } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 1ca3bc2189..f50b3e9661 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play /// /// Action that is invoked when is triggered. /// - protected virtual Action BackAction => () => InternalButtons.Children.Last().TriggerOnClick(); + protected virtual Action BackAction => () => InternalButtons.Children.Last().Click(); public abstract string Header { get; } public abstract string Description { get; } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index d9677e5daf..25e701294a 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play public override string Header => "paused"; public override string Description => "you're not going to do what i think you're going to do, are ya?"; - protected override Action BackAction => () => InternalButtons.Children.First().TriggerOnClick(); + protected override Action BackAction => () => InternalButtons.Children.First().Click(); [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 06837c9274..046a00d79b 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -141,7 +141,7 @@ namespace osu.Game.Screens.Play switch (action) { case GlobalAction.SkipCutscene: - button.TriggerOnClick(); + button.Click(); return true; } From 28f31540c48896830f5128ea914e64d97e08db0b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 14:07:46 +0900 Subject: [PATCH 084/132] Apply changes in-line with framework localisation changes --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 ++++---- osu.Game/Overlays/Direct/DirectListPanel.cs | 8 ++++---- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 13 ++++++------- osu.Game/Overlays/MusicController.cs | 11 +++-------- .../Profile/Sections/BeatmapMetadataContainer.cs | 10 ++++------ osu.Game/Screens/Multi/Components/BeatmapTitle.cs | 14 ++------------ osu.Game/Screens/Play/PlayerLoader.cs | 6 +++--- osu.Game/Screens/Ranking/ResultsPageScore.cs | 8 ++++---- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 10 +++++----- .../Select/Carousel/DrawableCarouselBeatmapSet.cs | 9 +++------ 11 files changed, 39 insertions(+), 60 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb940bff60..fbbfbe5d01 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -7,11 +7,11 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.States; +using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { Content.CornerRadius = 4; @@ -74,13 +74,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), + Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), + Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), Font = @"Exo2.0-BoldItalic", }, }, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 850ead37f6..6cb5ebad4e 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -10,8 +10,8 @@ using osu.Framework.Graphics.Colour; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; -using osu.Framework.Localisation; using osu.Framework.Graphics.Shapes; +using osu.Framework.Localisation; using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation, OsuColour colours) + private void load(OsuColour colours) { Content.CornerRadius = 5; @@ -94,13 +94,13 @@ namespace osu.Game.Overlays.Direct { new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title), + Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), TextSize = 18, Font = @"Exo2.0-BoldItalic", }, new OsuSpriteText { - Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist), + Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), Font = @"Exo2.0-BoldItalic", }, } diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 86baaf3905..d480bedc5e 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.KeyBinding private FillFlowContainer buttons; - public IEnumerable FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend(text.Text); + public IEnumerable FilterTerms => bindings.Select(b => b.KeyCombination.ReadableString()).Prepend((string)text.Text); public KeyBindingRow(object action, IEnumerable bindings) { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 62c9020160..ee3f22290b 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -28,8 +28,8 @@ namespace osu.Game.Overlays.Music private SpriteIcon handle; private TextFlowContainer text; private IEnumerable titleSprites; - private UnicodeBindableString titleBind; - private UnicodeBindableString artistBind; + private ILocalisedBindableString titleBind; + private ILocalisedBindableString artistBind; public readonly BeatmapSetInfo BeatmapSetInfo; @@ -74,7 +74,7 @@ namespace osu.Game.Overlays.Music } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours, LocalisationManager localisation) { hoverColour = colours.Yellow; artistColour = colours.Gray9; @@ -97,11 +97,10 @@ namespace osu.Game.Overlays.Music }, }; - titleBind = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + titleBind = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); + artistBind = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); - artistBind.ValueChanged += newText => recreateText(); - artistBind.TriggerChange(); + artistBind.BindValueChanged(newText => recreateText(), true); } private void recreateText() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 886b5fb95b..5cccb2b0aa 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -47,7 +47,6 @@ namespace osu.Game.Overlays private PlaylistOverlay playlist; private BeatmapManager beatmaps; - private LocalisationEngine localisation; private List beatmapSets; private BeatmapSetInfo currentSet; @@ -67,11 +66,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation) + private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours) { this.beatmap.BindTo(beatmap); this.beatmaps = beatmaps; - this.localisation = localisation; Children = new Drawable[] { @@ -351,17 +349,14 @@ namespace osu.Game.Overlays { if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists { - title.Current = null; title.Text = @"Nothing to play"; - - artist.Current = null; artist.Text = @"Nothing to play"; } else { BeatmapMetadata metadata = beatmap.Metadata; - title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)); + artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)); } }); diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 1a1f13933d..4278598bf5 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Sections public string TooltipText { get; } [BackgroundDependencyLoader(true)] - private void load(LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay) + private void load(BeatmapSetOverlay beatmapSetOverlay) { Action = () => { @@ -46,16 +46,14 @@ namespace osu.Game.Overlays.Profile.Sections { new OsuSpriteText { - Current = locale.GetUnicodePreference( - $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", - $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] " - ), + Text = new LocalisedString(($"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", + $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), TextSize = 15, Font = "Exo2.0-SemiBoldItalic", }, new OsuSpriteText { - Current = locale.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist), + Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)), TextSize = 12, Padding = new MarginPadding { Top = 3 }, Font = "Exo2.0-RegularItalic", diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index 42863754c5..6dc59f5cac 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; @@ -14,8 +13,6 @@ namespace osu.Game.Screens.Multi.Components { private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist; - private LocalisationEngine localisation; - public float TextSize { set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; } @@ -48,12 +45,6 @@ namespace osu.Game.Screens.Multi.Components }; } - [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) - { - this.localisation = localisation; - } - protected override void LoadComplete() { base.LoadComplete(); @@ -64,15 +55,14 @@ namespace osu.Game.Screens.Multi.Components { if (beatmap == null) { - beatmapTitle.Current = beatmapArtist.Current = null; beatmapTitle.Text = "Changing map"; beatmapDash.Text = beatmapArtist.Text = string.Empty; } else { - beatmapTitle.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); + beatmapTitle.Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)); beatmapDash.Text = @" - "; - beatmapArtist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + beatmapArtist.Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)); } } } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index fd4322c268..05a43b32f0 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -290,7 +290,7 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) + private void load() { var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata(); @@ -307,7 +307,7 @@ namespace osu.Game.Screens.Play { new OsuSpriteText { - Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title), + Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)), TextSize = 36, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, @@ -315,7 +315,7 @@ namespace osu.Game.Screens.Play }, new OsuSpriteText { - Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist), + Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)), TextSize = 26, Font = @"Exo2.0-MediumItalic", Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Ranking/ResultsPageScore.cs b/osu.Game/Screens/Ranking/ResultsPageScore.cs index 040458e0eb..58c9cde9c7 100644 --- a/osu.Game/Screens/Ranking/ResultsPageScore.cs +++ b/osu.Game/Screens/Ranking/ResultsPageScore.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -24,6 +23,7 @@ using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions; +using osu.Framework.Localisation; namespace osu.Game.Screens.Ranking { @@ -328,7 +328,7 @@ namespace osu.Game.Screens.Ranking } [BackgroundDependencyLoader] - private void load(OsuColour colours, LocalisationEngine localisation) + private void load(OsuColour colours) { title.Colour = artist.Colour = colours.BlueDarker; versionMapper.Colour = colours.Gray8; @@ -341,8 +341,8 @@ namespace osu.Game.Screens.Ranking versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text; } - title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title); - artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist); + title.Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)); + artist.Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)); } } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ae5134c0da..c172cbc506 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -131,8 +131,8 @@ namespace osu.Game.Screens.Select public FillFlowContainer MapperContainer { get; private set; } public FillFlowContainer InfoLabelContainer { get; private set; } - private UnicodeBindableString titleBinding; - private UnicodeBindableString artistBinding; + private ILocalisedBindableString titleBinding; + private ILocalisedBindableString artistBinding; private readonly WorkingBeatmap beatmap; private readonly RulesetInfo ruleset; @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation) + private void load(LocalisationManager localisation) { var beatmapInfo = beatmap.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); @@ -153,8 +153,8 @@ namespace osu.Game.Screens.Select CacheDrawnFrameBuffer = true; RelativeSizeAxes = Axes.Both; - titleBinding = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); - artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); + titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); + artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 52d34a935f..2f943300fe 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -38,11 +38,8 @@ namespace osu.Game.Screens.Select.Carousel } [BackgroundDependencyLoader(true)] - private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) + private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) { - if (localisation == null) - throw new ArgumentNullException(nameof(localisation)); - restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); dialogOverlay = overlay; if (beatmapOverlay != null) @@ -67,14 +64,14 @@ namespace osu.Game.Screens.Select.Carousel new OsuSpriteText { Font = @"Exo2.0-BoldItalic", - Current = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title), + Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)), TextSize = 22, Shadow = true, }, new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", - Current = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist), + Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)), TextSize = 17, Shadow = true, }, From 38a3c2a82076dbe2ecb0b05b4bb24033ee3e5e29 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 14:57:32 +0900 Subject: [PATCH 085/132] Fix song select wedge sometimes not updating when localisation changes --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index ae5134c0da..44622fa845 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -261,6 +261,8 @@ namespace osu.Game.Screens.Select } } }; + + titleBinding.BindValueChanged(value => setMetadata(metadata.Source)); artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); // no difficulty means it can't have a status to show From 73fb3fa3a4070bc407361d2fedd1503e762b9b4b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 19 Sep 2018 17:52:35 +0900 Subject: [PATCH 086/132] Fix macOS crashing in fullscreen mode --- .../Sections/Graphics/LayoutSettings.cs | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 4a8164c6df..013204561b 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -35,6 +35,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics letterboxing = config.GetBindable(FrameworkSetting.Letterboxing); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); + Container resolutionSettingsContainer; + Children = new Drawable[] { windowModeDropdown = new SettingsEnumDropdown @@ -42,13 +44,12 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), }, - resolutionDropdown = new SettingsDropdown + resolutionSettingsContainer = new Container { - LabelText = "Resolution", - ShowsDefaultIndicator = false, - Items = getResolutions(), - Bindable = sizeFullscreen + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y }, + new SettingsCheckbox { LabelText = "Letterboxing", @@ -81,16 +82,28 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, }; - windowModeDropdown.Bindable.BindValueChanged(windowMode => + var resolutions = getResolutions(); + if (resolutions.Count > 1) { - if (windowMode == WindowMode.Fullscreen) + resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown { - resolutionDropdown.Show(); - sizeFullscreen.TriggerChange(); - } - else - resolutionDropdown.Hide(); - }, true); + LabelText = "Resolution", + ShowsDefaultIndicator = false, + Items = getResolutions(), + Bindable = sizeFullscreen + }; + + windowModeDropdown.Bindable.BindValueChanged(windowMode => + { + if (windowMode == WindowMode.Fullscreen) + { + resolutionDropdown.Show(); + sizeFullscreen.TriggerChange(); + } + else + resolutionDropdown.Hide(); + }); + } letterboxing.BindValueChanged(isVisible => { @@ -102,7 +115,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - private IEnumerable> getResolutions() + private IReadOnlyList> getResolutions() { var resolutions = new KeyValuePair("Default", new Size(9999, 9999)).Yield(); @@ -112,8 +125,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics .OrderByDescending(r => r.Width) .ThenByDescending(r => r.Height) .Select(res => new KeyValuePair($"{res.Width}x{res.Height}", new Size(res.Width, res.Height))) - .Distinct()).ToList(); - return resolutions; + .Distinct()); + return resolutions.ToList(); } } } From e7d78b94ae1d9700bd80a9844516c3db5c73a6dc Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Wed, 19 Sep 2018 18:30:25 +0200 Subject: [PATCH 087/132] Remove ScrollingVisualisation from settings --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 3 ++ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 29 ++++++++++--------- osu.Game/Configuration/OsuConfigManager.cs | 3 -- .../Sections/Gameplay/ScrollingSettings.cs | 26 ----------------- .../Settings/Sections/GameplaySection.cs | 3 +- .../Scrolling/ScrollingHitObjectContainer.cs | 12 +++----- .../UI/Scrolling/ScrollingPlayfield.cs | 5 +++- 7 files changed, 28 insertions(+), 53 deletions(-) delete mode 100644 osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 85e14eaad0..dd5cb3c15a 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Judgements; @@ -24,6 +25,8 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool UserScrollSpeedAdjustment => false; + protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Constant; + public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 325beb38a5..f5b3049302 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -1,23 +1,24 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets.Taiko.Objects; -using OpenTK; -using OpenTK.Graphics; -using osu.Game.Rulesets.Taiko.Judgements; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Extensions.Color4Extensions; using System.Linq; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Rulesets.Taiko.Objects; +using osu.Game.Rulesets.Taiko.Objects.Drawables; +using osu.Game.Rulesets.Taiko.Judgements; +using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Rulesets.Taiko.UI { @@ -40,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.UI protected override bool UserScrollSpeedAdjustment => false; + protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Overlapping; + private readonly Container hitExplosionContainer; private readonly Container kiaiExplosionContainer; private readonly JudgementContainer judgementContainer; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index f7fe424aa9..9ac2cabe9f 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -83,8 +83,6 @@ namespace osu.Game.Configuration Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); - Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential); - Set(OsuSetting.IncreaseFirstObjectVisibility, true); // Update @@ -143,7 +141,6 @@ namespace osu.Game.Configuration ChatDisplayHeight, Version, ShowConvertedBeatmaps, - SpeedChangeVisualisation, Skin, ScreenshotFormat, ScreenshotCaptureMenuCursor, diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs deleted file mode 100644 index 0e661aeba6..0000000000 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ScrollingSettings.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Game.Configuration; - -namespace osu.Game.Overlays.Settings.Sections.Gameplay -{ - public class ScrollingSettings : SettingsSubsection - { - protected override string Header => "Scrolling"; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new[] - { - new SettingsEnumDropdown - { - LabelText = "Visualise speed changes as", - Bindable = config.GetBindable(OsuSetting.SpeedChangeVisualisation), - } - }; - } - } -} diff --git a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs index 8add0b01ec..f565ff8556 100644 --- a/osu.Game/Overlays/Settings/Sections/GameplaySection.cs +++ b/osu.Game/Overlays/Settings/Sections/GameplaySection.cs @@ -21,7 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections { new GeneralSettings(), new SongSelectSettings(), - new ScrollingSettings(), new ModsSettings(), }; } @@ -29,7 +28,7 @@ namespace osu.Game.Overlays.Settings.Sections [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - foreach(Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance())) + foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance())) { SettingsSubsection section = ruleset.CreateSettings(); if (section != null) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 3ce1ab9960..9762739ab0 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -33,20 +33,14 @@ namespace osu.Game.Rulesets.UI.Scrolling private Cached initialStateCache = new Cached(); - public ScrollingHitObjectContainer() + public ScrollingHitObjectContainer(SpeedChangeVisualisationMethod visualisationMethod) { RelativeSizeAxes = Axes.Both; TimeRange.ValueChanged += _ => initialStateCache.Invalidate(); Direction.ValueChanged += _ => initialStateCache.Invalidate(); - } - private ISpeedChangeVisualiser speedChangeVisualiser; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - switch (config.Get(OsuSetting.SpeedChangeVisualisation)) + switch (visualisationMethod) { case SpeedChangeVisualisationMethod.Sequential: speedChangeVisualiser = new SequentialSpeedChangeVisualiser(ControlPoints); @@ -60,6 +54,8 @@ namespace osu.Game.Rulesets.UI.Scrolling } } + private ISpeedChangeVisualiser speedChangeVisualiser; + public override void Add(DrawableHitObject hitObject) { initialStateCache.Invalidate(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index ec73c0fb14..e446c90f75 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; +using osu.Game.Configuration; using osu.Game.Input.Bindings; using osu.Game.Rulesets.Objects.Drawables; @@ -62,6 +63,8 @@ namespace osu.Game.Rulesets.UI.Scrolling /// protected readonly Bindable Direction = new Bindable(); + protected virtual SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Sequential; + /// /// Creates a new . /// @@ -104,7 +107,7 @@ namespace osu.Game.Rulesets.UI.Scrolling protected sealed override HitObjectContainer CreateHitObjectContainer() { - var container = new ScrollingHitObjectContainer(); + var container = new ScrollingHitObjectContainer(visualisationMethod); container.Direction.BindTo(Direction); return container; } From 309d8c8cb4c55fafd76e046bd21d38d07be9ab8b Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Wed, 19 Sep 2018 18:43:39 +0200 Subject: [PATCH 088/132] CI --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 3 +-- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index dd5cb3c15a..a65079c590 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI protected override bool UserScrollSpeedAdjustment => false; - protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Constant; + protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Constant; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) : base(BASE_WIDTH) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index f5b3049302..1219ccc0e8 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.UI protected override bool UserScrollSpeedAdjustment => false; - protected override SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Overlapping; + protected override SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Overlapping; private readonly Container hitExplosionContainer; private readonly Container kiaiExplosionContainer; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 9762739ab0..33c34d7202 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -54,7 +53,7 @@ namespace osu.Game.Rulesets.UI.Scrolling } } - private ISpeedChangeVisualiser speedChangeVisualiser; + private readonly ISpeedChangeVisualiser speedChangeVisualiser; public override void Add(DrawableHitObject hitObject) { diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index e446c90f75..b85531909c 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.UI.Scrolling /// protected readonly Bindable Direction = new Bindable(); - protected virtual SpeedChangeVisualisationMethod visualisationMethod => SpeedChangeVisualisationMethod.Sequential; + protected virtual SpeedChangeVisualisationMethod VisualisationMethod => SpeedChangeVisualisationMethod.Sequential; /// /// Creates a new . @@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.UI.Scrolling protected sealed override HitObjectContainer CreateHitObjectContainer() { - var container = new ScrollingHitObjectContainer(visualisationMethod); + var container = new ScrollingHitObjectContainer(VisualisationMethod); container.Direction.BindTo(Direction); return container; } From 7b8094d73129595bbb891d7b0e59e6f46eb8a72d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:35:07 +0900 Subject: [PATCH 089/132] Move text size/padding out of constructor --- .../Drawables/BeatmapSetOnlineStatusPill.cs | 20 +++++++++++++++---- osu.Game/Overlays/BeatmapSet/Header.cs | 4 +++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 4 +++- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +++- .../Carousel/DrawableCarouselBeatmapSet.cs | 4 +++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 511ce9aa58..ab28ad0a2c 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -15,19 +15,33 @@ namespace osu.Game.Beatmaps.Drawables private readonly OsuSpriteText statusText; private BeatmapSetOnlineStatus status; + public BeatmapSetOnlineStatus Status { get => status; set { - if (value == status) return; + if (status == value) + return; status = value; statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } - public BeatmapSetOnlineStatusPill(float textSize, MarginPadding textPadding) + public float TextSize + { + get => statusText.TextSize; + set => statusText.TextSize = value; + } + + public MarginPadding TextPadding + { + get => statusText.Padding; + set => statusText.Padding = value; + } + + public BeatmapSetOnlineStatusPill() { AutoSizeAxes = Axes.Both; Masking = true; @@ -45,8 +59,6 @@ namespace osu.Game.Beatmaps.Drawables Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = @"Exo2.0-Bold", - TextSize = textSize, - Padding = textPadding, }, }; diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index afba99f928..6f01fae92d 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -230,10 +230,12 @@ namespace osu.Game.Overlays.BeatmapSet Spacing = new Vector2(10), Children = new Drawable[] { - onlineStatusPill = new BeatmapSetOnlineStatusPill(14, new MarginPadding { Horizontal = 25, Vertical = 8 }) + onlineStatusPill = new BeatmapSetOnlineStatusPill { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, + TextSize = 14, + TextPadding = new MarginPadding { Horizontal = 25, Vertical = 8 } }, Details = new Details(), }, diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index eb940bff60..d8830cd092 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -217,8 +217,10 @@ namespace osu.Game.Overlays.Direct statusContainer.Add(new IconPill(FontAwesome.fa_image)); } - statusContainer.Add(new BeatmapSetOnlineStatusPill(12, new MarginPadding { Horizontal = 10, Vertical = 5 }) + statusContainer.Add(new BeatmapSetOnlineStatusPill { + TextSize = 12, + TextPadding = new MarginPadding { Horizontal = 10, Vertical = 5 }, Status = SetInfo.OnlineInfo?.Status ?? BeatmapSetOnlineStatus.None, }); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 44622fa845..02081cb17c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -217,8 +217,10 @@ namespace osu.Game.Screens.Select AutoSizeAxes = Axes.Both, Children = new Drawable[] { - StatusPill = new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + StatusPill = new BeatmapSetOnlineStatusPill { + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapInfo.Status, } } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 52d34a935f..658ece740e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -85,11 +85,13 @@ namespace osu.Game.Screens.Select.Carousel Margin = new MarginPadding { Top = 5 }, Children = new Drawable[] { - new BeatmapSetOnlineStatusPill(11, new MarginPadding { Horizontal = 8, Vertical = 2 }) + new BeatmapSetOnlineStatusPill { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Margin = new MarginPadding{ Right = 5 }, + TextSize = 11, + TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status }, new FillFlowContainer From 04cd68f97029ccac9ede8b8a5c0d3dd99b5e62de Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:53:21 +0900 Subject: [PATCH 090/132] Hide status pill when status is none --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index ab28ad0a2c..da281b4db3 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -1,7 +1,6 @@ // 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.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -25,7 +24,8 @@ namespace osu.Game.Beatmaps.Drawables return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); + Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1; + statusText.Text = value.ToString().ToUpperInvariant(); } } From 62135c39aa435ea140e9e15a12548431d9069d9b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 20 Sep 2018 12:56:39 +0900 Subject: [PATCH 091/132] Cleanup --- osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 658ece740e..d7f3a4cd54 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Select.Carousel { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Margin = new MarginPadding{ Right = 5 }, + Margin = new MarginPadding { Right = 5 }, TextSize = 11, TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 }, Status = beatmapSet.Status From 4b907336c5379ecbdcbc8cc2909da3f263629b5b Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 20 Sep 2018 13:17:17 +0900 Subject: [PATCH 092/132] Move readonly field above ctor --- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index 33c34d7202..7307fc0ead 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -32,6 +32,8 @@ namespace osu.Game.Rulesets.UI.Scrolling private Cached initialStateCache = new Cached(); + private readonly ISpeedChangeVisualiser speedChangeVisualiser; + public ScrollingHitObjectContainer(SpeedChangeVisualisationMethod visualisationMethod) { RelativeSizeAxes = Axes.Both; @@ -53,8 +55,6 @@ namespace osu.Game.Rulesets.UI.Scrolling } } - private readonly ISpeedChangeVisualiser speedChangeVisualiser; - public override void Add(DrawableHitObject hitObject) { initialStateCache.Invalidate(); From 5ee41303512cc3628ea08d71afa0f30f449996c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Sep 2018 00:30:29 +0900 Subject: [PATCH 093/132] Update framework reference --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 05291cf3d0..5ce04b813b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 1861547c86b44ab8faedc892bd10f175e25e4d59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 Sep 2018 19:00:41 +0900 Subject: [PATCH 094/132] Apply review --- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 013204561b..df9370d0d8 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -49,7 +49,6 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, - new SettingsCheckbox { LabelText = "Letterboxing", @@ -83,13 +82,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }; var resolutions = getResolutions(); + if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new SettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, - Items = getResolutions(), + Items = resolutions, Bindable = sizeFullscreen }; From fa33e0bd6bc5c8abb6e88938c206bad2691ba0c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 02:36:39 +0900 Subject: [PATCH 095/132] Fix background brightness being adjusted globally --- osu.Game/Graphics/Backgrounds/Background.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index 6fc8b0e070..d3d530a540 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using OpenTK.Graphics; namespace osu.Game.Graphics.Backgrounds { @@ -28,7 +27,6 @@ namespace osu.Game.Graphics.Backgrounds RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, - Colour = Color4.DarkGray, FillMode = FillMode.Fill, }); } From 07a1c39fe525dc11f06917fc3d7f3510c21e4d27 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 02:55:24 +0900 Subject: [PATCH 096/132] Use random default background on starting the game --- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 38df9b13ef..f52633a34a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -1,8 +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 osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Threading; using osu.Game.Graphics.Backgrounds; @@ -20,6 +21,7 @@ namespace osu.Game.Screens.Backgrounds [BackgroundDependencyLoader] private void load() { + currentDisplay = RNG.Next(0, background_count); display(new Background(backgroundName)); } From 78d78b5510370108a61b0b16c2f8679a67cd987c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 03:13:15 +0900 Subject: [PATCH 097/132] Fade menu background a bit when menu is active --- osu.Game/Screens/Menu/MainMenu.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 7e97859be6..2dd6e1d7e1 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -10,6 +10,7 @@ using osu.Framework.Input.EventArgs; using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Charts; @@ -64,6 +65,20 @@ namespace osu.Game.Screens.Menu }, sideFlashes = new MenuSideFlashes(), }; + + buttons.StateChanged += state => + { + switch (state) + { + case ButtonSystemState.Initial: + case ButtonSystemState.Exit: + background.FadeColour(Color4.White, 500, Easing.OutSine); + break; + default: + background.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine); + break; + } + }; } [BackgroundDependencyLoader(true)] From 83bf38f4bc03c48e3425eb93a4d433362530038f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 03:13:34 +0900 Subject: [PATCH 098/132] Make menu background blurrable Not actually blurring yet, needs further testing. --- .../Backgrounds/BackgroundScreenBeatmap.cs | 25 ++++++------------- .../Backgrounds/BackgroundScreenDefault.cs | 12 ++++----- osu.Game/Screens/BlurrableBackgroundScreen.cs | 20 +++++++++++++++ 3 files changed, 33 insertions(+), 24 deletions(-) create mode 100644 osu.Game/Screens/BlurrableBackgroundScreen.cs diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 78561cecbf..62f24e8e5c 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -4,20 +4,14 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; -using osu.Framework.Graphics.Transforms; -using OpenTK; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenBeatmap : BackgroundScreen + public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { - private Background background; - private WorkingBeatmap beatmap; - private Vector2 blurTarget; - public WorkingBeatmap Beatmap { get { return beatmap; } @@ -33,17 +27,17 @@ namespace osu.Game.Screens.Backgrounds LoadComponentAsync(new BeatmapBackground(beatmap), b => { float newDepth = 0; - if (background != null) + if (Background != null) { - newDepth = background.Depth + 1; - background.FinishTransforms(); - background.FadeOut(250); - background.Expire(); + newDepth = Background.Depth + 1; + Background.FinishTransforms(); + Background.FadeOut(250); + Background.Expire(); } b.Depth = newDepth; - Add(background = b); - background.BlurSigma = blurTarget; + Add(Background = b); + Background.BlurSigma = BlurTarget; }); }); } @@ -54,9 +48,6 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; } - public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) - => background?.BlurTo(blurTarget = sigma, duration, easing); - public override bool Equals(BackgroundScreen other) { var otherBeatmapBackground = other as BackgroundScreenBeatmap; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index f52633a34a..989883c8b3 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.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 osu.Framework.Allocation; @@ -9,15 +9,13 @@ using osu.Game.Graphics.Backgrounds; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenDefault : BackgroundScreen + public class BackgroundScreenDefault : BlurrableBackgroundScreen { private int currentDisplay; private const int background_count = 5; private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}"; - private Background current; - [BackgroundDependencyLoader] private void load() { @@ -27,10 +25,10 @@ namespace osu.Game.Screens.Backgrounds private void display(Background newBackground) { - current?.FadeOut(800, Easing.InOutSine); - current?.Expire(); + Background?.FadeOut(800, Easing.InOutSine); + Background?.Expire(); - Add(current = newBackground); + Add(Background = newBackground); currentDisplay++; } diff --git a/osu.Game/Screens/BlurrableBackgroundScreen.cs b/osu.Game/Screens/BlurrableBackgroundScreen.cs new file mode 100644 index 0000000000..92d32badc4 --- /dev/null +++ b/osu.Game/Screens/BlurrableBackgroundScreen.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; +using osu.Game.Graphics.Backgrounds; +using OpenTK; + +namespace osu.Game.Screens +{ + public abstract class BlurrableBackgroundScreen : BackgroundScreen + { + protected Background Background; + + protected Vector2 BlurTarget; + + public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) + => Background?.BlurTo(BlurTarget = sigma, duration, easing); + } +} From 52877eca8342939b4b7fe163d0ce8f28da431b91 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 20:01:04 -0400 Subject: [PATCH 099/132] Update ArchiveModelManager.cs --- osu.Game/Database/ArchiveModelManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index f4f169f27c..7356ae2cc4 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -286,9 +286,10 @@ namespace osu.Game.Database using (ContextFactory.GetForWrite()) { // re-fetch the model on the import context. - var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID); + var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); - if (foundModel.DeletePending) return; + // Test for null since FirstOrDefault will return null if nothing is found + if (foundModel == null || foundModel.DeletePending) return; if (ModelStore.Delete(foundModel)) Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray()); From 49fbe8443a4a2003d9c97eda3eed8f996fc3a158 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:00:20 -0400 Subject: [PATCH 100/132] Test if there are beatmaps when click on delete btn --- osu.Game/Screens/Select/SongSelect.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index efdf55e477..438d4c51b7 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -537,6 +537,8 @@ namespace osu.Game.Screens.Select private void delete(BeatmapSetInfo beatmap) { if (beatmap == null) return; + // Null check because no beatmaps actually causes beatmap.Beatmaps to be null + if (!(beatmap.Beatmaps?.Any() ?? false)) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 1644719893118bf97314b31235192796030c8f17 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:29:37 -0400 Subject: [PATCH 101/132] Update SongSelect.cs --- 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 438d4c51b7..bfac51789e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -538,7 +538,7 @@ namespace osu.Game.Screens.Select { if (beatmap == null) return; // Null check because no beatmaps actually causes beatmap.Beatmaps to be null - if (!(beatmap.Beatmaps?.Any() ?? false)) return; + if (beatmap == null || beatmap.ID <= 0) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 654345f38041b8c1f451f1d9dafba61a0b8a32fd Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 22:32:24 -0400 Subject: [PATCH 102/132] Remove duplicate condition test --- osu.Game/Screens/Select/SongSelect.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index bfac51789e..b4dcbcce41 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -536,8 +536,6 @@ namespace osu.Game.Screens.Select private void delete(BeatmapSetInfo beatmap) { - if (beatmap == null) return; - // Null check because no beatmaps actually causes beatmap.Beatmaps to be null if (beatmap == null || beatmap.ID <= 0) return; dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } From 293a5dd09906ed2ef73df76166e8231fc8b0dec0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 11:50:36 +0900 Subject: [PATCH 103/132] Use string interpolation --- osu.Game/Database/ArchiveModelManager.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 06a8b490ef..2a31df462e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -96,7 +96,8 @@ namespace osu.Game.Database private void handleEvent(Action a) { if (delayingEvents) - lock (queuedEvents) queuedEvents.Add(a); + lock (queuedEvents) + queuedEvents.Add(a); else a.Invoke(); } @@ -441,7 +442,7 @@ namespace osu.Game.Database if (!stable.ExistsDirectory(ImportFromStablePath)) { // This handles situations like when the user does not have a Skins folder - Logger.Log("No " + ImportFromStablePath + " folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); + Logger.Log($"No {ImportFromStablePath} folder available in osu!stable installation", LoggingTarget.Information, LogLevel.Error); return Task.CompletedTask; } From eaf7697b85bbcd1bff590daf7a9cf1d83e333ef8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 23:21:27 -0400 Subject: [PATCH 104/132] Add boolean return value --- osu.Game/Database/ArchiveModelManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 7356ae2cc4..d57b94b80a 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -281,7 +281,8 @@ namespace osu.Game.Database /// Is a no-op for already deleted items. /// /// The item to delete. - public void Delete(TModel item) + /// false if no operation was performed + public bool Delete(TModel item) { using (ContextFactory.GetForWrite()) { @@ -289,10 +290,11 @@ namespace osu.Game.Database var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); // Test for null since FirstOrDefault will return null if nothing is found - if (foundModel == null || foundModel.DeletePending) return; + if (foundModel == null || foundModel.DeletePending) return false; if (ModelStore.Delete(foundModel)) Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray()); + return true; } } From 4380ef15bf32810090c693e95078a18e29eb7efd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 21 Sep 2018 16:31:09 +0900 Subject: [PATCH 105/132] Fix potential exception during async load callback --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 62f24e8e5c..e326cdb0ca 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -12,6 +12,7 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { get { return beatmap; } @@ -24,7 +25,7 @@ namespace osu.Game.Screens.Backgrounds Schedule(() => { - LoadComponentAsync(new BeatmapBackground(beatmap), b => + LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => { float newDepth = 0; if (Background != null) @@ -38,7 +39,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; Add(Background = b); Background.BlurSigma = BlurTarget; - }); + })); }); } } From dafbabec31de7bc6e91b83f53b6edf41e30219df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 21:08:21 +0900 Subject: [PATCH 106/132] Fix import buttons having incorrect mappings when setting disabled states --- .../Sections/Maintenance/GeneralSettings.cs | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 57e9a528d2..835ec808bc 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -13,57 +13,59 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance { public class GeneralSettings : SettingsSubsection { - private TriangleButton importButton; - private TriangleButton deleteButton; + protected override string Header => "General"; + + private TriangleButton importBeatmapsButton; + private TriangleButton importSkinsButton; + private TriangleButton deleteSkinsButton; + private TriangleButton deleteBeatmapsButton; private TriangleButton restoreButton; private TriangleButton undeleteButton; - protected override string Header => "General"; - [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay) { Children = new Drawable[] { - importButton = new SettingsButton + importBeatmapsButton = new SettingsButton { Text = "Import beatmaps from stable", Action = () => { - importButton.Enabled.Value = false; - beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + importBeatmapsButton.Enabled.Value = false; + beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } }, - deleteButton = new DangerousSettingsButton + deleteBeatmapsButton = new DangerousSettingsButton { Text = "Delete ALL beatmaps", Action = () => { dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => { - deleteButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + deleteBeatmapsButton.Enabled.Value = false; + Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); })); } }, - importButton = new SettingsButton + importSkinsButton = new SettingsButton { Text = "Import skins from stable", Action = () => { - importButton.Enabled.Value = false; - skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importButton.Enabled.Value = true)); + importSkinsButton.Enabled.Value = false; + skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); } }, - deleteButton = new DangerousSettingsButton + deleteSkinsButton = new DangerousSettingsButton { Text = "Delete ALL skins", Action = () => { dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => { - deleteButton.Enabled.Value = false; - Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteButton.Enabled.Value = true)); + deleteSkinsButton.Enabled.Value = false; + Task.Run(() => skins.Delete(skins.GetAllUserSkins())).ContinueWith(t => Schedule(() => deleteSkinsButton.Enabled.Value = true)); })); } }, From 6efecc4b356f612436349ccfd852af5121385123 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 23 Sep 2018 05:23:49 +0900 Subject: [PATCH 107/132] Fix files with upper-case extensions failing to import correctly --- osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index 6783b9712c..e127faa70d 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -37,7 +37,7 @@ namespace osu.Game.IPC return; } - if (importer.HandledExtensions.Contains(Path.GetExtension(path))) + if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLower())) importer.Import(path); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9a5dac35b9..36ca043df6 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -243,7 +243,7 @@ namespace osu.Game public void Import(params string[] paths) { - var extension = Path.GetExtension(paths.First()); + var extension = Path.GetExtension(paths.First())?.ToLower(); foreach (var importer in fileImporters) if (importer.HandledExtensions.Contains(extension)) importer.Import(paths); From 7a4367784928e123a2a5a080837c656c5d61693a Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Sat, 22 Sep 2018 22:54:38 -0400 Subject: [PATCH 108/132] Make judgements scale with cs --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 10 ++++++++-- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 2 +- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 10 ++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 61937a535c..f2c18d4c9c 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -19,12 +19,15 @@ namespace osu.Game.Rulesets.Osu.UI private readonly Container approachCircles; private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; + private readonly OsuRulesetContainer rulesetContainer; public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - public OsuPlayfield() + public OsuPlayfield(OsuRulesetContainer rulesetContainer) : base(BASE_SIZE.X) { + this.rulesetContainer = rulesetContainer; + Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -69,10 +72,13 @@ namespace osu.Game.Rulesets.Osu.UI if (!judgedObject.DisplayResult || !DisplayJudgements) return; + var explosionBaseSize = rulesetContainer.Beatmap.BeatmapInfo.BaseDifficulty.CircleSize; + DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) { Origin = Anchor.Centre, - Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition + Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition, + Scale = new Vector2((1.0f - 0.7f * (explosionBaseSize - 5) / 5) / 2 * 1.65f) }; judgementLayer.Add(explosion); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 4bc6992445..6cea8a0030 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.UI public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this); - protected override Playfield CreatePlayfield() => new OsuPlayfield(); + protected override Playfield CreatePlayfield() => new OsuPlayfield(this); public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 65b2ef75c4..c2a52e5794 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -65,13 +65,15 @@ namespace osu.Game.Rulesets.Judgements this.FadeInFromZero(100, Easing.OutQuint); + var origScale = Scale; + switch (Result.Type) { case HitResult.None: break; case HitResult.Miss: - this.ScaleTo(1.6f); - this.ScaleTo(1, 100, Easing.In); + this.ScaleTo(origScale * 1.6f); + this.ScaleTo(origScale, 100, Easing.In); this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); this.RotateTo(40, 800, Easing.InQuint); @@ -79,8 +81,8 @@ namespace osu.Game.Rulesets.Judgements this.Delay(600).FadeOut(200); break; default: - this.ScaleTo(0.9f); - this.ScaleTo(1, 500, Easing.OutElastic); + this.ScaleTo(origScale * 0.9f); + this.ScaleTo(origScale, 500, Easing.OutElastic); this.Delay(100).FadeOut(400); break; From 62df0ec7d4c50b58a1bbcfdb2004a2bec10584de Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 07:16:19 -0400 Subject: [PATCH 109/132] Handle external files with File instead --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 69d25fcb67..997792025e 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Database; @@ -49,8 +50,24 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename))) - return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(s); + Stream stream; + if (File.Exists(replayFilename)) + { + // Handle replay with File since it is outside of storage + stream = File.OpenRead(replayFilename); + } + else if (storage.Exists(Path.Combine(replay_folder, replayFilename))) + { + stream = storage.GetStream(Path.Combine(replay_folder, replayFilename)); + } + else + { + Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); + return null; + } + + using (stream) + return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } } } From b95cc798b2b8d995422bf120118dfcb56461c44f Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 20:56:18 -0400 Subject: [PATCH 110/132] Remove unused fallback --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 997792025e..00aec1a28c 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -50,23 +50,13 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - Stream stream; - if (File.Exists(replayFilename)) - { - // Handle replay with File since it is outside of storage - stream = File.OpenRead(replayFilename); - } - else if (storage.Exists(Path.Combine(replay_folder, replayFilename))) - { - stream = storage.GetStream(Path.Combine(replay_folder, replayFilename)); - } - else + if (!File.Exists(replayFilename)) { Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); return null; } - using (stream) + using (var stream = File.OpenRead(replayFilename)) return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } } From dd36b6a3815d7891418a30d07dd8f3c6329056b8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 21:08:58 -0400 Subject: [PATCH 111/132] Remove unused field storage --- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreStore.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 9a5dac35b9..ca989bf0d5 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -154,7 +154,7 @@ namespace osu.Game dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host)); - dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, contextFactory, Host, BeatmapManager, RulesetStore)); + dependencies.Cache(ScoreStore = new ScoreStore(contextFactory, Host, BeatmapManager, RulesetStore)); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index 00aec1a28c..a847438934 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -14,8 +14,6 @@ namespace osu.Game.Rulesets.Scoring { public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles { - private readonly Storage storage; - private readonly BeatmapManager beatmaps; private readonly RulesetStore rulesets; @@ -26,9 +24,8 @@ namespace osu.Game.Rulesets.Scoring // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) private ScoreIPCChannel ipc; - public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) + public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory) { - this.storage = storage; this.beatmaps = beatmaps; this.rulesets = rulesets; From 20694674345c69fb34e3566782a8aef8845e70c1 Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Mon, 24 Sep 2018 21:18:55 -0400 Subject: [PATCH 112/132] Use HitObject scale to determine judgement size --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 9 ++------- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index f2c18d4c9c..b0010ccbf6 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -19,15 +19,12 @@ namespace osu.Game.Rulesets.Osu.UI private readonly Container approachCircles; private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; - private readonly OsuRulesetContainer rulesetContainer; public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); - public OsuPlayfield(OsuRulesetContainer rulesetContainer) + public OsuPlayfield() : base(BASE_SIZE.X) { - this.rulesetContainer = rulesetContainer; - Anchor = Anchor.Centre; Origin = Anchor.Centre; @@ -72,13 +69,11 @@ namespace osu.Game.Rulesets.Osu.UI if (!judgedObject.DisplayResult || !DisplayJudgements) return; - var explosionBaseSize = rulesetContainer.Beatmap.BeatmapInfo.BaseDifficulty.CircleSize; - DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) { Origin = Anchor.Centre, Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition, - Scale = new Vector2((1.0f - 0.7f * (explosionBaseSize - 5) / 5) / 2 * 1.65f) + Scale = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale * 1.65f) }; judgementLayer.Add(explosion); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 6cea8a0030..4bc6992445 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.UI public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor(this); - protected override Playfield CreatePlayfield() => new OsuPlayfield(this); + protected override Playfield CreatePlayfield() => new OsuPlayfield(); public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); From 319ed1bf0f3517f3e53bfefd33bf750980fcc32e Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Mon, 24 Sep 2018 21:35:13 -0400 Subject: [PATCH 113/132] Reorder if statement --- osu.Game/Rulesets/Scoring/ScoreStore.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Scoring/ScoreStore.cs b/osu.Game/Rulesets/Scoring/ScoreStore.cs index a847438934..091cb29a71 100644 --- a/osu.Game/Rulesets/Scoring/ScoreStore.cs +++ b/osu.Game/Rulesets/Scoring/ScoreStore.cs @@ -47,14 +47,14 @@ namespace osu.Game.Rulesets.Scoring public Score ReadReplayFile(string replayFilename) { - if (!File.Exists(replayFilename)) + if (File.Exists(replayFilename)) { - Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); - return null; + using (var stream = File.OpenRead(replayFilename)) + return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); } - using (var stream = File.OpenRead(replayFilename)) - return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream); + Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error); + return null; } } } From cb500e80e4ed0c8178fbc4cae153eb5f47f7d0d6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Sep 2018 14:39:10 +0900 Subject: [PATCH 114/132] Make BeatmapInfoWedge present until info is not null --- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4129a9596f..6b425791e0 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -89,6 +89,8 @@ namespace osu.Game.Screens.Select } } + public override bool IsPresent => base.IsPresent || Info == null; // Visibility is updated in the LoadComponentAsync callback + private BufferedWedgeInfo loadingInfo; private void updateDisplay() From 5f61faa2d9e2069034d3ff97fd3478b5db932787 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 25 Sep 2018 18:37:25 +0900 Subject: [PATCH 115/132] Fix multiple hits in the same frame pressing multiple hitobjects --- .../Objects/Drawables/DrawableHit.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index f59dc8c1ee..86c6a56685 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private bool validActionPressed; + private bool handleExtraPress; + protected DrawableHit(Hit hit) : base(hit) { @@ -51,6 +53,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) { + if (handleExtraPress) + return true; + if (Judged) return false; @@ -62,6 +67,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables if (IsHit) HitAction = action; + // Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded + // E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note + handleExtraPress = true; + return result; } @@ -76,6 +85,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables { base.Update(); + // The input manager processes all input prior to us updating, so this is the perfect time + // for us to remove the extra press blocking, before input is handled in the next frame + handleExtraPress = false; + Size = BaseSize * Parent.RelativeChildSize; } From 7cd547a760d05d0394af9651bc73b42ff1dace59 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 25 Sep 2018 20:53:24 +0900 Subject: [PATCH 116/132] Update chat to work with new API version --- osu.Game/Online/API/OAuth.cs | 5 +- .../Online/API/Requests/GetMessagesRequest.cs | 23 ++------ .../Online/API/Requests/GetUpdatesRequest.cs | 32 +++++++++++ .../Online/API/Requests/GetUpdatesResponse.cs | 14 +++++ .../Online/API/Requests/JoinChannelRequest.cs | 31 +++++++++++ .../API/Requests/LeaveChannelRequest.cs | 31 +++++++++++ .../Online/API/Requests/PostMessageRequest.cs | 8 ++- osu.Game/Online/Chat/Channel.cs | 2 +- osu.Game/Online/Chat/ChannelType.cs | 11 ++++ osu.Game/Overlays/ChatOverlay.cs | 54 ++++++++++++------- osu.Game/osu.Game.csproj | 2 +- osu.sln.DotSettings | 1 + 12 files changed, 168 insertions(+), 46 deletions(-) create mode 100644 osu.Game/Online/API/Requests/GetUpdatesRequest.cs create mode 100644 osu.Game/Online/API/Requests/GetUpdatesResponse.cs create mode 100644 osu.Game/Online/API/Requests/JoinChannelRequest.cs create mode 100644 osu.Game/Online/API/Requests/LeaveChannelRequest.cs create mode 100644 osu.Game/Online/Chat/ChannelType.cs diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index 67b908e894..7892df9aab 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Diagnostics; +using System.Net.Http; using osu.Framework.Configuration; using osu.Framework.IO.Network; @@ -40,7 +41,7 @@ namespace osu.Game.Online.API using (var req = new AccessTokenRequestPassword(username, password) { Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.POST, + Method = HttpMethod.Post, ClientId = clientId, ClientSecret = clientSecret }) @@ -66,7 +67,7 @@ namespace osu.Game.Online.API using (var req = new AccessTokenRequestRefresh(refresh) { Url = $@"{endpoint}/oauth/token", - Method = HttpMethod.POST, + Method = HttpMethod.Post, ClientId = clientId, ClientSecret = clientSecret }) diff --git a/osu.Game/Online/API/Requests/GetMessagesRequest.cs b/osu.Game/Online/API/Requests/GetMessagesRequest.cs index 68de194bae..94f5a114ad 100644 --- a/osu.Game/Online/API/Requests/GetMessagesRequest.cs +++ b/osu.Game/Online/API/Requests/GetMessagesRequest.cs @@ -2,34 +2,19 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Linq; -using osu.Framework.IO.Network; using osu.Game.Online.Chat; namespace osu.Game.Online.API.Requests { public class GetMessagesRequest : APIRequest> { - private readonly List channels; - private readonly long? since; + private readonly Channel channel; - public GetMessagesRequest(List channels, long? sinceId) + public GetMessagesRequest(Channel channel) { - this.channels = channels; - since = sinceId; + this.channel = channel; } - protected override WebRequest CreateWebRequest() - { - string channelString = string.Join(",", channels.Select(x => x.Id)); - - var req = base.CreateWebRequest(); - req.AddParameter(@"channels", channelString); - if (since.HasValue) req.AddParameter(@"since", since.Value.ToString()); - - return req; - } - - protected override string Target => @"chat/messages"; + protected override string Target => $@"chat/channels/{channel.Id}/messages"; } } diff --git a/osu.Game/Online/API/Requests/GetUpdatesRequest.cs b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs new file mode 100644 index 0000000000..950ad93396 --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUpdatesRequest.cs @@ -0,0 +1,32 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using JetBrains.Annotations; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class GetUpdatesRequest : APIRequest + { + private readonly long since; + private readonly Channel channel; + + public GetUpdatesRequest(long sinceId, [CanBeNull] Channel channel = null) + { + this.channel = channel; + since = sinceId; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + if (channel != null) req.AddParameter(@"channel", channel.Id.ToString()); + req.AddParameter(@"since", since.ToString()); + + return req; + } + + protected override string Target => @"chat/updates"; + } +} diff --git a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs new file mode 100644 index 0000000000..729290306a --- /dev/null +++ b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using osu.Game.Online.Chat; + +namespace osu.Game.Online.API.Requests +{ + public class GetUpdatesResponse + { + public List Presence; + public List Messages; + } +} diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs new file mode 100644 index 0000000000..55ada2ab3d --- /dev/null +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Net.Http; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class JoinChannelRequest : APIRequest + { + private readonly Channel channel; + private readonly User user; + + public JoinChannelRequest(Channel channel, User user) + { + this.channel = channel; + this.user = user; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Put; + return req; + } + + protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + } +} diff --git a/osu.Game/Online/API/Requests/LeaveChannelRequest.cs b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs new file mode 100644 index 0000000000..89bfa303c6 --- /dev/null +++ b/osu.Game/Online/API/Requests/LeaveChannelRequest.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Net.Http; +using osu.Framework.IO.Network; +using osu.Game.Online.Chat; +using osu.Game.Users; + +namespace osu.Game.Online.API.Requests +{ + public class LeaveChannelRequest : APIRequest + { + private readonly Channel channel; + private readonly User user; + + public LeaveChannelRequest(Channel channel, User user) + { + this.channel = channel; + this.user = user; + } + + protected override WebRequest CreateWebRequest() + { + var req = base.CreateWebRequest(); + req.Method = HttpMethod.Delete; + return req; + } + + protected override string Target => $@"chat/channels/{channel.Id}/users/{user.Id}"; + } +} diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index e0a9fb83b2..188d6ada34 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions; +using System.Net.Http; using osu.Framework.IO.Network; using osu.Game.Online.Chat; @@ -20,15 +20,13 @@ namespace osu.Game.Online.API.Requests { var req = base.CreateWebRequest(); - req.Method = HttpMethod.POST; - req.AddParameter(@"target_type", message.TargetType.GetDescription()); - req.AddParameter(@"target_id", message.TargetId.ToString()); + req.Method = HttpMethod.Post; req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant()); req.AddParameter(@"message", message.Content); return req; } - protected override string Target => @"chat/messages"; + protected override string Target => $@"chat/channels/{message.TargetId}/messages"; } } diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index e7aabad780..e68a84cd86 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -19,7 +19,7 @@ namespace osu.Game.Online.Chat public string Topic; [JsonProperty(@"type")] - public string Type; + public ChannelType Type; [JsonProperty(@"channel_id")] public int Id; diff --git a/osu.Game/Online/Chat/ChannelType.cs b/osu.Game/Online/Chat/ChannelType.cs new file mode 100644 index 0000000000..4ac0a99fc6 --- /dev/null +++ b/osu.Game/Online/Chat/ChannelType.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Online.Chat +{ + public enum ChannelType + { + PM, + Public + } +} diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..e22798faa8 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Overlays public const float TAB_AREA_HEIGHT = 50; - private GetMessagesRequest fetchReq; + private GetUpdatesRequest fetchReq; private readonly ChatTabControl channelTabs; @@ -285,7 +285,7 @@ namespace osu.Game.Overlays chatBackground.Colour = colours.ChatBlue; } - private long? lastMessageId; + private long lastMessageId; private readonly List careChannels = new List(); @@ -304,9 +304,9 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { - addChannel(channels.Find(c => c.Name == @"#lazer")); - addChannel(channels.Find(c => c.Name == @"#osu")); - addChannel(channels.Find(c => c.Name == @"#lobby")); + //addChannel(channels.Find(c => c.Name == @"#lazer")); + //addChannel(channels.Find(c => c.Name == @"#osu")); + //addChannel(channels.Find(c => c.Name == @"#lobby")); channelSelection.OnRequestJoin = addChannel; channelSelection.OnRequestLeave = removeChannel; @@ -320,7 +320,7 @@ namespace osu.Game.Overlays }; }); - messageRequest = Scheduler.AddDelayed(fetchNewMessages, 1000, true); + messageRequest = Scheduler.AddDelayed(fetchUpdates, 1000, true); }; api.Queue(req); @@ -394,6 +394,15 @@ namespace osu.Game.Overlays { careChannels.Add(channel); channelTabs.AddItem(channel); + + if (channel.Type == ChannelType.Public && !channel.Joined) + { + var req = new JoinChannelRequest(channel, api.LocalUser); + req.Success += addChannel; + req.Failure += ex => removeChannel(channel); + api.Queue(req); + return; + } } // let's fetch a small number of messages to bring us up-to-date with the backlog. @@ -415,39 +424,48 @@ namespace osu.Game.Overlays loadedChannels.Remove(loadedChannels.Find(c => c.Channel == channel)); channelTabs.RemoveItem(channel); + api.Queue(new LeaveChannelRequest(channel, api.LocalUser)); channel.Joined.Value = false; } private void fetchInitialMessages(Channel channel) { - var req = new GetMessagesRequest(new List { channel }, null); + var req = new GetMessagesRequest(channel); - req.Success += delegate (List messages) + req.Success += messages => { loading.Hide(); channel.AddNewMessages(messages.ToArray()); Debug.Write("success!"); }; - req.Failure += delegate - { - Debug.Write("failure!"); - }; + + req.Failure += exception => Debug.Write("failure!"); api.Queue(req); } - private void fetchNewMessages() + private void fetchUpdates() { if (fetchReq != null) return; - fetchReq = new GetMessagesRequest(careChannels, lastMessageId); + fetchReq = new GetUpdatesRequest(lastMessageId); - fetchReq.Success += delegate (List messages) + fetchReq.Success += updates => { - foreach (var group in messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) - careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); + // fuck the what. + if (updates?.Presence != null) + { + foreach (var channel in updates.Presence) + { + channel.Joined.Value = true; + addChannel(channel); + } - lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; + foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) + careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); + + lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; + } Debug.Write("success!"); fetchReq = null; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5ce04b813b..532654b4dc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 1f1b6a79b1..404b19deda 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -218,6 +218,7 @@ GMT QAT BNG + UI HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From a8f156584bfa08d23cab1c0fa6f893a21ac205bd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Sep 2018 14:01:15 +0900 Subject: [PATCH 117/132] Update framework with positional/non-positional changes --- osu.Desktop/Overlays/VersionManager.cs | 4 ++-- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 2 +- .../Edit/Layers/Selection/Overlays/SliderCircleMask.cs | 2 +- .../Edit/Layers/Selection/Overlays/SliderMask.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 4 ++-- .../Objects/Drawables/Pieces/SliderBody.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerBackground.cs | 4 ++-- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ++-- osu.Game/Graphics/Containers/LinkFlowContainer.cs | 2 +- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 8 ++++---- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/UserInterface/BreadcrumbControl.cs | 6 +++--- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 2 +- osu.Game/Online/Chat/DrawableLinkCompiler.cs | 4 ++-- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 2 +- osu.Game/Overlays/DialogOverlay.cs | 2 +- osu.Game/Overlays/Direct/FilterControl.cs | 4 ++-- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 4 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 4 ++-- osu.Game/Overlays/VolumeOverlay.cs | 2 +- osu.Game/Overlays/WaveOverlayContainer.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++-- .../Screens/Edit/Screens/Compose/BeatDivisorControl.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 6 +++--- osu.Game/Screens/Menu/ButtonSystem.cs | 4 ++-- osu.Game/Screens/Menu/LogoVisualisation.cs | 4 ++-- osu.Game/Screens/Menu/MenuSideFlashes.cs | 4 ++-- osu.Game/Screens/Menu/OsuLogo.cs | 4 ++-- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 4 ++-- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 6 +++--- osu.Game/Screens/Play/KeyCounterMouse.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 4 ++-- osu.Game/Screens/Play/SongProgress.cs | 4 ++-- osu.Game/Screens/Play/SquareGraph.cs | 4 ++-- osu.Game/Screens/Select/BeatmapCarousel.cs | 4 ++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- osu.Game/Screens/Select/FilterControl.cs | 4 ++-- osu.Game/Screens/Select/FooterButton.cs | 2 +- osu.Game/Screens/Select/Leaderboards/Placeholder.cs | 2 +- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 56 files changed, 86 insertions(+), 86 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1129969694..8881884fb4 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -27,8 +27,8 @@ namespace osu.Desktop.Overlays private NotificationOverlay notificationOverlay; private GameHost host; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; [BackgroundDependencyLoader] private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index bfa6bc0a17..03d2ba19cb 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays } // Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input. - public override bool HandleMouseInput => false; + public override bool HandlePositionalInput => false; } } } diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs index adb28289cf..151564a2a8 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderCircleMask.cs @@ -56,6 +56,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays } // Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input. - public override bool HandleMouseInput => false; + public override bool HandlePositionalInput => false; } } diff --git a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs index 0f6143a83d..aff42dd233 100644 --- a/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs +++ b/osu.Game.Rulesets.Osu/Edit/Layers/Selection/Overlays/SliderMask.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Layers.Selection.Overlays body.UpdateProgress(0); } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => body.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos); public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition); public override Quad SelectionQuad => body.PathDrawQuad; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 66f491532d..89f380db4e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -184,6 +184,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public Drawable ProxiedLayer => HeadCircle.ApproachCircle; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Body.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Body.ReceivePositionalInputAt(screenSpacePos); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index b79750a1b3..1388b23fa8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -153,10 +153,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (Time.Current < slider.EndTime) { - // Make sure to use the base version of ReceiveMouseInputAt so that we correctly check the position. + // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. Tracking = canCurrentlyTrack && lastState != null - && ReceiveMouseInputAt(lastState.Mouse.NativeState.Position) + && ReceivePositionalInputAt(lastState.Mouse.NativeState.Position) && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 6f0197e711..f3924ec43b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces container.Attach(RenderbufferInternalFormat.DepthComponent16); } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => path.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos); public void SetRange(double p0, double p1) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 1a7455838f..0401df7a91 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; protected Box Disc; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 5aba60ba03..6e5bc5258b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private bool tracking; public bool Tracking diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 4a6b12d41a..60c24a6fbd 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; [BackgroundDependencyLoader] private void load(ShaderManager shaders, TextureStore textures) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 4d6722b61b..4a45d4fb31 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor return false; } - public override bool HandleMouseInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input. + public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input. protected override void PopIn() { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index 361e255894..d4c409b144 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual public CursorContainer Cursor { get; } public bool ProvidingUserCursor { get; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor; private readonly Box background; diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index 0f382900ce..bff9e49dce 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -30,8 +30,8 @@ namespace osu.Game.Graphics.Backgrounds /// private const float edge_smoothness = 1; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; public Color4 ColourLight = Color4.White; diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 9c5da71aff..7c17f95e80 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Graphics.Containers { } - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; private OsuGame game; diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index d2ab8441eb..a143c056ff 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.Containers protected virtual bool PlaySamplesOnStateChange => true; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; private PreviewTrackManager previewTrackManager; @@ -54,14 +54,14 @@ namespace osu.Game.Graphics.Containers /// Whether mouse input should be blocked screen-wide while this overlay is visible. /// Performing mouse actions outside of the valid extents will hide the overlay. /// - public virtual bool BlockScreenWideMouse => BlockPassThroughMouse; + public virtual bool BlockScreenWideMouse => BlockPositionalInput; // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos); protected override bool OnClick(InputState state) { - if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position)) + if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index be794d93a6..1a7ed607e6 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -54,7 +54,7 @@ namespace osu.Game.Graphics Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; protected virtual string Format() => Date.Humanize(); diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index f5017de639..ebb7b686e4 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -47,10 +47,10 @@ namespace osu.Game.Graphics.UserInterface public readonly SpriteIcon Chevron; //don't allow clicking between transitions and don't make the chevron clickable - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceivePositionalInputAt(screenSpacePos); - public override bool HandleKeyboardInput => State == Visibility.Visible; - public override bool HandleMouseInput => State == Visibility.Visible; + public override bool HandleNonPositionalInput => State == Visibility.Visible; + public override bool HandlePositionalInput => State == Visibility.Visible; public override bool IsRemovable => true; private Visibility state; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index ee2448ff02..5094062fae 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -211,7 +211,7 @@ namespace osu.Game.Graphics.UserInterface } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); protected override bool OnClick(InputState state) { diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index e4fd71e17e..18ec35c76e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface } // We may not be focused yet, but we need to handle keyboard input to be able to request focus - public override bool HandleKeyboardInput => HoldFocus || base.HandleKeyboardInput; + public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; protected override void OnFocus(InputState state) { diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 4e6361d1ae..027ba67f66 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -170,7 +170,7 @@ namespace osu.Game.Graphics.UserInterface } } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos); protected override bool OnHover(InputState state) { diff --git a/osu.Game/Online/Chat/DrawableLinkCompiler.cs b/osu.Game/Online/Chat/DrawableLinkCompiler.cs index 475363bd51..0148d1d2c3 100644 --- a/osu.Game/Online/Chat/DrawableLinkCompiler.cs +++ b/osu.Game/Online/Chat/DrawableLinkCompiler.cs @@ -24,7 +24,7 @@ namespace osu.Game.Online.Chat /// public List Parts; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos)); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceivePositionalInputAt(screenSpacePos)); protected override HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new LinkHoverSounds(sampleSet, Parts); @@ -53,7 +53,7 @@ namespace osu.Game.Online.Chat this.parts = parts; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos)); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => parts.Any(d => d.ReceivePositionalInputAt(screenSpacePos)); } } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 02cc89e57e..f66e103a21 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays } // receive input outside our bounds so we can trigger a close event on ourselves. - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public BeatmapSetOverlay() { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..a2276d4904 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays private readonly Container channelSelectionContainer; private readonly ChannelSelectionOverlay channelSelection; - public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceiveMouseInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceiveMouseInputAt(screenSpacePos); + public override bool Contains(Vector2 screenSpacePos) => chatContainer.ReceivePositionalInputAt(screenSpacePos) || channelSelection.State == Visibility.Visible && channelSelection.ReceivePositionalInputAt(screenSpacePos); public ChatOverlay() { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 3f79fa98e5..ccbb7cc496 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Dialog public static readonly float ENTER_DURATION = 500; public static readonly float EXIT_DURATION = 200; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private readonly Vector2 ringSize = new Vector2(100f); private readonly Vector2 ringMinifiedSize = new Vector2(20f); diff --git a/osu.Game/Overlays/DialogOverlay.cs b/osu.Game/Overlays/DialogOverlay.cs index c40f517023..dae502dbd9 100644 --- a/osu.Game/Overlays/DialogOverlay.cs +++ b/osu.Game/Overlays/DialogOverlay.cs @@ -43,7 +43,7 @@ namespace osu.Game.Overlays protected override bool PlaySamplesOnStateChange => false; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v) { diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index df98cc3c32..c4825f72fe 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -73,8 +73,8 @@ namespace osu.Game.Overlays.Direct iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100); } - public override bool HandleKeyboardInput => !bindable.Disabled && base.HandleKeyboardInput; - public override bool HandleMouseInput => !bindable.Disabled && base.HandleMouseInput; + public override bool HandleNonPositionalInput => !bindable.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !bindable.Disabled && base.HandlePositionalInput; public RulesetToggleButton(Bindable bindable, RulesetInfo ruleset) { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index e83dedaf35..55d5d797e7 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Mods protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel; private readonly FillFlowContainer footerContainer; - protected override bool BlockPassThroughKeyboard => false; + protected override bool BlockNonPositionalInput => false; protected readonly FillFlowContainer ModSectionsContainer; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 041ceab365..e40004aa01 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -25,8 +25,8 @@ namespace osu.Game.Overlays { private readonly Container box; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private readonly SpriteText textLine1; private readonly SpriteText textLine2; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index cdc3bc2b51..3f44cb403a 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar private readonly ToolbarUserArea userArea; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private const double transition_time = 500; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index f2744ae83f..4b6fb366bb 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -103,8 +103,8 @@ namespace osu.Game.Overlays.Toolbar return false; } - public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput; - public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput; + public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; + public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 4dcdd23768..bf1c81393d 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays private VolumeMeter volumeMeterMusic; private MuteButton muteButton; - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; private readonly BindableDouble muteAdjustment = new BindableDouble(); diff --git a/osu.Game/Overlays/WaveOverlayContainer.cs b/osu.Game/Overlays/WaveOverlayContainer.cs index 97f52d88f7..c5a4953c5e 100644 --- a/osu.Game/Overlays/WaveOverlayContainer.cs +++ b/osu.Game/Overlays/WaveOverlayContainer.cs @@ -11,7 +11,7 @@ namespace osu.Game.Overlays { protected readonly WaveContainer Waves; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; protected override Container Content => Waves; protected WaveOverlayContainer() diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index ada026b32f..0ba67e1dca 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Edit public readonly DrawableHitObject HitObject; protected override bool ShouldBeAlive => HitObject.IsAlive && HitObject.IsPresent || State == SelectionState.Selected; - public override bool HandleMouseInput => ShouldBeAlive; + public override bool HandlePositionalInput => ShouldBeAlive; public override bool RemoveWhenNotAlive => false; public HitObjectMask(DrawableHitObject hitObject) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a274d9b12f..8489f0b19e 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -78,8 +78,8 @@ namespace osu.Game.Rulesets.Objects.Drawables private bool judgementOccurred; public bool Interactive = true; - public override bool HandleKeyboardInput => Interactive; - public override bool HandleMouseInput => Interactive; + public override bool HandleNonPositionalInput => Interactive; + public override bool HandlePositionalInput => Interactive; public override bool RemoveWhenNotAlive => false; public override bool RemoveCompletedTransforms => false; diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 63df143ca8..833c4464c3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -231,7 +231,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose { } - public override bool HandleKeyboardInput => IsHovered && !CurrentNumber.Disabled; + public override bool HandleNonPositionalInput => IsHovered && !CurrentNumber.Disabled; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index e53905a102..38d74a3a4b 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Menu private SampleChannel sampleClick; private SampleChannel sampleHover; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown) { @@ -229,8 +229,8 @@ namespace osu.Game.Screens.Menu boxHoverLayer.FadeOut(800, Easing.OutExpo); } - public override bool HandleKeyboardInput => state == ButtonState.Expanded; - public override bool HandleMouseInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f; + public override bool HandleNonPositionalInput => state == ButtonState.Expanded; + public override bool HandlePositionalInput => state != ButtonState.Exploded && box.Scale.X >= 0.8f; protected override void Update() { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index dba0a3ac50..5c17317fc1 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -160,8 +160,8 @@ namespace osu.Game.Screens.Menu private ButtonSystemState state = ButtonSystemState.Initial; - public override bool HandleKeyboardInput => state != ButtonSystemState.Exit; - public override bool HandleMouseInput => state != ButtonSystemState.Exit; + public override bool HandleNonPositionalInput => state != ButtonSystemState.Exit; + public override bool HandlePositionalInput => state != ButtonSystemState.Exit; public ButtonSystemState State { diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index a3cb2f13d0..5d76206905 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -64,8 +64,8 @@ namespace osu.Game.Screens.Menu private readonly float[] frequencyAmplitudes = new float[256]; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private Shader shader; private readonly Texture texture; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 7d46aad089..a9e3310fbe 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens.Menu { public class MenuSideFlashes : BeatSyncedContainer { - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private readonly IBindable beatmap = new Bindable(); diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 5ad6427fd8..52354241d2 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Menu public bool BeatMatching = true; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => logoContainer.ReceivePositionalInputAt(screenSpacePos); public bool Ripple { @@ -342,7 +342,7 @@ namespace osu.Game.Screens.Menu } } - public override bool HandleMouseInput => base.HandleMouseInput && Action != null && Alpha > 0.2f; + public override bool HandlePositionalInput => base.HandlePositionalInput && Action != null && Alpha > 0.2f; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index f50b3e9661..a978bd916e 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -28,9 +28,9 @@ namespace osu.Game.Screens.Play private const int button_height = 70; private const float background_alpha = 0.75f; - protected override bool BlockPassThroughKeyboard => true; + protected override bool BlockNonPositionalInput => true; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; public Action OnRetry; public Action OnQuit; diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index e5e2ed7ee0..7534c7a22e 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play.HUD protected override void PopOut() => this.FadeOut(fade_duration); //We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible - public override bool HandleKeyboardInput => true; + public override bool HandleNonPositionalInput => true; protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 2a4b1f408d..6b120421ad 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.HUD { public class QuitButton : FillFlowContainer { - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private readonly Button button; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 76c102c840..925f96f33b 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -118,8 +118,8 @@ namespace osu.Game.Screens.Play private void updateVisibility() => this.FadeTo(Visible.Value || configVisibility.Value ? 1 : 0, duration); - public override bool HandleKeyboardInput => receptor == null; - public override bool HandleMouseInput => receptor == null; + public override bool HandleNonPositionalInput => receptor == null; + public override bool HandlePositionalInput => receptor == null; public IFrameBasedClock AudioClock { get; set; } @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play Target = target; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; protected override bool Handle(UIEvent e) { diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 20cc53caee..37c2b4f072 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play Button = button; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private static string getStringRepresentation(MouseButton button) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 046a00d79b..d736a51a99 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Play private FadeContainer fadeContainer; private double displayTime; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true; - protected override bool BlockPassThroughMouse => false; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + protected override bool BlockPositionalInput => false; public SkipOverlay(double startTime) { diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 2ca471c5c1..2e2c77c1c8 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -31,8 +31,8 @@ namespace osu.Game.Screens.Play public Action OnSeek; - public override bool HandleKeyboardInput => AllowSeeking; - public override bool HandleMouseInput => AllowSeeking; + public override bool HandleNonPositionalInput => AllowSeeking; + public override bool HandlePositionalInput => AllowSeeking; private IClock audioClock; public IClock AudioClock { set { audioClock = info.AudioClock = value; } } diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 8ffd04b35c..6b4918af75 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -21,8 +21,8 @@ namespace osu.Game.Screens.Play public int ColumnCount => columns.Length; - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private int progress; public int Progress diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b6cbaf45e9..5771cb1f70 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -52,8 +52,8 @@ namespace osu.Game.Screens.Select /// public Action SelectionChanged; - public override bool HandleKeyboardInput => AllowSelection; - public override bool HandleMouseInput => AllowSelection; + public override bool HandleNonPositionalInput => AllowSelection; + public override bool HandlePositionalInput => AllowSelection; /// /// Used to avoid firing null selections before the initial beatmaps have been loaded via . diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 4129a9596f..2196f3f486 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -59,7 +59,7 @@ namespace osu.Game.Screens.Select ruleset.ValueChanged += _ => updateDisplay(); } - protected override bool BlockPassThroughMouse => false; + protected override bool BlockPositionalInput => false; protected override void PopIn() { @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Both; titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); - artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); + artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 9ba8b085f3..32b6620c84 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -72,8 +72,8 @@ namespace osu.Game.Screens.Select private readonly SearchTextBox searchTextBox; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => - base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => + base.ReceivePositionalInputAt(screenSpacePos) || groupTabs.ReceivePositionalInputAt(screenSpacePos) || sortTabs.ReceivePositionalInputAt(screenSpacePos); public FilterControl() { diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 1b0e3a1620..8fb95d394e 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Select private readonly Box box; private readonly Box light; - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public FooterButton() { diff --git a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs index 307986a299..105f9e2064 100644 --- a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs @@ -11,7 +11,7 @@ namespace osu.Game.Screens.Select.Leaderboards { protected const float TEXT_SIZE = 22; - public override bool HandleMouseInput => true; + public override bool HandlePositionalInput => true; protected Placeholder() : base(cp => cp.TextSize = TEXT_SIZE) diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index d4cd882433..f9127ace19 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Select.Options return false; } - public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos); public BeatmapOptionsButton() { diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 37c198f370..02a4b46f1c 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -18,8 +18,8 @@ namespace osu.Game.Storyboards.Drawables protected override Container Content => content; protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); - public override bool HandleKeyboardInput => false; - public override bool HandleMouseInput => false; + public override bool HandleNonPositionalInput => false; + public override bool HandlePositionalInput => false; private bool passing = true; public bool Passing diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5ce04b813b..992a08ce17 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From e71e871d1fb68f3aafa7fb1c65e0ec52d7d9e50a Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 26 Sep 2018 18:41:55 +0900 Subject: [PATCH 118/132] Remove unnecessary comment --- osu.Game/Database/ArchiveModelManager.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 22abb4f6fa..723bb90e7e 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -290,7 +290,6 @@ namespace osu.Game.Database // re-fetch the model on the import context. var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID); - // Test for null since FirstOrDefault will return null if nothing is found if (foundModel == null || foundModel.DeletePending) return false; if (ModelStore.Delete(foundModel)) From e259911875ca54e4c8b42bb6bc8e8da34d9d6053 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 26 Sep 2018 18:44:03 +0900 Subject: [PATCH 119/132] Use invariant tolower --- osu.Game/IPC/ArchiveImportIPCChannel.cs | 2 +- osu.Game/OsuGameBase.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/IPC/ArchiveImportIPCChannel.cs b/osu.Game/IPC/ArchiveImportIPCChannel.cs index e127faa70d..fa8168c1de 100644 --- a/osu.Game/IPC/ArchiveImportIPCChannel.cs +++ b/osu.Game/IPC/ArchiveImportIPCChannel.cs @@ -37,7 +37,7 @@ namespace osu.Game.IPC return; } - if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLower())) + if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant())) importer.Import(path); } } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 36ca043df6..6e34302a32 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -243,7 +243,7 @@ namespace osu.Game public void Import(params string[] paths) { - var extension = Path.GetExtension(paths.First())?.ToLower(); + var extension = Path.GetExtension(paths.First())?.ToLowerInvariant(); foreach (var importer in fileImporters) if (importer.HandledExtensions.Contains(extension)) importer.Import(paths); From 2436ee589d25d77e159b09b63b88fcacddf06f40 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:13:38 +0900 Subject: [PATCH 120/132] Remove incorrect API response --- osu.Game/Online/API/Requests/JoinChannelRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Online/API/Requests/JoinChannelRequest.cs b/osu.Game/Online/API/Requests/JoinChannelRequest.cs index 55ada2ab3d..a0a4667e98 100644 --- a/osu.Game/Online/API/Requests/JoinChannelRequest.cs +++ b/osu.Game/Online/API/Requests/JoinChannelRequest.cs @@ -8,7 +8,7 @@ using osu.Game.Users; namespace osu.Game.Online.API.Requests { - public class JoinChannelRequest : APIRequest + public class JoinChannelRequest : APIRequest { private readonly Channel channel; private readonly User user; From 1fd2782dd4bb0a138e3aa842495ca175b617c660 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:15:02 +0900 Subject: [PATCH 121/132] Fix loading spinner not disappearing on empty channels --- osu.Game/Online/Chat/Channel.cs | 10 ++++++++++ osu.Game/Overlays/ChatOverlay.cs | 11 ++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index e68a84cd86..01560dd1fd 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -24,6 +24,9 @@ namespace osu.Game.Online.Chat [JsonProperty(@"channel_id")] public int Id; + [JsonProperty(@"last_message_id")] + public long? LastMessageId; + public readonly SortedList Messages = new SortedList(Comparer.Default); private readonly List pendingMessages = new List(); @@ -51,11 +54,18 @@ namespace osu.Game.Online.Chat NewMessagesArrived?.Invoke(new[] { message }); } + public bool MessagesLoaded { get; private set; } + public void AddNewMessages(params Message[] messages) { messages = messages.Except(Messages).ToArray(); Messages.AddRange(messages); + MessagesLoaded = true; + + var maxMessageId = messages.Max(m => m.Id); + if (maxMessageId > LastMessageId) + LastMessageId = maxMessageId; purgeOldMessages(); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index e22798faa8..774570a747 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -362,7 +362,7 @@ namespace osu.Game.Overlays loadedChannels.Add(loaded); LoadComponentAsync(loaded, l => { - if (currentChannel.Messages.Any()) + if (currentChannel.MessagesLoaded) loading.Hide(); currentChannelContainer.Clear(false); @@ -398,7 +398,7 @@ namespace osu.Game.Overlays if (channel.Type == ChannelType.Public && !channel.Joined) { var req = new JoinChannelRequest(channel, api.LocalUser); - req.Success += addChannel; + req.Success += () => addChannel(channel); req.Failure += ex => removeChannel(channel); api.Queue(req); return; @@ -431,16 +431,13 @@ namespace osu.Game.Overlays private void fetchInitialMessages(Channel channel) { var req = new GetMessagesRequest(channel); - req.Success += messages => { - loading.Hide(); channel.AddNewMessages(messages.ToArray()); - Debug.Write("success!"); + if (channel == currentChannel) + loading.Hide(); }; - req.Failure += exception => Debug.Write("failure!"); - api.Queue(req); } From 6f3c8e9f8bf1f6190777ab513dadd20b0d5c30c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Sep 2018 19:58:58 +0900 Subject: [PATCH 122/132] Add explicit usage via attribute --- osu.Game/Online/API/Requests/GetUpdatesResponse.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs index 729290306a..474d8e1501 100644 --- a/osu.Game/Online/API/Requests/GetUpdatesResponse.cs +++ b/osu.Game/Online/API/Requests/GetUpdatesResponse.cs @@ -2,13 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using Newtonsoft.Json; using osu.Game.Online.Chat; namespace osu.Game.Online.API.Requests { public class GetUpdatesResponse { + [JsonProperty] public List Presence; + + [JsonProperty] public List Messages; } } From f0b1aa7edf9fe75ecf220e143f09e58e2df543ec Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Sep 2018 20:04:22 +0900 Subject: [PATCH 123/132] Fix unnecessary messages retrieval --- osu.Game/Overlays/ChatOverlay.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 774570a747..98d8fb6322 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -449,13 +449,15 @@ namespace osu.Game.Overlays fetchReq.Success += updates => { - // fuck the what. if (updates?.Presence != null) { foreach (var channel in updates.Presence) { - channel.Joined.Value = true; - addChannel(channel); + if (careChannels.Find(c => c.Id == channel.Id) == null) + { + channel.Joined.Value = true; + addChannel(channel); + } } foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) @@ -464,13 +466,11 @@ namespace osu.Game.Overlays lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; } - Debug.Write("success!"); fetchReq = null; }; fetchReq.Failure += delegate { - Debug.Write("failure!"); fetchReq = null; }; From 6a763334a188457d627edfe6dcba7aae3023869c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 10:00:40 +0900 Subject: [PATCH 124/132] Exit early as safety when no messages are received --- osu.Game/Online/Chat/Channel.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 01560dd1fd..bbe74fcac0 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -60,6 +60,8 @@ namespace osu.Game.Online.Chat { messages = messages.Except(Messages).ToArray(); + if (messages.Length == 0) return; + Messages.AddRange(messages); MessagesLoaded = true; From d5d8a28b53890ee8a9dc7eef346d2af859214139 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 10:01:25 +0900 Subject: [PATCH 125/132] Add explanatory comment about startup channel joins --- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 98d8fb6322..107ab11f34 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -304,6 +304,8 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { + //todo: decide how to handle default channels for a user now that they are saved server-side. + // we likely don't want to re-join every startup like this. //addChannel(channels.Find(c => c.Name == @"#lazer")); //addChannel(channels.Find(c => c.Name == @"#osu")); //addChannel(channels.Find(c => c.Name == @"#lobby")); From 3479bfa409d8c05f7445d9fb8708df5d6e40a13a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 28 Sep 2018 17:18:34 +0900 Subject: [PATCH 126/132] Rename variable --- osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs index 86c6a56685..6f7264e23b 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables private bool validActionPressed; - private bool handleExtraPress; + private bool pressHandledThisFrame; protected DrawableHit(Hit hit) : base(hit) @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables public override bool OnPressed(TaikoAction action) { - if (handleExtraPress) + if (pressHandledThisFrame) return true; if (Judged) @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded // E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note - handleExtraPress = true; + pressHandledThisFrame = true; return result; } @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // The input manager processes all input prior to us updating, so this is the perfect time // for us to remove the extra press blocking, before input is handled in the next frame - handleExtraPress = false; + pressHandledThisFrame = false; Size = BaseSize * Parent.RelativeChildSize; } From 9baf5872460497bb0b3efac8b6be4db4c2b3d39e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 18:25:40 +0900 Subject: [PATCH 127/132] Bump framework again --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 1b8dfcb9e0..8fb42c0cea 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From d3eb24e70a2861cbfbe3f5d3759bf67f1cb23628 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 18:29:49 +0900 Subject: [PATCH 128/132] Fix score retrieval no longer working --- osu.Game/Rulesets/Scoring/Score.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Rulesets/Scoring/Score.cs b/osu.Game/Rulesets/Scoring/Score.cs index dfe7ff0195..02f528791a 100644 --- a/osu.Game/Rulesets/Scoring/Score.cs +++ b/osu.Game/Rulesets/Scoring/Score.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Users; @@ -32,6 +33,7 @@ namespace osu.Game.Rulesets.Scoring public User User; + [JsonIgnore] public Replay Replay; public BeatmapInfo Beatmap; From 3cacc11af139184b27d5bbee0abd90b630ac1eb9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 19:33:19 +0900 Subject: [PATCH 129/132] Fix outdated API variable --- osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 +- osu.Game/Online/Chat/Message.cs | 7 ++----- osu.Game/Overlays/ChatOverlay.cs | 5 ++--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 188d6ada34..8d9ba5dd5d 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -27,6 +27,6 @@ namespace osu.Game.Online.API.Requests return req; } - protected override string Target => $@"chat/channels/{message.TargetId}/messages"; + protected override string Target => $@"chat/channels/{message.ChannelId}/messages"; } } diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 535035e4fc..65e0415cd3 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -18,11 +18,8 @@ namespace osu.Game.Online.Chat [JsonProperty(@"sender_id")] public int UserId; - [JsonProperty(@"target_type")] - public TargetType TargetType; - - [JsonProperty(@"target_id")] - public int TargetId; + [JsonProperty(@"channel_id")] + public int ChannelId; [JsonProperty(@"is_action")] public bool IsAction; diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index d9bb4eb12b..74eac166e2 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -462,7 +462,7 @@ namespace osu.Game.Overlays } } - foreach (var group in updates.Messages.Where(m => m.TargetType == TargetType.Channel).GroupBy(m => m.TargetId)) + foreach (var group in updates.Messages.GroupBy(m => m.ChannelId)) careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); lastMessageId = updates.Messages.LastOrDefault()?.Id ?? lastMessageId; @@ -534,8 +534,7 @@ namespace osu.Game.Overlays { Sender = api.LocalUser.Value, Timestamp = DateTimeOffset.Now, - TargetType = TargetType.Channel, //TODO: read this from channel - TargetId = target.Id, + ChannelId = target.Id, IsAction = isAction, Content = postText }; From 862d3c4a6900ddd5648976c2c619200ed962fc2c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 28 Sep 2018 19:33:35 +0900 Subject: [PATCH 130/132] Add back autojoins --- osu.Game/Overlays/ChatOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 74eac166e2..dcf5b74d08 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -305,10 +305,8 @@ namespace osu.Game.Overlays Scheduler.Add(delegate { //todo: decide how to handle default channels for a user now that they are saved server-side. - // we likely don't want to re-join every startup like this. - //addChannel(channels.Find(c => c.Name == @"#lazer")); - //addChannel(channels.Find(c => c.Name == @"#osu")); - //addChannel(channels.Find(c => c.Name == @"#lobby")); + addChannel(channels.Find(c => c.Name == @"#lazer")); + addChannel(channels.Find(c => c.Name == @"#osu")); channelSelection.OnRequestJoin = addChannel; channelSelection.OnRequestLeave = removeChannel; From 1fe5ed5524190bb7bb542de5525691cd7a17a5e3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 29 Sep 2018 01:59:16 +0900 Subject: [PATCH 131/132] Update signing certificate --- appveyor_deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index 6d8d95e773..22a4859885 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -10,8 +10,8 @@ before_build: - cmd: nuget restore -verbosity quiet build_script: - ps: iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1')) - - appveyor DownloadFile https://puu.sh/A6g5K/4d08705438.enc # signing certificate - - cmd: appveyor-tools\secure-file -decrypt 4d08705438.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx + - appveyor DownloadFile https://puu.sh/BCrS8/7faccf7876.enc # signing certificate + - cmd: appveyor-tools\secure-file -decrypt 7faccf7876.enc -secret %decode_secret% -out %HOMEPATH%\deanherbert.pfx - appveyor DownloadFile https://puu.sh/A6g75/fdc6f19b04.enc # deploy configuration - cd osu-deploy - nuget restore -verbosity quiet From 08f58047c2182e49c6794d30d12bc60107dd9832 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sun, 30 Sep 2018 16:08:17 +0200 Subject: [PATCH 132/132] Remade measurements, turns out the correction was not needed --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index a65079c590..970dc2d630 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.UI }, }); - VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450) / 1.2; + VisibleTimeRange.Value = BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450); } public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj);