From e1f01d6f73e24f2a0fb54c4f0885261e650b1282 Mon Sep 17 00:00:00 2001 From: clayton Date: Sat, 25 Aug 2018 20:31:33 -0700 Subject: [PATCH 01/92] Update LastVisit JSON property name --- osu.Game/Users/User.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index f42df4023f..10b75082ad 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -83,7 +83,7 @@ namespace osu.Game.Users [JsonProperty(@"location")] public string Location; - [JsonProperty(@"lastvisit")] + [JsonProperty(@"last_visit")] public DateTimeOffset LastVisit; [JsonProperty(@"twitter")] From f99eff11926d9c70e18b63e4aaa8952cd6721e5f Mon Sep 17 00:00:00 2001 From: Joehu Date: Sat, 15 Sep 2018 07:30:11 -0700 Subject: [PATCH 02/92] Use consistent terminology format --- osu.Game.Rulesets.Osu/OsuInputManager.cs | 4 ++-- osu.Game.Rulesets.Taiko/TaikoInputManager.cs | 8 ++++---- osu.Game/Input/Bindings/GlobalActionContainer.cs | 8 ++++---- .../Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 +- .../Overlays/Settings/Sections/Audio/VolumeSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/KeyboardSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/MouseSettings.cs | 4 ++-- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs | 8 ++++---- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 2 +- .../Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs | 4 ++-- osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs | 2 +- osu.Game/Screens/Select/Filter/GroupMode.cs | 4 ++-- osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- .../Storyboards/Drawables/DrawableStoryboardSample.cs | 2 +- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index e7bbe755a0..b734f52fd1 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -48,10 +48,10 @@ namespace osu.Game.Rulesets.Osu public enum OsuAction { - [Description("Left Button")] + [Description("Left button")] LeftButton, - [Description("Right Button")] + [Description("Right button")] RightButton } } diff --git a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs index dc683ae2f5..3b430e7ad1 100644 --- a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs +++ b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs @@ -17,13 +17,13 @@ namespace osu.Game.Rulesets.Taiko public enum TaikoAction { - [Description("Left (Rim)")] + [Description("Left (rim)")] LeftRim, - [Description("Left (Centre)")] + [Description("Left (centre)")] LeftCentre, - [Description("Right (Centre)")] + [Description("Right (centre)")] RightCentre, - [Description("Right (Rim)")] + [Description("Right (rim)")] RightRim } } diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index b21deff509..2f5f1aea3f 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -71,17 +71,17 @@ namespace osu.Game.Input.Bindings ToggleSettings, [Description("Toggle osu!direct")] ToggleDirect, - [Description("Increase Volume")] + [Description("Increase volume")] IncreaseVolume, - [Description("Decrease Volume")] + [Description("Decrease volume")] DecreaseVolume, [Description("Toggle mute")] ToggleMute, // In-Game Keybindings - [Description("Skip Cutscene")] + [Description("Skip cutscene")] SkipCutscene, - [Description("Quick Retry (Hold)")] + [Description("Quick retry (hold)")] QuickRetry, [Description("Take screenshot")] diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 0fe41327db..da96c6ef30 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { new SettingsSlider { - LabelText = "Audio Offset", + LabelText = "Audio offset", Bindable = config.GetBindable(OsuSetting.AudioOffset), KeyboardStep = 1f }, diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 369c751448..fa4a714ba3 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio Children = new Drawable[] { new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, - new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs index 456d1c9a2f..51b0296ca4 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input { new SettingsButton { - Text = "Key Configuration", + Text = "Key configuration", Action = keyConfig.ToggleVisibility }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 71ab4d3782..a3ed66d547 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -26,12 +26,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input { new SettingsCheckbox { - LabelText = "Raw Input", + LabelText = "Raw input", Bindable = rawInputToggle }, sensitivity = new SensitivitySetting { - LabelText = "Cursor Sensitivity", + LabelText = "Cursor sensitivity", Bindable = config.GetBindable(FrameworkSetting.CursorSensitivity) }, new SettingsCheckbox diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a274d9b12f..c7030b9db9 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Objects.Drawables public event Action ApplyCustomUpdateState; /// - /// Plays all the hitsounds for this . + /// Plays all the hit sounds for this . /// public void PlaySamples() => Samples?.Play(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs index 4fe727cb84..d0db8f8835 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs @@ -6,19 +6,19 @@ namespace osu.Game.Rulesets.UI.Scrolling public enum ScrollingDirection { /// - /// Hitobjects will scroll vertically from the bottom of the hitobject container. + /// Hit objects will scroll vertically from the bottom of the hitobject container. /// Up, /// - /// Hitobjects will scroll vertically from the top of the hitobject container. + /// Hit objects will scroll vertically from the top of the hitobject container. /// Down, /// - /// Hitobjects will scroll horizontally from the right of the hitobject container. + /// Hit objects will scroll horizontally from the right of the hitobject container. /// Left, /// - /// Hitobjects will scroll horizontally from the left of the hitobject container. + /// Hit objects will scroll horizontally from the left of the hitobject container. /// Right } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 6cd7fd52d4..6d5bfe9ae6 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Components new OsuSpriteText { Origin = Anchor.BottomLeft, - Text = "Playback Speed", + Text = "Playback speed", RelativePositionAxes = Axes.Y, Y = 0.5f, Padding = new MarginPadding { Left = 45 } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs index 006317e57e..ecf760be8e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineArea.cs @@ -59,8 +59,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline Spacing = new Vector2(0, 4), Children = new[] { - hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hitobjects" }, - hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hitsounds" }, + hitObjectsCheckbox = new OsuCheckbox { LabelText = "Hit objects" }, + hitSoundsCheckbox = new OsuCheckbox { LabelText = "Hit sounds" }, waveformCheckbox = new OsuCheckbox { LabelText = "Waveform" } } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 439e344020..f762597e81 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Play.PlayerSettings }, showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" }, beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" }, - beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" } + beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hit sounds" } }; } diff --git a/osu.Game/Screens/Select/Filter/GroupMode.cs b/osu.Game/Screens/Select/Filter/GroupMode.cs index 6e57843dfc..b3bd73ee59 100644 --- a/osu.Game/Screens/Select/Filter/GroupMode.cs +++ b/osu.Game/Screens/Select/Filter/GroupMode.cs @@ -21,8 +21,8 @@ namespace osu.Game.Screens.Select.Filter DateAdded, [Description("Difficulty")] Difficulty, - [Description("Favorites")] - Favorites, + [Description("Favourites")] + Favourites, [Description("Length")] Length, [Description("My Maps")] diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 2c43b333aa..917a08d172 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); - BeatmapOptions.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, colours.Yellow, () => + BeatmapOptions.AddButton(@"Edit", @"beatmap", FontAwesome.fa_pencil, colours.Yellow, () => { ValidForResume = false; Push(new Editor()); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index efdf55e477..2d497a22a4 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -205,7 +205,7 @@ namespace osu.Game.Screens.Select Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); - BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); + BeatmapOptions.AddButton(@"Delete", @"beatmapset", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); } if (this.beatmaps == null) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index cdec8c042f..4f469ae593 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -41,7 +41,7 @@ namespace osu.Game.Storyboards.Drawables { base.Update(); - // TODO: this logic will need to be consolidated with other game samples like hitsounds. + // TODO: this logic will need to be consolidated with other game samples like hit sounds. if (Time.Current < sample.Time) { // We've rewound before the start time of the sample From d855e5957a331eadd9b798f54d22d4cd27445b56 Mon Sep 17 00:00:00 2001 From: Fayne Aldan Date: Sat, 15 Sep 2018 16:16:37 -0600 Subject: [PATCH 03/92] Don't wiggle repeat points independently --- osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs index 2e601c9078..e0a93453ce 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModWiggle.cs @@ -37,6 +37,11 @@ namespace osu.Game.Rulesets.Osu.Mods var osuObject = (OsuHitObject)drawable.HitObject; Vector2 origin = drawable.Position; + // Wiggle the repeat points with the slider instead of independently. + // Also fixes an issue with repeat points being positioned incorrectly. + if (osuObject is RepeatPoint) + return; + Random objRand = new Random((int)osuObject.StartTime); // Wiggle all objects during TimePreempt From e3cc25a96a32735dc00bdbb983c632dd020f8013 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Tue, 18 Sep 2018 20:21:10 +0200 Subject: [PATCH 04/92] 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 05/92] 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 06/92] 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 e7d78b94ae1d9700bd80a9844516c3db5c73a6dc Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Wed, 19 Sep 2018 18:30:25 +0200 Subject: [PATCH 07/92] 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 08/92] 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 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 09/92] 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 52877eca8342939b4b7fe163d0ce8f28da431b91 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 20:01:04 -0400 Subject: [PATCH 10/92] 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 11/92] 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 12/92] 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 13/92] 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 eaf7697b85bbcd1bff590daf7a9cf1d83e333ef8 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Thu, 20 Sep 2018 23:21:27 -0400 Subject: [PATCH 14/92] 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 dafbabec31de7bc6e91b83f53b6edf41e30219df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Sep 2018 21:08:21 +0900 Subject: [PATCH 15/92] 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 16/92] 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 17/92] 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 18/92] 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 19/92] 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 20/92] 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 21/92] 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 22/92] 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 23/92] 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 24/92] 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 25/92] 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 26/92] 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 27/92] 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 28/92] 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 29/92] 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 30/92] 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 31/92] 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 32/92] 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 33/92] 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 34/92] 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 35/92] 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 36/92] 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 37/92] 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 38/92] 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 39/92] 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 40/92] 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 88b0c234cc370f536e81e21c3d3b7566e6f1075e Mon Sep 17 00:00:00 2001 From: Kyle Chang Date: Fri, 28 Sep 2018 23:27:25 -0400 Subject: [PATCH 41/92] Move judgement text to internal container --- .../UI/DrawableManiaJudgement.cs | 7 ++-- .../UI/DrawableTaikoJudgement.cs | 4 +- .../Rulesets/Judgements/DrawableJudgement.cs | 41 +++++++++++-------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index dc66249cd9..f78cfefab8 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -30,10 +30,11 @@ namespace osu.Game.Rulesets.Mania.UI if (Result.IsHit) { - this.ScaleTo(0.8f); - this.ScaleTo(1, 250, Easing.OutElastic); + JudgementBody.ScaleTo(0.8f); + JudgementBody.ScaleTo(1, 250, Easing.OutElastic); - this.Delay(50).FadeOut(200).ScaleTo(0.75f, 250); + JudgementBody.Delay(50).ScaleTo(0.75f, 250); + this.Delay(50).FadeOut(200); } Expire(); diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs index 4d660918b8..c7eba91564 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoJudgement.cs @@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Taiko.UI switch (Result.Type) { case HitResult.Good: - Colour = colours.GreenLight; + JudgementBody.Colour = colours.GreenLight; break; case HitResult.Great: - Colour = colours.BlueLight; + JudgementBody.Colour = colours.BlueLight; break; } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index c2a52e5794..fc006b4b36 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Judgements /// /// A drawable object which visualises the hit result of a . /// - public class DrawableJudgement : Container + public class DrawableJudgement : CompositeDrawable { private const float judgement_size = 80; @@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Judgements public readonly DrawableHitObject JudgedObject; + protected Container JudgementBody; protected SpriteText JudgementText; /// @@ -49,14 +50,20 @@ namespace osu.Game.Rulesets.Judgements { this.colours = colours; - Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText + InternalChild = JudgementBody = new Container { - Text = Result.Type.GetDescription().ToUpperInvariant(), - Font = @"Venera", - Colour = judgementColour(Result.Type), - Scale = new Vector2(0.85f, 1), - TextSize = 12 - }, restrictSize: false); + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + + Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText + { + Text = Result.Type.GetDescription().ToUpperInvariant(), + Font = @"Venera", + Colour = judgementColour(Result.Type), + Scale = new Vector2(0.85f, 1), + TextSize = 12 + }, restrictSize: false) + }; } protected override void LoadComplete() @@ -65,24 +72,22 @@ 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(origScale * 1.6f); - this.ScaleTo(origScale, 100, Easing.In); + JudgementBody.ScaleTo(1.6f); + JudgementBody.ScaleTo(1, 100, Easing.In); - this.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); - this.RotateTo(40, 800, Easing.InQuint); + JudgementBody.MoveToOffset(new Vector2(0, 100), 800, Easing.InQuint); + JudgementBody.RotateTo(40, 800, Easing.InQuint); this.Delay(600).FadeOut(200); break; default: - this.ScaleTo(origScale * 0.9f); - this.ScaleTo(origScale, 500, Easing.OutElastic); + JudgementBody.ScaleTo(0.9f); + JudgementBody.ScaleTo(1, 500, Easing.OutElastic); this.Delay(100).FadeOut(400); break; @@ -105,9 +110,9 @@ namespace osu.Game.Rulesets.Judgements return colours.Yellow; case HitResult.Miss: return colours.Red; + default: + return Color4.White; } - - return Color4.White; } } } From 08f58047c2182e49c6794d30d12bc60107dd9832 Mon Sep 17 00:00:00 2001 From: Hanamuke Date: Sun, 30 Sep 2018 16:08:17 +0200 Subject: [PATCH 42/92] 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); From b68eeae777858fbc14670386615abc9790174074 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 1 Oct 2018 18:12:26 +0900 Subject: [PATCH 43/92] Fix scrolling rulesets not accounting for slider multiplier --- .../Rulesets/Timing/MultiplierControlPoint.cs | 21 +++++++------------ .../UI/Scrolling/ScrollingRulesetContainer.cs | 20 ++---------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs index a5bd6bfde7..4988bac5ce 100644 --- a/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs +++ b/osu.Game/Rulesets/Timing/MultiplierControlPoint.cs @@ -18,9 +18,14 @@ namespace osu.Game.Rulesets.Timing public double StartTime; /// - /// The multiplier which this provides. + /// The aggregate multiplier which this provides. /// - public double Multiplier => 1000 / TimingPoint.BeatLength * DifficultyPoint.SpeedMultiplier; + public double Multiplier => Velocity * DifficultyPoint.SpeedMultiplier * 1000 / TimingPoint.BeatLength; + + /// + /// The velocity multiplier. + /// + public double Velocity = 1; /// /// The that provides the timing information for this . @@ -48,18 +53,6 @@ namespace osu.Game.Rulesets.Timing StartTime = startTime; } - /// - /// Creates a by copying another . - /// - /// The start time of this . - /// The to copy. - public MultiplierControlPoint(double startTime, MultiplierControlPoint other) - : this(startTime) - { - TimingPoint = other.TimingPoint; - DifficultyPoint = other.DifficultyPoint; - } - // ReSharper disable once ImpureMethodCallOnReadonlyValueField public int CompareTo(MultiplierControlPoint other) => StartTime.CompareTo(other?.StartTime); } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs index 3fc67e4e34..41cdd6c06f 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs @@ -60,6 +60,7 @@ namespace osu.Game.Rulesets.UI.Scrolling return new MultiplierControlPoint(c.Time) { + Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier, TimingPoint = lastTimingPoint, DifficultyPoint = lastDifficultyPoint }; @@ -78,7 +79,7 @@ namespace osu.Game.Rulesets.UI.Scrolling // If we have no control points, add a default one if (DefaultControlPoints.Count == 0) - DefaultControlPoints.Add(new MultiplierControlPoint()); + DefaultControlPoints.Add(new MultiplierControlPoint { Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier }); DefaultControlPoints.ForEach(c => applySpeedAdjustment(c, Playfield)); } @@ -88,22 +89,5 @@ namespace osu.Game.Rulesets.UI.Scrolling playfield.HitObjects.AddControlPoint(controlPoint); playfield.NestedPlayfields?.OfType().ForEach(p => applySpeedAdjustment(controlPoint, p)); } - - /// - /// Generates a with the default timing change/difficulty change from the beatmap at a time. - /// - /// The time to create the control point at. - /// The default at . - public MultiplierControlPoint CreateControlPointAt(double time) - { - if (DefaultControlPoints.Count == 0) - return new MultiplierControlPoint(time); - - int index = DefaultControlPoints.BinarySearch(new MultiplierControlPoint(time)); - if (index < 0) - return new MultiplierControlPoint(time); - - return new MultiplierControlPoint(time, DefaultControlPoints[index]); - } } } From 6c55efdf2030f0c9e9ea53d15f11ae7f81cbd0cb Mon Sep 17 00:00:00 2001 From: AtomCrafty Date: Mon, 1 Oct 2018 13:12:34 +0200 Subject: [PATCH 44/92] Add true to BindValueChanged call to hide resolution dropdown when starting in windowed mode --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index df9370d0d8..254de6c6f7 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } else resolutionDropdown.Hide(); - }); + }, true); } letterboxing.BindValueChanged(isVisible => From 87d8945af915b851ab6add3cc4428296d92e41a0 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 2 Oct 2018 09:33:31 +0900 Subject: [PATCH 45/92] Give the body a size --- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index fc006b4b36..e8e775a20d 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Judgements { Anchor = Anchor.Centre, Origin = Anchor.Centre, - + RelativeSizeAxes = Axes.Both, Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText { Text = Result.Type.GetDescription().ToUpperInvariant(), From 97c585c54cde6cac63fb1a9aa205cf45479e9593 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 2 Oct 2018 10:12:07 +0900 Subject: [PATCH 46/92] Fix cursor not hiding in screenshots --- osu.Game/OsuGame.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 8610a8d74d..b75a37e9df 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -65,7 +65,8 @@ namespace osu.Game private BeatmapSetOverlay beatmapSetOverlay; - private ScreenshotManager screenshotManager; + [Cached] + private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); protected RavenLogger RavenLogger; @@ -289,9 +290,6 @@ namespace osu.Game protected override void LoadComplete() { - // this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer. - dependencies.Cache(screenshotManager = new ScreenshotManager()); - base.LoadComplete(); // The next time this is updated is in UpdateAfterChildren, which occurs too late and results From 99fc04c8afac7aedc028026642b48626915db55a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 12:02:47 +0900 Subject: [PATCH 47/92] Change signature to new event handler --- .../Objects/Drawables/Pieces/SliderBall.cs | 16 +++--- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 8 +-- osu.Game.Rulesets.Osu/OsuInputManager.cs | 16 +++--- .../UI/Cursor/CursorTrail.cs | 10 ++-- osu.Game.Tests/Visual/TestCaseCursors.cs | 8 +-- .../Containers/OsuFocusedOverlayContainer.cs | 6 +- .../Graphics/Containers/OsuHoverContainer.cs | 10 ++-- .../Graphics/Containers/OsuScrollContainer.cs | 22 ++++---- osu.Game/Graphics/Cursor/MenuCursor.cs | 25 ++++----- .../Graphics/UserInterface/DialogButton.cs | 14 ++--- .../UserInterface/ExternalLinkButton.cs | 12 ++-- .../Graphics/UserInterface/FocusedTextBox.cs | 13 ++--- .../UserInterface/HoverClickSounds.cs | 6 +- .../Graphics/UserInterface/HoverSounds.cs | 6 +- osu.Game/Graphics/UserInterface/IconButton.cs | 10 ++-- .../UserInterface/OsuAnimatedButton.cs | 23 ++++---- osu.Game/Graphics/UserInterface/OsuButton.cs | 19 +++---- .../Graphics/UserInterface/OsuCheckbox.cs | 10 ++-- osu.Game/Graphics/UserInterface/OsuMenu.cs | 14 ++--- .../UserInterface/OsuPasswordTextBox.cs | 17 +++--- .../Graphics/UserInterface/OsuSliderBar.cs | 19 +++---- .../Graphics/UserInterface/OsuTabControl.cs | 14 ++--- .../UserInterface/OsuTabControlCheckbox.cs | 10 ++-- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 10 ++-- .../Graphics/UserInterface/PageTabControl.cs | 6 +- .../Graphics/UserInterface/SearchTextBox.cs | 13 ++--- .../Graphics/UserInterface/TwoLayerButton.cs | 13 ++--- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 18 +++--- .../BeatmapSet/Buttons/PreviewButton.cs | 10 ++-- .../BeatmapSet/Scores/ClickableUsername.cs | 4 +- .../BeatmapSet/Scores/DrawableScore.cs | 12 ++-- .../BeatmapSet/Scores/DrawableTopScore.cs | 10 ++-- osu.Game/Overlays/BeatmapSetOverlay.cs | 4 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 8 +-- .../Overlays/Chat/ChannelSelectionOverlay.cs | 6 +- osu.Game/Overlays/Chat/ChatTabControl.cs | 27 +++++---- osu.Game/Overlays/ChatOverlay.cs | 20 +++---- osu.Game/Overlays/Dialog/PopupDialog.cs | 11 ++-- osu.Game/Overlays/Direct/DirectGridPanel.cs | 8 +-- osu.Game/Overlays/Direct/DirectPanel.cs | 12 ++-- osu.Game/Overlays/Direct/PlayButton.cs | 12 ++-- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 56 +++++++++---------- osu.Game/Overlays/MainSettings.cs | 11 ++-- osu.Game/Overlays/MedalOverlay.cs | 9 ++- osu.Game/Overlays/Mods/ModButton.cs | 11 ++-- osu.Game/Overlays/Mods/ModSection.cs | 9 ++- osu.Game/Overlays/Music/PlaylistItem.cs | 19 +++---- osu.Game/Overlays/Music/PlaylistList.cs | 20 +++---- osu.Game/Overlays/MusicController.cs | 18 +++--- .../Overlays/Notifications/Notification.cs | 20 +++---- .../Overlays/Profile/Header/BadgeContainer.cs | 6 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 18 +++--- .../Profile/Sections/DrawableProfileRow.cs | 10 ++-- .../Profile/Sections/Kudosu/KudosuInfo.cs | 4 +- .../SearchableList/SearchableListOverlay.cs | 4 +- .../Sections/General/LoginSettings.cs | 12 ++-- .../Settings/Sections/Input/MouseSettings.cs | 10 ++-- osu.Game/Overlays/Settings/SettingsItem.cs | 13 ++--- osu.Game/Overlays/Settings/Sidebar.cs | 12 ++-- osu.Game/Overlays/Settings/SidebarButton.cs | 14 ++--- osu.Game/Overlays/SettingsOverlay.cs | 6 +- osu.Game/Overlays/Social/SocialPanel.cs | 10 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 6 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 15 +++-- .../Toolbar/ToolbarRulesetSelector.cs | 11 ++-- osu.Game/Overlays/Volume/MuteButton.cs | 8 +-- osu.Game/Overlays/Volume/VolumeMeter.cs | 10 ++-- osu.Game/Overlays/VolumeOverlay.cs | 12 ++-- osu.Game/Rulesets/Edit/HitObjectMask.cs | 16 +++--- osu.Game/Rulesets/UI/RulesetInputManager.cs | 12 ++-- osu.Game/Screens/BackgroundScreen.cs | 5 +- .../Edit/Components/PlaybackControl.cs | 6 +- .../Timelines/Summary/Parts/MarkerPart.cs | 13 ++--- osu.Game/Screens/Edit/Editor.cs | 6 +- osu.Game/Screens/Edit/Menus/EditorMenuBar.cs | 10 ++-- .../Screens/Compose/BeatDivisorControl.cs | 22 ++++---- .../Edit/Screens/Compose/Layers/DragLayer.cs | 12 ++-- .../Compose/Layers/HitObjectMaskLayer.cs | 5 +- .../RadioButtons/DrawableRadioButton.cs | 6 +- .../Edit/Screens/Compose/Timeline/Timeline.cs | 11 ++-- .../Timeline/ZoomableScrollContainer.cs | 10 ++-- osu.Game/Screens/Menu/Button.cs | 23 ++++---- osu.Game/Screens/Menu/MainMenu.cs | 9 ++- osu.Game/Screens/Menu/OsuLogo.cs | 17 +++--- .../Screens/Multi/Components/DrawableRoom.cs | 4 +- .../Screens/Multi/Screens/Lounge/Lounge.cs | 4 +- .../Screens/Multi/Screens/Match/Header.cs | 19 +++---- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 27 +++++---- osu.Game/Screens/Play/HUD/ModDisplay.cs | 10 ++-- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 11 ++-- osu.Game/Screens/Play/HUD/QuitButton.cs | 20 +++---- osu.Game/Screens/Play/HUDOverlay.cs | 11 ++-- osu.Game/Screens/Play/KeyCounterKeyboard.cs | 15 +++-- osu.Game/Screens/Play/KeyCounterMouse.cs | 15 +++-- osu.Game/Screens/Play/Player.cs | 4 +- osu.Game/Screens/Play/PlayerLoader.cs | 10 ++-- .../PlayerSettings/PlayerSettingsGroup.cs | 11 ++-- osu.Game/Screens/Play/SkipOverlay.cs | 35 ++++++------ osu.Game/Screens/Select/BeatmapCarousel.cs | 9 ++- .../Carousel/DrawableCarouselBeatmap.cs | 6 +- .../Select/Carousel/DrawableCarouselItem.cs | 12 ++-- osu.Game/Screens/Select/FilterControl.cs | 9 ++- osu.Game/Screens/Select/Footer.cs | 7 +-- osu.Game/Screens/Select/FooterButton.cs | 25 ++++----- .../Select/Leaderboards/LeaderboardScore.cs | 10 ++-- .../RetrievalFailurePlaceholder.cs | 11 ++-- .../Select/Options/BeatmapOptionsButton.cs | 19 +++---- osu.Game/Screens/Select/SongSelect.cs | 15 +++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 6 +- osu.Game/osu.Game.csproj | 2 +- 110 files changed, 667 insertions(+), 709 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 1388b23fa8..c19bbc439d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -5,7 +5,7 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; @@ -104,22 +104,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private InputState lastState; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { lastState = state; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { lastState = state; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - lastState = state; - return base.OnMouseMove(state); + lastState = e; + return base.OnMouseMove(e); } public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 6e5bc5258b..7a577383ae 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -68,10 +68,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - mousePosition = Parent.ToLocalSpace(state.Mouse.NativeState.Position); - return base.OnMouseMove(state); + mousePosition = Parent.ToLocalSpace(e.Mouse.NativeState.Position); + return base.OnMouseMove(e); } private Vector2 mousePosition; diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index e7bbe755a0..70b35fbd96 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Rulesets.UI; @@ -36,13 +36,13 @@ namespace osu.Game.Rulesets.Osu { } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => AllowUserPresses && base.OnKeyDown(state, args); - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) => AllowUserPresses && base.OnKeyUp(state, args); - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(state, args); - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(state, args); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => AllowUserPresses && base.OnMouseDown(state, args); - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => AllowUserPresses && base.OnMouseUp(state, args); - protected override bool OnScroll(InputState state) => AllowUserPresses && base.OnScroll(state); + protected override bool OnKeyDown(KeyDownEvent e) => AllowUserPresses && base.OnKeyDown(e); + protected override bool OnKeyUp(KeyUpEvent e) => AllowUserPresses && base.OnKeyUp(e); + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(args); + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(args); + protected override bool OnMouseDown(MouseDownEvent e) => AllowUserPresses && base.OnMouseDown(e); + protected override bool OnMouseUp(MouseUpEvent e) => AllowUserPresses && base.OnMouseUp(e); + protected override bool OnScroll(ScrollEvent e) => AllowUserPresses && base.OnScroll(e); } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 60c24a6fbd..8a701f1afc 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Framework.Input; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using OpenTK; using OpenTK.Graphics; @@ -117,15 +117,15 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor timeOffset = Time.Current; } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - Vector2 pos = state.Mouse.NativeState.Position; + Vector2 pos = e.Mouse.NativeState.Position; if (lastPosition == null) { lastPosition = pos; resampler.AddPosition(lastPosition.Value); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } foreach (Vector2 pos2 in resampler.AddPosition(pos)) @@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } } - return base.OnMouseMove(state); + return base.OnMouseMove(e); } private void addPosition(Vector2 pos) diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index d4c409b144..cdb6b8c1f8 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; @@ -224,16 +224,16 @@ namespace osu.Game.Tests.Visual }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeTo(0.4f, 250, Easing.OutQuint); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeTo(0.1f, 250); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index a143c056ff..14f18e554d 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Input.Bindings; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Input.Bindings; using osu.Game.Overlays; @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.Containers // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) { @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnClick(state); + return base.OnClick(e); } public virtual bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index 12df19e7c0..577d889be3 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.Containers { @@ -18,16 +18,16 @@ namespace osu.Game.Graphics.Containers protected virtual IEnumerable EffectTargets => new[] { Content }; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { EffectTargets.ForEach(d => d.FadeColour(HoverColour, 500, Easing.OutQuint)); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { EffectTargets.ForEach(d => d.FadeColour(IdleColour, 500, Easing.OutQuint)); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 6d42be6fca..5c5c42ba70 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using OpenTK.Input; @@ -29,7 +29,7 @@ namespace osu.Game.Graphics.Containers protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (shouldPerformRightMouseScroll(state)) { @@ -37,32 +37,32 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { if (mouseScrollBarDragging) { - scrollToRelative(state.Mouse.Position[ScrollDim]); + scrollToRelative(e.Mouse.Position[ScrollDim]); return true; } - return base.OnDrag(state); + return base.OnDrag(e); } - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - if (shouldPerformRightMouseScroll(state)) + if (shouldPerformRightMouseScroll(e)) { mouseScrollBarDragging = true; return true; } - return base.OnDragStart(state); + return base.OnDragStart(e); } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { if (mouseScrollBarDragging) { @@ -70,7 +70,7 @@ namespace osu.Game.Graphics.Containers return true; } - return base.OnDragEnd(state); + return base.OnDragEnd(e); } } } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index b55e1aa5dd..a34a7c53d0 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -12,8 +12,7 @@ using osu.Game.Configuration; using System; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; namespace osu.Game.Graphics.Cursor @@ -40,11 +39,11 @@ namespace osu.Game.Graphics.Cursor screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { if (dragRotationState != DragRotationState.NotDragging) { - var position = state.Mouse.Position; + var position = e.Mouse.Position; var distance = Vector2Extensions.Distance(position, positionMouseDown); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. @@ -53,7 +52,7 @@ namespace osu.Game.Graphics.Cursor // don't rotate when distance is zero to avoid NaN if (dragRotationState == DragRotationState.Rotating && distance > 0) { - Vector2 offset = state.Mouse.Position - positionMouseDown; + Vector2 offset = e.Mouse.Position - positionMouseDown; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance @@ -66,13 +65,13 @@ namespace osu.Game.Graphics.Cursor } } - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { // only trigger animation for main mouse buttons - if (args.Button <= MouseButton.Right) + if (e.Button <= MouseButton.Right) { activeCursor.Scale = new Vector2(1); activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint); @@ -81,15 +80,15 @@ namespace osu.Game.Graphics.Cursor activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); } - if (args.Button == MouseButton.Left && cursorRotate) + if (e.Button == MouseButton.Left && cursorRotate) { dragRotationState = DragRotationState.DragStarted; positionMouseDown = state.Mouse.Position; } - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { if (!state.Mouse.HasMainButtonPressed) { @@ -97,13 +96,13 @@ namespace osu.Game.Graphics.Cursor activeCursor.ScaleTo(1, 500, Easing.OutElastic); } - if (args.Button == MouseButton.Left) + if (e.Button == MouseButton.Left) { if (dragRotationState == DragRotationState.Rotating) activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); dragRotationState = DragRotationState.NotDragging; } - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override void PopIn() diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 5094062fae..b2220267ff 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -213,7 +213,7 @@ namespace osu.Game.Graphics.UserInterface public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { colourContainer.ResizeTo(new Vector2(1.5f, 1f), click_duration, Easing.In); flash(); @@ -225,20 +225,20 @@ namespace osu.Game.Graphics.UserInterface glowContainer.FadeOut(); }); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { - base.OnHover(state); + base.OnHover(e); Selected.Value = true; return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); Selected.Value = false; } diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index fe8995f310..d82448e8a2 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; using OpenTK; using OpenTK.Graphics; @@ -37,19 +37,19 @@ namespace osu.Game.Graphics.UserInterface this.host = host; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if(Link != null) host.OpenUrlExternally(Link); diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 18ec35c76e..122ac7b627 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -3,8 +3,7 @@ using OpenTK.Graphics; using System; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; using OpenTK.Input; @@ -36,20 +35,20 @@ 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 HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { - base.OnFocus(state); + base.OnFocus(e); BorderThickness = 0; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!HasFocus) return false; - if (args.Key == Key.Escape) + if (e.Key == Key.Escape) return false; // disable the framework-level handling of escape key for confority (we use GlobalAction.Back). - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public override bool OnPressed(GlobalAction action) diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 27a06ba0b7..3641e251bc 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -21,10 +21,10 @@ namespace osu.Game.Graphics.UserInterface { } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { sampleClick?.Play(); - return base.OnClick(state); + return base.OnClick(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index 821305bc92..710948121e 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -28,10 +28,10 @@ namespace osu.Game.Graphics.UserInterface RelativeSizeAxes = Axes.Both; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); - return base.OnHover(state); + return base.OnHover(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index be60812ba6..f10f03873d 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -4,7 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -84,16 +84,16 @@ namespace osu.Game.Graphics.UserInterface }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(IconHoverColour, 500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(IconColour, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 4428a058db..4516d7ce76 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -6,8 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using OpenTK.Graphics; @@ -77,34 +76,34 @@ namespace osu.Game.Graphics.UserInterface Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hover.FadeIn(500, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hover.FadeOut(500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { hover.FlashColour(FlashColour, 800, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Content.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index bb6a032a12..ab880cd473 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -7,8 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; @@ -56,28 +55,28 @@ namespace osu.Game.Graphics.UserInterface this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hover.FadeIn(200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hover.FadeOut(200); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Content.ScaleTo(0.9f, 4000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override SpriteText CreateText() => new OsuSpriteText diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 68f59bd8cd..e267a7f848 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; @@ -95,18 +95,18 @@ namespace osu.Game.Graphics.UserInterface }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Nub.Glowing = true; Nub.Expanded = true; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Nub.Glowing = false; Nub.Expanded = false; - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index abb077e94f..fe3e866a70 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using OpenTK; @@ -97,25 +97,25 @@ namespace osu.Game.Graphics.UserInterface } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover.Play(); text.BoldText.FadeIn(transition_length, Easing.OutQuint); text.NormalText.FadeOut(transition_length, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { text.BoldText.FadeOut(transition_length, Easing.OutQuint); text.NormalText.FadeIn(transition_length, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { sampleClick.Play(); - return base.OnClick(state); + return base.OnClick(e); } protected sealed override Drawable CreateContent() => text = CreateTextContainer(); diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 75655ddb36..f4ec67db23 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -9,8 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; namespace osu.Game.Graphics.UserInterface @@ -43,23 +42,23 @@ namespace osu.Game.Graphics.UserInterface this.host = host; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Key == Key.CapsLock) + if (e.Key == Key.CapsLock) updateCapsWarning(host.CapsLockEnabled); - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { updateCapsWarning(host.CapsLockEnabled); - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { updateCapsWarning(false); - base.OnFocusLost(state); + base.OnFocusLost(e); } private void updateCapsWarning(bool visible) => warning.FadeTo(visible ? 1 : 0, 250, Easing.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index b7b5319e06..eecc10469e 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -13,8 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -125,16 +124,16 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Pink; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Nub.Glowing = true; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Nub.Glowing = false; - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void OnUserChange() @@ -164,16 +163,16 @@ namespace osu.Game.Graphics.UserInterface sample.Play(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { Nub.Current.Value = true; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { Nub.Current.Value = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index e2a0b88b2a..24183e07a0 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -14,7 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; @@ -126,14 +126,14 @@ namespace osu.Game.Graphics.UserInterface Text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!Active) fadeActive(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Active) fadeInactive(); @@ -265,16 +265,16 @@ namespace osu.Game.Graphics.UserInterface Padding = new MarginPadding { Left = 5, Right = 5 }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Foreground.Colour = BackgroundColour; - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Foreground.Colour = BackgroundColourHover; - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 04ba111153..1355ffdb8e 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -59,18 +59,18 @@ namespace osu.Game.Graphics.UserInterface text.FadeColour(AccentColour, transition_length, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { fadeIn(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Current) fadeOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 7a45ffdd4b..37464faa73 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Input.Bindings; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface @@ -44,17 +44,17 @@ namespace osu.Game.Graphics.UserInterface BorderColour = colour.Yellow; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { BorderThickness = 3; - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { BorderThickness = 0; - base.OnFocusLost(state); + base.OnFocusLost(e); } protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize }; diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index d203532f9c..fb7b4c5676 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface @@ -67,14 +67,14 @@ namespace osu.Game.Graphics.UserInterface box.Colour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!Active) slideActive(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Active) slideInactive(); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 6067481979..8aa3a3f663 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -2,8 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK; using OpenTK.Input; @@ -33,11 +32,11 @@ namespace osu.Game.Graphics.UserInterface PlaceholderText = "type to search"; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!state.Keyboard.ControlPressed && !state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Left: case Key.Right: @@ -49,7 +48,7 @@ namespace osu.Game.Graphics.UserInterface if (!AllowCommit) { - switch (args.Key) + switch (e.Key) { case Key.KeypadEnter: case Key.Enter: @@ -59,14 +58,14 @@ namespace osu.Game.Graphics.UserInterface if (state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Delete: return false; } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index 027ba67f66..2000eb47e4 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -13,8 +13,7 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; using System; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface { @@ -172,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos); - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.ResizeTo(SIZE_EXTENDED, transform_time, Easing.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, Easing.OutElastic); @@ -182,7 +181,7 @@ namespace osu.Game.Graphics.UserInterface return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.ResizeTo(SIZE_RETRACTED, transform_time, Easing.OutElastic); IconLayer.FadeColour(TextLayer.Colour, transform_time, Easing.OutElastic); @@ -190,12 +189,12 @@ namespace osu.Game.Graphics.UserInterface bouncingIcon.ScaleTo(1, transform_time, Easing.OutElastic); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { return true; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { var flash = new Box { @@ -209,7 +208,7 @@ namespace osu.Game.Graphics.UserInterface flash.FadeOut(500, Easing.OutQuint); flash.Expire(); - return base.OnClick(state); + return base.OnClick(e); } private class BouncingIcon : BeatSyncedContainer diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 8186bf8685..bd9d65ccd8 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -174,9 +174,9 @@ namespace osu.Game.Overlays.BeatmapSet { public Action OnLostHover; - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); OnLostHover?.Invoke(); } } @@ -241,24 +241,24 @@ namespace osu.Game.Overlays.BeatmapSet }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { fadeIn(); OnHovered?.Invoke(Beatmap); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (State == DifficultySelectorState.NotSelected) fadeOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { OnClicked?.Invoke(Beatmap); - return base.OnClick(state); + return base.OnClick(e); } private void fadeIn() diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index b3072a02d9..1988b7d222 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -89,16 +89,16 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons progress.Width = 0; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { bg.FadeColour(Color4.Black.Opacity(0.5f), 100); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { bg.FadeColour(Color4.Black.Opacity(0.25f), 100); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index dc350d2c4c..0be83db39e 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -53,7 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores this.profile = profile; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { profile?.ShowUser(user); return true; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index d9af81c19a..309d75f60a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; @@ -125,18 +125,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores background.Colour = colours.Gray4; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index a1ebab09b1..d954b48b86 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; @@ -184,16 +184,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores BorderColour = rankText.Colour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private class InfoColumn : FillFlowContainer diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index f66e103a21..23c8ec3aab 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -127,7 +127,7 @@ namespace osu.Game.Overlays FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 7a60bf9f47..8df29c89f2 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -155,15 +155,15 @@ namespace osu.Game.Overlays.Chat FinishTransforms(true); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (!channel.Joined.Value) name.FadeColour(hoverColour, 50, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!channel.Joined.Value) name.FadeColour(Color4.White, transition_duration); diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 4e4fe4f10a..a86465b77b 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; @@ -150,10 +150,10 @@ namespace osu.Game.Overlays.Chat headerBg.Colour = colours.Gray2.Opacity(0.75f); } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(search); - base.OnFocus(state); + base.OnFocus(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index d9327e73e8..ec4fd85901 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -17,8 +17,7 @@ using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using System; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat @@ -144,9 +143,9 @@ namespace osu.Game.Overlays.Chat textBold.FadeOut(transition_length, Easing.OutQuint); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button == MouseButton.Middle) + if (e.Button == MouseButton.Middle) { closeButton.Action(); return true; @@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Chat return false; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (IsRemovable) closeButton.FadeIn(200, Easing.OutQuint); @@ -165,7 +164,7 @@ namespace osu.Game.Overlays.Chat return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { closeButton.FadeOut(200, Easing.OutQuint); updateState(); @@ -291,28 +290,28 @@ namespace osu.Game.Overlays.Chat }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.5f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { icon.ScaleTo(0.75f, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(Color4.Red, 200, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.FadeColour(Color4.White, 200, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index dcf5b74d08..0424481f77 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics; @@ -191,25 +191,25 @@ namespace osu.Game.Overlays public void OpenChannel(Channel channel) => addChannel(channel); - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { isDragging = tabsArea.IsHovered; if (!isDragging) - return base.OnDragStart(state); + return base.OnDragStart(e); startDragChatHeight = ChatHeight.Value; return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { if (isDragging) { - Trace.Assert(state.Mouse.PositionMouseDown != null); + Trace.Assert(e.Mouse.PositionMouseDown != null); // ReSharper disable once PossibleInvalidOperationException - double targetChatHeight = startDragChatHeight - (state.Mouse.Position.Y - state.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; + double targetChatHeight = startDragChatHeight - (e.Mouse.Position.Y - e.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) @@ -221,10 +221,10 @@ namespace osu.Game.Overlays return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { isDragging = false; - return base.OnDragEnd(state); + return base.OnDragEnd(e); } public void APIStateChanged(APIAccess api, APIState state) @@ -242,11 +242,11 @@ namespace osu.Game.Overlays public override bool AcceptsFocus => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { //this is necessary as textbox is masked away and therefore can't get focus :( GetContainingInputManager().ChangeFocus(textbox); - base.OnFocus(state); + base.OnFocus(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index ccbb7cc496..f421d2202c 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -8,8 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; @@ -206,12 +205,12 @@ namespace osu.Game.Overlays.Dialog return base.OnPressed(action); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; // press button at number if 1-9 on number row or keypad are pressed - var k = args.Key; + var k = e.Key; if (k >= Key.Number1 && k <= Key.Number9) { pressButtonAtIndex(k - Key.Number1); @@ -224,7 +223,7 @@ namespace osu.Game.Overlays.Dialog return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } protected override void PopIn() diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 44b6a75d3c..6eef2fc500 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -227,15 +227,15 @@ namespace osu.Game.Overlays.Direct PreviewPlaying.ValueChanged += _ => updateStatusContainer(); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateStatusContainer(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); updateStatusContainer(); } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 2ee1857ca2..5c7c34a0ed 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -121,27 +121,27 @@ namespace osu.Game.Overlays.Direct } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); content.MoveToY(-4, hover_transition_time, Easing.OutQuint); if (FadePlayButton) PlayButton.FadeIn(120, Easing.InOutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); content.MoveToY(0, hover_transition_time, Easing.OutQuint); if (FadePlayButton && !PreviewPlaying) PlayButton.FadeOut(120, Easing.InOutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { ShowInformation(); return true; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 092c9ddbea..ac7a26fca3 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -93,23 +93,23 @@ namespace osu.Game.Overlays.Direct hoverColour = colour.Yellow; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Playing.Toggle(); return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { icon.FadeColour(hoverColour, 120, Easing.InOutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (!Playing.Value) icon.FadeColour(Color4.White, 120, Easing.InOutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void playingStateChanged(bool playing) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index d480bedc5e..fb17635806 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -125,18 +125,18 @@ namespace osu.Game.Overlays.KeyBinding } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { FadeEdgeEffectTo(1, transition_time, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { FadeEdgeEffectTo(0, transition_time, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } public override bool AcceptsFocus => bindTarget == null; @@ -149,16 +149,16 @@ namespace osu.Game.Overlays.KeyBinding private bool isModifier(Key k) => k < Key.F1; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (!HasFocus || !bindTarget.IsHovered) - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); if (!AllowMainMouseButtons) { - switch (args.Button) + switch (e.Button) { case MouseButton.Left: case MouseButton.Right: @@ -170,11 +170,11 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. if (!HasFocus || state.Mouse.Buttons.Any()) - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); if (bindTarget.IsHovered) finalise(); @@ -183,27 +183,27 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { if (HasFocus) { if (bindTarget.IsHovered) { - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state, state.Mouse.ScrollDelta)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e, e.Mouse.ScrollDelta)); finalise(); return true; } } - return base.OnScroll(state); + return base.OnScroll(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (!HasFocus) return false; - switch (args.Key) + switch (e.Key) { case Key.Delete: { @@ -219,14 +219,14 @@ namespace osu.Game.Overlays.KeyBinding } bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); - if (!isModifier(args.Key)) finalise(); + if (!isModifier(e.Key)) finalise(); return true; } - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + protected override bool OnKeyUp(KeyUpEvent e) { - if (!HasFocus) return base.OnKeyUp(state, args); + if (!HasFocus) return base.OnKeyUp(e); finalise(); return true; @@ -246,7 +246,7 @@ namespace osu.Game.Overlays.KeyBinding protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) { if (!HasFocus) - return base.OnJoystickRelease(state, args); + return base.OnJoystickRelease(args); finalise(); return true; @@ -273,7 +273,7 @@ namespace osu.Game.Overlays.KeyBinding pressAKey.BypassAutoSizeAxes |= Axes.Y; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { AutoSizeDuration = 500; AutoSizeEasing = Easing.OutQuint; @@ -282,13 +282,13 @@ namespace osu.Game.Overlays.KeyBinding pressAKey.BypassAutoSizeAxes &= ~Axes.Y; updateBindTarget(); - base.OnFocus(state); + base.OnFocus(e); } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { finalise(); - base.OnFocusLost(state); + base.OnFocusLost(e); } private void updateBindTarget() @@ -367,16 +367,16 @@ namespace osu.Game.Overlays.KeyBinding hoverColour = colours.YellowDark; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateHoverState(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { updateHoverState(); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void updateHoverState() diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index b22904e724..736843ee4d 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -6,8 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -138,16 +137,16 @@ namespace osu.Game.Overlays }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { aspect.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } public bool OnPressed(GlobalAction action) diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index bd67a718a7..7e0954899d 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -19,8 +19,7 @@ using osu.Framework.Graphics.Textures; using OpenTK.Input; using osu.Framework.Graphics.Shapes; using System; -using System.Linq; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; namespace osu.Game.Overlays @@ -176,15 +175,15 @@ namespace osu.Game.Overlays particleContainer.Add(new MedalParticle(RNG.Next(0, 359))); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { dismiss(); return true; } - protected override void OnFocusLost(InputState state) + protected override void OnFocusLost(FocusLostEvent e) { - if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + if (e.Keyboard.Keys.Contains(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 8024f9a732..40b9793be4 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -13,8 +13,7 @@ using osu.Game.Rulesets.UI; using System; using System.Linq; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Mods @@ -149,20 +148,20 @@ namespace osu.Game.Overlays.Mods public virtual Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { scaleContainer.ScaleTo(0.9f, 800, Easing.Out); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { scaleContainer.ScaleTo(1, 500, Easing.OutElastic); // only trigger the event if we are inside the area of the button if (Contains(ToScreenSpace(state.Mouse.Position - Position))) { - switch (args.Button) + switch (e.Button) { case MouseButton.Left: SelectNext(1); diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 37bffaaf12..3ba49042e5 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -10,8 +10,7 @@ using osu.Game.Rulesets.Mods; using System; using System.Linq; using System.Collections.Generic; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Mods { @@ -55,16 +54,16 @@ namespace osu.Game.Overlays.Mods private ModButton[] buttons = { }; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { if (ToggleKeys != null) { - var index = Array.IndexOf(ToggleKeys, args.Key); + var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public void DeselectAll() => DeselectTypes(buttons.Select(b => b.SelectedMod?.GetType()).Where(t => t != null)); diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index ee3f22290b..c0a59df767 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -8,8 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -37,16 +36,16 @@ namespace osu.Game.Overlays.Music public bool IsDraggable { get; private set; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { IsDraggable = handle.IsHovered; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { IsDraggable = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } private bool selected; @@ -123,19 +122,19 @@ namespace osu.Game.Overlays.Music }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { handle.FadeIn(fade_duration); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { handle.FadeOut(fade_duration); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { OnSelect?.Invoke(BeatmapSetInfo); return true; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 32674f0a84..48c07846b8 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using OpenTK; @@ -115,25 +115,25 @@ namespace osu.Game.Overlays.Music private Vector2 nativeDragPosition; private PlaylistItem draggedItem; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; + nativeDragPosition = e.Mouse.NativeState.Position; draggedItem = items.FirstOrDefault(d => d.IsDraggable); - return draggedItem != null || base.OnDragStart(state); + return draggedItem != null || base.OnDragStart(e); } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; + nativeDragPosition = e.Mouse.NativeState.Position; if (draggedItem == null) - return base.OnDrag(state); + return base.OnDrag(e); return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { - nativeDragPosition = state.Mouse.NativeState.Position; - var handled = draggedItem != null || base.OnDragEnd(state); + nativeDragPosition = e.Mouse.NativeState.Position; + var handled = draggedItem != null || base.OnDragEnd(e); draggedItem = null; return handled; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 5cccb2b0aa..fc2fed890b 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -459,18 +459,18 @@ namespace osu.Game.Overlays { private Vector2 dragStart; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { - base.OnDragStart(state); - dragStart = state.Mouse.Position; + base.OnDragStart(e); + dragStart = e.Mouse.Position; return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - if (base.OnDrag(state)) return true; + if (base.OnDrag(e)) return true; - Vector2 change = state.Mouse.Position - dragStart; + Vector2 change = e.Mouse.Position - dragStart; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; @@ -479,10 +479,10 @@ namespace osu.Game.Overlays return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { this.MoveTo(Vector2.Zero, 800, Easing.OutElastic); - return base.OnDragEnd(state); + return base.OnDragEnd(e); } } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 6798ae2bb2..aa2b248bc4 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications @@ -118,19 +118,19 @@ namespace osu.Game.Overlays.Notifications }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { closeButton.FadeIn(75); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { closeButton.FadeOut(75); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Activated?.Invoke() ?? true) Close(); @@ -185,16 +185,16 @@ namespace osu.Game.Overlays.Notifications hoverColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.FadeColour(hoverColour, 200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.FadeColour(OsuColour.Gray(0.2f), 200); - base.OnHoverLost(state); + base.OnHoverLost(e); } } diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index 33baaf1fff..6a87db4211 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -153,13 +153,13 @@ namespace osu.Game.Overlays.Profile.Header this.hoverLostAction = hoverLostAction; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hoverAction(); return true; } - protected override void OnHoverLost(InputState state) => hoverLostAction(); + protected override void OnHoverLost(HoverLostEvent e) => hoverLostAction(); } private class DrawableBadge : Container, IHasTooltip diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index a059792796..2abfaa1a6d 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -137,25 +137,25 @@ namespace osu.Game.Overlays.Profile.Header relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago"; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (ranks?.Length > 1) { - graph.UpdateBallPosition(state.Mouse.Position.X); + graph.UpdateBallPosition(e.Mouse.Position.X); graph.ShowBall(); } - return base.OnHover(state); + return base.OnHover(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { if (ranks?.Length > 1) - graph.UpdateBallPosition(state.Mouse.Position.X); + graph.UpdateBallPosition(e.Mouse.Position.X); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (ranks?.Length > 1) { @@ -163,7 +163,7 @@ namespace osu.Game.Overlays.Profile.Header updateRankTexts(); } - base.OnHoverLost(state); + base.OnHoverLost(e); } private class RankChartLineGraph : LineGraph diff --git a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs index 3a4bfc6804..165299e8c0 100644 --- a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs +++ b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs @@ -6,7 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -105,20 +105,20 @@ namespace osu.Game.Overlays.Profile.Sections coloredBackground.Colour = underscoreLine.Colour = colour.Gray4; } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeIn(fade_duration, Easing.OutQuint); underscoreLine.FadeOut(fade_duration, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeOut(fade_duration, Easing.OutQuint); underscoreLine.FadeIn(fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 38bc419838..788041205b 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -70,7 +70,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu }; } - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; private class CountSection : Container { diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index f9e4a983bb..df249b0b88 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.SearchableList scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height }; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(Filter.Search); } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index c7f98f4107..11a3d36779 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -16,7 +16,7 @@ using System.ComponentModel; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; using Container = osu.Framework.Graphics.Containers.Container; @@ -175,12 +175,12 @@ namespace osu.Game.Overlays.Settings.Sections.General public override bool AcceptsFocus => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { if (form != null) GetContainingInputManager().ChangeFocus(form); - base.OnFocus(state); + base.OnFocus(e); } private class LoginForm : FillFlowContainer @@ -244,9 +244,9 @@ namespace osu.Game.Overlays.Settings.Sections.General public override bool AcceptsFocus => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); }); } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 71ab4d3782..2b643b6805 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; @@ -124,18 +124,18 @@ namespace osu.Game.Overlays.Settings.Sections.Input private bool isDragging; - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { isDragging = true; - return base.OnDragStart(state); + return base.OnDragStart(e); } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { isDragging = false; Current.TriggerChange(); - return base.OnDragEnd(state); + return base.OnDragEnd(e); } public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : Current.Value.ToString(@"0.##x"); diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 0f8d3aa2ac..4f947cd812 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -12,8 +12,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; @@ -168,25 +167,25 @@ namespace osu.Game.Overlays.Settings public string TooltipText => "Revert to default"; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseUp(MouseUpEvent e) => true; - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (bindable != null && !bindable.Disabled) bindable.SetDefault(); return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { hovering = true; UpdateState(); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hovering = false; UpdateState(); diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index fdda5b870e..862011b6e2 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -9,7 +9,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Overlays.Toolbar; @@ -55,25 +55,25 @@ namespace osu.Game.Overlays.Settings private ScheduledDelegate expandEvent; private ExpandedState state; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { queueExpandIfHovering(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { expandEvent?.Cancel(); lastHoveredButton = null; State = ExpandedState.Contracted; - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { queueExpandIfHovering(); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } private class SidebarScrollContainer : ScrollContainer diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 28e2b773ec..b6d1cf609e 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -109,22 +109,22 @@ namespace osu.Game.Overlays.Settings selectionIndicator.Colour = colours.Yellow; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Action?.Invoke(section); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Background.FadeTo(0.4f, 200); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Background.FadeTo(0, 200); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 83e121e998..c971ab5005 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; @@ -177,10 +177,10 @@ namespace osu.Game.Overlays public override bool AcceptsFocus => true; - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(searchTextBox); - base.OnFocus(state); + base.OnFocus(e); } protected override void UpdateAfterChildren() diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index b0455f7edd..cfee639d53 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Users; namespace osu.Game.Overlays.Social @@ -35,20 +35,20 @@ namespace osu.Game.Overlays.Social Colour = Color4.Black.Opacity(0.3f), }; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Content.TweenEdgeEffectTo(edgeEffectHovered, hover_transition_time, Easing.OutQuint); Content.MoveToY(-4, hover_transition_time, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { Content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); Content.MoveToY(0, hover_transition_time, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void LoadComplete() diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 3f44cb403a..611b42383e 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -11,7 +11,7 @@ using OpenTK; using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Overlays.Toolbar { @@ -121,14 +121,14 @@ namespace osu.Game.Overlays.Toolbar }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { solidBackground.FadeTo(alpha_hovering, transition_time, Easing.OutQuint); gradientBackground.FadeIn(transition_time, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { solidBackground.FadeTo(alpha_normal, transition_time, Easing.OutQuint); gradientBackground.FadeOut(transition_time, Easing.OutQuint); diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 74af5d7e9c..5cb26974e6 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -11,8 +11,7 @@ using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -145,22 +144,22 @@ namespace osu.Game.Overlays.Toolbar }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { HoverBackground.FlashColour(Color4.White.Opacity(100), 500, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { HoverBackground.FadeIn(200); tooltipContainer.FadeIn(100); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverBackground.FadeOut(200); tooltipContainer.FadeOut(100); diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 4b6fb366bb..aa55f8fa41 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -11,8 +11,7 @@ using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar @@ -86,13 +85,13 @@ namespace osu.Game.Overlays.Toolbar ruleset.BindTo(parentRuleset); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - base.OnKeyDown(state, args); + base.OnKeyDown(e); - if (state.Keyboard.ControlPressed && !args.Repeat && args.Key >= Key.Number1 && args.Key <= Key.Number9) + if (state.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { - int requested = args.Key - Key.Number1; + int requested = e.Key - Key.Number1; RulesetInfo found = rulesets.AvailableRulesets.Skip(requested).FirstOrDefault(); if (found != null) diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index 47169d7a7b..a099a10096 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; @@ -63,18 +63,18 @@ namespace osu.Game.Overlays.Volume Current.TriggerChange(); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.TransformTo("BorderColour", hoveredColour, 500, Easing.OutQuint); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.TransformTo("BorderColour", unhoveredColour, 500, Easing.OutQuint); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Current.Value = !Current.Value; return true; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index a6c98aa97e..daf45f71b4 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -239,21 +239,21 @@ namespace osu.Game.Overlays.Volume adjustAccumulator = 0; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - adjust(state.Mouse.ScrollDelta.Y, state.Mouse.HasPreciseScroll); + adjust(e.Mouse.ScrollDelta.Y, e.Mouse.HasPreciseScroll); return true; } private const float transition_length = 500; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.ScaleTo(1.04f, transition_length, Easing.OutExpo); return false; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.ScaleTo(1f, transition_length, Easing.OutExpo); } diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index bf1c81393d..d45d097a09 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; @@ -143,23 +143,23 @@ namespace osu.Game.Overlays this.FadeOut(100); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { // keep the scheduled event correctly timed as long as we have movement. schedulePopOut(); - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { schedulePopOut(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { schedulePopOut(); - base.OnHoverLost(state); + base.OnHoverLost(e); } private void schedulePopOut() diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 0ba67e1dca..a16c6d59dd 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -5,7 +5,7 @@ using System; using osu.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects.Drawables; @@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Edit private bool selectionRequested; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { selectionRequested = false; @@ -109,23 +109,23 @@ namespace osu.Game.Rulesets.Edit return IsSelected; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (State == SelectionState.Selected && !selectionRequested) { selectionRequested = true; - SelectionRequested?.Invoke(this, state); + SelectionRequested?.Invoke(this, e); return true; } - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnDragStart(InputState state) => true; + protected override bool OnDragStart(DragStartEvent e) => true; - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - DragRequested?.Invoke(this, state); + DragRequested?.Invoke(this, e); return true; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index af1dc98fec..91bb505724 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -211,16 +211,16 @@ namespace osu.Game.Rulesets.UI mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (mouseDisabled.Value && (args.Button == MouseButton.Left || args.Button == MouseButton.Right)) return false; - return base.OnMouseDown(state, args); + if (mouseDisabled.Value && (e.Button == MouseButton.Left || e.Button == MouseButton.Right)) return false; + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (!CurrentState.Mouse.IsPressed(args.Button)) return false; - return base.OnMouseUp(state, args); + if (!CurrentState.Mouse.IsPressed(e.Button)) return false; + return base.OnMouseUp(e); } #endregion diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 46d1260410..7787b4ddc2 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,8 +5,7 @@ using System; using System.Threading; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK; namespace osu.Game.Screens @@ -21,7 +20,7 @@ namespace osu.Game.Screens private const float transition_length = 500; private const float x_movement_amount = 50; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { //we don't want to handle escape key. return false; diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 6cd7fd52d4..c5b6251216 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -138,13 +138,13 @@ namespace osu.Game.Screens.Edit.Components textBold.Colour = hoveredColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { updateState(); return true; } - protected override void OnHoverLost(InputState state) => updateState(); + protected override void OnHoverLost(HoverLostEvent e) => updateState(); protected override void OnActivated() => updateState(); protected override void OnDeactivated() => updateState(); diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 7ff3849361..41ef2065da 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -6,8 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -30,15 +29,15 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts Add(marker = new MarkerVisualisation()); } - protected override bool OnDragStart(InputState state) => true; - protected override bool OnDragEnd(InputState state) => true; - protected override bool OnDrag(InputState state) + protected override bool OnDragStart(DragStartEvent e) => true; + protected override bool OnDragEnd(DragEndEvent e) => true; + protected override bool OnDrag(DragEvent e) { - seekToPosition(state.Mouse.NativeState.Position); + seekToPosition(e.Mouse.NativeState.Position); return true; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { seekToPosition(state.Mouse.NativeState.Position); return true; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7159cd919c..2cfcf4c415 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,7 @@ using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Platform; using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; @@ -182,9 +182,9 @@ namespace osu.Game.Screens.Edit LoadComponentAsync(currentScreen, screenContainer.Add); } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.ScrollDelta.X + state.Mouse.ScrollDelta.Y > 0) + if (e.Mouse.ScrollDelta.X + e.Mouse.ScrollDelta.Y > 0) clock.SeekBackward(!clock.IsRunning); else clock.SeekForward(!clock.IsRunning); diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs index c6351c8520..af0a7b6694 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Screens.Edit.Screens; namespace osu.Game.Screens.Edit.Menus @@ -171,18 +171,18 @@ namespace osu.Game.Screens.Edit.Menus { } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (Item is EditorMenuItemSpacer) return true; - return base.OnHover(state); + return base.OnHover(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Item is EditorMenuItemSpacer) return true; - return base.OnClick(state); + return base.OnClick(e); } } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 833c4464c3..2e1b2c1ac3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; +using osu.Framework.Input.Events; using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; @@ -233,9 +233,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose public override bool HandleNonPositionalInput => IsHovered && !CurrentNumber.Disabled; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - switch (args.Key) + switch (e.Key) { case Key.Right: beatDivisor.Next(); @@ -250,27 +250,27 @@ namespace osu.Game.Screens.Edit.Screens.Compose } } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { marker.Active = true; - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { marker.Active = false; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { - handleMouseInput(state); + handleMouseInput(e); return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - handleMouseInput(state); + handleMouseInput(e); return true; } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index c4392bbc60..6db272e2a4 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using OpenTK.Graphics; @@ -56,16 +56,16 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers }; } - protected override bool OnDragStart(InputState state) + protected override bool OnDragStart(DragStartEvent e) { this.FadeIn(250, Easing.OutQuint); return true; } - protected override bool OnDrag(InputState state) + protected override bool OnDrag(DragEvent e) { - var dragPosition = state.Mouse.NativeState.Position; - var dragStartPosition = state.Mouse.NativeState.PositionMouseDown ?? dragPosition; + var dragPosition = e.Mouse.NativeState.Position; + var dragStartPosition = e.Mouse.NativeState.PositionMouseDown ?? dragPosition; var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y); @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers return true; } - protected override bool OnDragEnd(InputState state) + protected override bool OnDragEnd(DragEndEvent e) { this.FadeOut(250, Easing.OutQuint); DragEnd?.Invoke(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index d212bbe7dd..65f31dd56d 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -4,8 +4,7 @@ using osu.Framework.Allocation; 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.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; @@ -52,7 +51,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers addMask(obj); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { maskContainer.DeselectAll(); return true; diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs index 803a1275d7..2c7e2043fc 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -99,7 +99,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons bubble.Colour = button.Selected ? selectedBubbleColour : defaultBubbleColour; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (button.Selected) return true; @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.RadioButtons button.Selected.Value = true; - return base.OnClick(state); + return base.OnClick(e); } protected override SpriteText CreateText() => new OsuSpriteText diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index 30205c5aa1..da95564975 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -7,8 +7,7 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -133,9 +132,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline ScrollTo((float)(adjustableClock.CurrentTime / track.Length) * Content.DrawWidth, false); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (base.OnMouseDown(state, args)) + if (base.OnMouseDown(e)) { beginUserDrag(); return true; @@ -144,10 +143,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline return false; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { endUserDrag(); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } private void beginUserDrag() diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index d30aaacc6a..6390f8dd96 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using OpenTK; @@ -97,13 +97,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline zoomedContent.Width = DrawWidth * currentZoom; } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.HasPreciseScroll) + if (e.Mouse.HasPreciseScroll) // for now, we don't support zoom when using a precision scroll device. this needs gesture support. - return base.OnScroll(state); + return base.OnScroll(e); - setZoomTarget(zoomTarget + state.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(state.Mouse.NativeState.Position).X); + setZoomTarget(zoomTarget + e.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.Mouse.NativeState.Position).X); return true; } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 38d74a3a4b..bf0e0418e9 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -17,8 +17,7 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Audio.Track; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Screens.Menu @@ -151,7 +150,7 @@ namespace osu.Game.Screens.Menu rightward = !rightward; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { if (State != ButtonState.Expanded) return true; @@ -167,7 +166,7 @@ namespace osu.Game.Screens.Menu return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { icon.ClearTransforms(); icon.RotateTo(0, 500, Easing.Out); @@ -186,30 +185,30 @@ namespace osu.Game.Screens.Menu sampleClick = audio.Sample.Get($@"Menu/{sampleName}"); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { boxHoverLayer.FadeTo(0.1f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { boxHoverLayer.FadeTo(0, 1000, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { trigger(); return true; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) + if (e.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) return false; - if (triggerKey == args.Key && triggerKey != Key.Unknown) + if (triggerKey == e.Key && triggerKey != Key.Unknown) { trigger(); return true; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 2dd6e1d7e1..ef86351760 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -6,8 +6,7 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -200,15 +199,15 @@ namespace osu.Game.Screens.Menu return base.OnExiting(next); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D) + if (!e.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 52354241d2..4e6a107f91 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,8 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; @@ -344,23 +343,23 @@ namespace osu.Game.Screens.Menu public override bool HandlePositionalInput => base.HandlePositionalInput && Action != null && Alpha > 0.2f; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (args.Button != MouseButton.Left) return false; + if (e.Button != MouseButton.Left) return false; logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button != MouseButton.Left) return false; + if (e.Button != MouseButton.Left) return false; logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); return true; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Action?.Invoke() ?? true) sampleClick.Play(); @@ -371,13 +370,13 @@ namespace osu.Game.Screens.Menu return true; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { logoHoverContainer.ScaleTo(1.1f, 500, Easing.OutElastic); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { logoHoverContainer.ScaleTo(1, 500, Easing.OutElastic); } diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 739346fabe..67db23263b 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -246,7 +246,7 @@ namespace osu.Game.Screens.Multi.Components this.FadeInFromZero(transition_duration); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Enabled.Value) { diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 1a47829ad7..3b3f789628 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -6,7 +6,7 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; @@ -112,7 +112,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge }; } - protected override void OnFocus(InputState state) + protected override void OnFocus(FocusEvent e) { GetContainingInputManager().ChangeFocus(Filter.Search); } diff --git a/osu.Game/Screens/Multi/Screens/Match/Header.cs b/osu.Game/Screens/Multi/Screens/Match/Header.cs index cc31f10fd2..d469815d59 100644 --- a/osu.Game/Screens/Multi/Screens/Match/Header.cs +++ b/osu.Game/Screens/Multi/Screens/Match/Header.cs @@ -8,8 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -151,28 +150,28 @@ namespace osu.Game.Screens.Multi.Screens.Match border.BorderColour = colours.Yellow; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { border.FadeIn(transition_duration); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { - base.OnHoverLost(state); + base.OnHoverLost(e); border.FadeOut(transition_duration); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { bg.FadeTo(0.75f, 1000, Easing.Out); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { bg.FadeTo(bg_opacity, transition_duration); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index a978bd916e..ed79d32a39 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -16,8 +16,7 @@ using OpenTK.Input; using System.Collections.Generic; using System.Linq; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play @@ -155,11 +154,11 @@ namespace osu.Game.Screens.Play protected override void PopOut() => this.FadeOut(transition_duration, Easing.In); // Don't let mouse down events through the overlay or people can click circles while paused. - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) => true; + protected override bool OnMouseUp(MouseUpEvent e) => true; - protected override bool OnMouseMove(InputState state) => true; + protected override bool OnMouseMove(MouseMoveEvent e) => true; protected void AddButton(string text, Color4 colour, Action action) { @@ -204,11 +203,11 @@ namespace osu.Game.Screens.Play } } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat) + if (!e.Repeat) { - switch (args.Key) + switch (e.Key) { case Key.Up: if (selectionIndex == -1 || selectionIndex == 0) @@ -225,7 +224,7 @@ namespace osu.Game.Screens.Play } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } public bool OnPressed(GlobalAction action) @@ -283,17 +282,17 @@ namespace osu.Game.Screens.Play private class Button : DialogButton { - protected override bool OnHover(InputState state) => true; + protected override bool OnHover(HoverEvent e) => true; - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { Selected.Value = true; - return base.OnMouseMove(state); + return base.OnMouseMove(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat || args.Key != Key.Enter || !Selected) + if (e.Repeat || e.Key != Key.Enter || !Selected) return false; OnClick(state); diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 1a164b473d..04f086282e 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.UI; using OpenTK; using osu.Game.Graphics.Containers; using System.Linq; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; namespace osu.Game.Screens.Play.HUD { @@ -93,16 +93,16 @@ namespace osu.Game.Screens.Play.HUD private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, Easing.OutQuint); - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { expand(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { contract(); - base.OnHoverLost(state); + base.OnHoverLost(e); } } } diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 7534c7a22e..4b3cc57546 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -3,8 +3,7 @@ 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 OpenTK; using osu.Game.Screens.Play.PlayerSettings; using OpenTK.Input; @@ -53,20 +52,20 @@ namespace osu.Game.Screens.Play.HUD //We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible public override bool HandleNonPositionalInput => true; - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; if (state.Keyboard.ControlPressed) { - if (args.Key == Key.H && ReplayLoaded) + if (e.Key == Key.H && ReplayLoaded) { ToggleVisibility(); return true; } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 6b120421ad..569764aaf2 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -2,14 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -62,10 +60,10 @@ namespace osu.Game.Screens.Play.HUD private float positionalAdjust; - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - positionalAdjust = Vector2.Distance(state.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; - return base.OnMouseMove(state); + positionalAdjust = Vector2.Distance(e.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; + return base.OnMouseMove(e); } protected override void Update() @@ -170,26 +168,26 @@ namespace osu.Game.Screens.Play.HUD }); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { HoverGained?.Invoke(); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverLost?.Invoke(); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { if (!pendingAnimation && state.Mouse.Buttons.Count() == 1) BeginConfirm(); return true; } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { if (!state.Mouse.Buttons.Any()) AbortConfirm(); diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index eb137f5447..3091cc5831 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -5,8 +5,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.Beatmaps; using osu.Game.Configuration; @@ -152,13 +151,13 @@ namespace osu.Game.Screens.Play Progress.BindRulestContainer(rulesetContainer); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; if (state.Keyboard.ShiftPressed) { - switch (args.Key) + switch (e.Key) { case Key.Tab: showHud.Value = !showHud.Value; @@ -166,7 +165,7 @@ namespace osu.Game.Screens.Play } } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } protected virtual RollingCounter CreateAccuracyCounter() => new PercentageCounter diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index 1c2f2c0ac4..725eae0367 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -1,8 +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.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; namespace osu.Game.Screens.Play @@ -15,16 +14,16 @@ namespace osu.Game.Screens.Play Key = key; } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Key == Key) IsLit = true; - return base.OnKeyDown(state, args); + if (e.Key == Key) IsLit = true; + return base.OnKeyDown(e); } - protected override bool OnKeyUp(InputState state, KeyUpEventArgs args) + protected override bool OnKeyUp(KeyUpEvent e) { - if (args.Key == Key) IsLit = false; - return base.OnKeyUp(state, args); + if (e.Key == Key) IsLit = false; + return base.OnKeyUp(e); } } } diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 37c2b4f072..c1ed5f84f4 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -1,8 +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.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using OpenTK.Input; using OpenTK; @@ -32,16 +31,16 @@ namespace osu.Game.Screens.Play } } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { - if (args.Button == Button) IsLit = true; - return base.OnMouseDown(state, args); + if (e.Button == Button) IsLit = true; + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { - if (args.Button == Button) IsLit = false; - return base.OnMouseUp(state, args); + if (e.Button == Button) IsLit = false; + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5ad0130fd7..b3cbeb3850 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -12,7 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; @@ -370,7 +370,7 @@ namespace osu.Game.Screens.Play Content.FadeOut(fadeOutDuration); } - protected override bool OnScroll(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; + protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; private void initializeStoryboard(bool asyncLoad) { diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 05a43b32f0..d87fb1db86 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -136,21 +136,21 @@ namespace osu.Game.Screens.Play private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { // restore our screen defaults InitializeBackgroundElements(); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { if (GetContainingInputManager().HoveredDrawables.Contains(visualSettings)) { // show user setting preview UpdateBackgroundElements(); } - base.OnHoverLost(state); + base.OnHoverLost(e); } protected override void InitializeBackgroundElements() diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 64c49099f2..6e317ccfc9 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -5,8 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -137,16 +136,16 @@ namespace osu.Game.Screens.Play.PlayerSettings this.Delay(600).FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { this.FadeIn(fade_duration, Easing.OutQuint); return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { this.FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } [BackgroundDependencyLoader] @@ -161,6 +160,6 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override Container Content => content; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; } } diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index d736a51a99..a1c43c014a 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -18,8 +18,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Framework.Input.Bindings; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play @@ -129,11 +128,11 @@ namespace osu.Game.Screens.Play remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint); } - protected override bool OnMouseMove(InputState state) + protected override bool OnMouseMove(MouseMoveEvent e) { - if (!state.Mouse.HasAnyButtonPressed) + if (!e.Mouse.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; - return base.OnMouseMove(state); + return base.OnMouseMove(e); } public bool OnPressed(GlobalAction action) @@ -194,16 +193,16 @@ namespace osu.Game.Screens.Play State = Visibility.Visible; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { scheduledHide?.Cancel(); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { State = Visibility.Visible; - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } @@ -284,7 +283,7 @@ namespace osu.Game.Screens.Play }; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { flow.TransformSpacingTo(new Vector2(5), 500, Easing.OutQuint); box.FadeColour(colourHover, 500, Easing.OutQuint); @@ -292,27 +291,27 @@ namespace osu.Game.Screens.Play return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { flow.TransformSpacingTo(new Vector2(0), 500, Easing.OutQuint); box.FadeColour(colourNormal, 500, Easing.OutQuint); background.FadeTo(0.2f, 500, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { aspect.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { aspect.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (!Enabled) return false; @@ -322,7 +321,7 @@ namespace osu.Game.Screens.Play box.FlashColour(Color4.White, 500, Easing.OutQuint); aspect.ScaleTo(1.2f, 2000, Easing.OutQuint); - bool result = base.OnClick(state); + bool result = base.OnClick(e); // for now, let's disable the skip button after the first press. // this will likely need to be contextual in the future (bound from external components). diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 5771cb1f70..7c9053d2f0 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -17,8 +17,7 @@ using osu.Framework.Caching; using osu.Framework.Threading; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; @@ -381,12 +380,12 @@ namespace osu.Game.Screens.Select public void ScrollToSelected() => scrollPositionCache.Invalidate(); - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { int direction = 0; bool skipDifficulties = false; - switch (args.Key) + switch (e.Key) { case Key.Up: direction = -1; @@ -405,7 +404,7 @@ namespace osu.Game.Screens.Select } if (direction == 0) - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); SelectNext(direction, skipDifficulties); return true; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 6071e163cf..109ac25cd1 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; @@ -155,12 +155,12 @@ namespace osu.Game.Screens.Select.Carousel triangles.Colour = OsuColour.Gray(0.5f); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { if (Item.State == CarouselItemState.Selected) startRequested?.Invoke(beatmap); - return base.OnClick(state); + return base.OnClick(e); } protected override void ApplyState() diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index 8a0052559e..e11b342efe 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.MathUtils; using osu.Game.Graphics; using OpenTK; @@ -72,18 +72,18 @@ namespace osu.Game.Screens.Select.Carousel hoverLayer.Colour = colours.Blue.Opacity(0.1f); } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { sampleHover?.Play(); hoverLayer.FadeIn(100, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { hoverLayer.FadeOut(1000, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } public void SetMultiplicativeAlpha(float alpha) => borderContainer.Alpha = alpha; @@ -145,7 +145,7 @@ namespace osu.Game.Screens.Select.Carousel }; } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { Item.State.Value = CarouselItemState.Selected; return true; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 32b6620c84..fce7af1400 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -14,8 +14,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Configuration; using osu.Game.Rulesets; @@ -187,10 +186,10 @@ namespace osu.Game.Screens.Select private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria()); - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnMouseMove(InputState state) => true; + protected override bool OnMouseMove(MouseMoveEvent e) => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index bc4d216f00..5fe1aa31ac 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -11,8 +11,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Select @@ -139,8 +138,8 @@ namespace osu.Game.Screens.Select updateModeLight(); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; + protected override bool OnMouseDown(MouseDownEvent e) => true; - protected override bool OnClick(InputState state) => true; + protected override bool OnClick(ClickEvent e) => true; } } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 8fb95d394e..1521c0f413 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -8,8 +8,7 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers; @@ -89,7 +88,7 @@ namespace osu.Game.Screens.Select public Action HoverLost; public Key? Hotkey; - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { Hovered?.Invoke(); light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, Easing.OutQuint); @@ -97,42 +96,42 @@ namespace osu.Game.Screens.Select return true; } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { HoverLost?.Invoke(); light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, Easing.OutQuint); light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint); } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { box.FadeOut(Footer.TRANSITION_LENGTH, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { box.ClearTransforms(); box.Alpha = 1; box.FadeOut(Footer.TRANSITION_LENGTH * 3, Easing.OutQuint); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && args.Key == Hotkey) + if (!e.Repeat && e.Key == Hotkey) { OnClick(state); return true; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } } } diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 95e9dde68e..241f6da3d1 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -251,16 +251,16 @@ namespace osu.Game.Screens.Select.Leaderboards } } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { background.FadeTo(0.5f, 300, Easing.OutQuint); - return base.OnHover(state); + return base.OnHover(e); } - protected override void OnHoverLost(InputState state) + protected override void OnHoverLost(HoverLostEvent e) { background.FadeTo(background_alpha, 200, Easing.OutQuint); - base.OnHoverLost(state); + base.OnHoverLost(e); } private class GlowingSpriteText : Container diff --git a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs index 19cba72f1f..6601c9df8b 100644 --- a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs @@ -3,8 +3,7 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; @@ -49,16 +48,16 @@ namespace osu.Game.Screens.Select.Leaderboards }; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { icon.ScaleTo(0.8f, 4000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { icon.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } } } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index f9127ace19..a03b3f988a 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -5,8 +5,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; @@ -53,30 +52,30 @@ namespace osu.Game.Screens.Select.Options public Key? HotKey; - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + protected override bool OnMouseDown(MouseDownEvent e) { flash.FadeTo(0.1f, 1000, Easing.OutQuint); - return base.OnMouseDown(state, args); + return base.OnMouseDown(e); } - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + protected override bool OnMouseUp(MouseUpEvent e) { flash.FadeTo(0, 1000, Easing.OutQuint); - return base.OnMouseUp(state, args); + return base.OnMouseUp(e); } - protected override bool OnClick(InputState state) + protected override bool OnClick(ClickEvent e) { flash.ClearTransforms(); flash.Alpha = 0.9f; flash.FadeOut(800, Easing.OutExpo); - return base.OnClick(state); + return base.OnClick(e); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (!args.Repeat && args.Key == HotKey) + if (!e.Repeat && e.Key == HotKey) { OnClick(state); return true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index b4dcbcce41..82f77768db 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -13,8 +13,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -554,11 +553,11 @@ namespace osu.Game.Screens.Select return base.OnPressed(action); } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) + protected override bool OnKeyDown(KeyDownEvent e) { - if (args.Repeat) return false; + if (e.Repeat) return false; - switch (args.Key) + switch (e.Key) { case Key.Delete: if (state.Keyboard.ShiftPressed) @@ -571,7 +570,7 @@ namespace osu.Game.Screens.Select break; } - return base.OnKeyDown(state, args); + return base.OnKeyDown(e); } private class ResetScrollContainer : Container @@ -583,10 +582,10 @@ namespace osu.Game.Screens.Select this.onHoverAction = onHoverAction; } - protected override bool OnHover(InputState state) + protected override bool OnHover(HoverEvent e) { onHoverAction?.Invoke(); - return base.OnHover(state); + return base.OnHover(e); } } } diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 0ca7ff011f..698d1a47a5 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -56,9 +56,9 @@ namespace osu.Game.Tests.Visual Clock.ProcessFrame(); } - protected override bool OnScroll(InputState state) + protected override bool OnScroll(ScrollEvent e) { - if (state.Mouse.ScrollDelta.Y > 0) + if (e.Mouse.ScrollDelta.Y > 0) Clock.SeekBackward(true); else Clock.SeekForward(true); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 8fb42c0cea..5704efd5a0 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 50091252e272564807e046b699d6619382a44891 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 19 Sep 2018 20:52:57 +0900 Subject: [PATCH 48/92] Adapt signature change of event handlers --- .../Objects/Drawables/Pieces/SliderBall.cs | 14 ++++++------- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/OsuInputManager.cs | 13 +++++------- .../UI/Cursor/CursorTrail.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- .../Containers/OsuFocusedOverlayContainer.cs | 2 +- .../Graphics/Containers/OsuScrollContainer.cs | 9 ++++----- .../Graphics/Containers/ParallaxContainer.cs | 2 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 8 ++++---- .../Graphics/UserInterface/SearchTextBox.cs | 5 +++-- osu.Game/Overlays/ChatOverlay.cs | 5 +---- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 20 +++++++++---------- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 2 +- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 6 +++--- osu.Game/Overlays/MusicController.cs | 8 +------- osu.Game/Overlays/Profile/Header/RankGraph.cs | 4 ++-- .../Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 8 ++++---- osu.Game/Rulesets/UI/RulesetInputManager.cs | 16 ++++++++------- .../Timelines/Summary/Parts/MarkerPart.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 2 +- .../Screens/Compose/BeatDivisorControl.cs | 9 ++++----- .../Edit/Screens/Compose/Layers/DragLayer.cs | 4 ++-- .../Screens/Compose/Layers/MaskContainer.cs | 5 +++-- .../Screens/Compose/Layers/MaskSelection.cs | 4 ++-- .../Timeline/ZoomableScrollContainer.cs | 4 ++-- osu.Game/Screens/Menu/Button.cs | 3 ++- osu.Game/Screens/Menu/MainMenu.cs | 3 ++- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 7 ++++--- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Select/FooterButton.cs | 2 +- .../Select/Options/BeatmapOptionsButton.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- 40 files changed, 94 insertions(+), 103 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index c19bbc439d..3081ae49fc 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -6,10 +6,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK.Graphics; using osu.Game.Skinning; +using OpenTK; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { @@ -102,23 +102,23 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }; } - private InputState lastState; + private Vector2? lastScreenSpaceMousePosition; protected override bool OnMouseDown(MouseDownEvent e) { - lastState = state; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { - lastState = state; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseUp(e); } protected override bool OnMouseMove(MouseMoveEvent e) { - lastState = e; + lastScreenSpaceMousePosition = e.ScreenSpaceMousePosition; return base.OnMouseMove(e); } @@ -155,8 +155,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. Tracking = canCurrentlyTrack - && lastState != null - && ReceivePositionalInputAt(lastState.Mouse.NativeState.Position) + && lastScreenSpaceMousePosition.HasValue + && ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 7a577383ae..4dd1c5f218 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces protected override bool OnMouseMove(MouseMoveEvent e) { - mousePosition = Parent.ToLocalSpace(e.Mouse.NativeState.Position); + mousePosition = Parent.ToLocalSpace(e.ScreenSpaceMousePosition); return base.OnMouseMove(e); } diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index 70b35fbd96..0f7bc30888 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu @@ -36,13 +35,11 @@ namespace osu.Game.Rulesets.Osu { } - protected override bool OnKeyDown(KeyDownEvent e) => AllowUserPresses && base.OnKeyDown(e); - protected override bool OnKeyUp(KeyUpEvent e) => AllowUserPresses && base.OnKeyUp(e); - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickPress(args); - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) => AllowUserPresses && base.OnJoystickRelease(args); - protected override bool OnMouseDown(MouseDownEvent e) => AllowUserPresses && base.OnMouseDown(e); - protected override bool OnMouseUp(MouseUpEvent e) => AllowUserPresses && base.OnMouseUp(e); - protected override bool OnScroll(ScrollEvent e) => AllowUserPresses && base.OnScroll(e); + protected override bool Handle(UIEvent e) + { + if (!AllowUserPresses) return false; + return base.Handle(e); + } } } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 8a701f1afc..4b5513ff9c 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -119,7 +119,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor protected override bool OnMouseMove(MouseMoveEvent e) { - Vector2 pos = e.Mouse.NativeState.Position; + Vector2 pos = e.ScreenSpaceMousePosition; if (lastPosition == null) { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index cdb6b8c1f8..1f409f043e 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -184,7 +184,7 @@ namespace osu.Game.Tests.Visual /// /// The cursor to check. private bool checkAtMouse(CursorContainer cursorContainer) - => Precision.AlmostEquals(InputManager.CurrentState.Mouse.NativeState.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition)); + => Precision.AlmostEquals(InputManager.CurrentState.Mouse.Position, cursorContainer.ToScreenSpace(cursorContainer.ActiveCursor.DrawPosition)); private class CustomCursorBox : Container, IProvideCursor { diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 14f18e554d..2aa3fede2c 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -61,7 +61,7 @@ namespace osu.Game.Graphics.Containers protected override bool OnClick(ClickEvent e) { - if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position)) + if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition)) { State = Visibility.Hidden; return true; diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index 5c5c42ba70..4f18eb9e7b 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Containers @@ -21,7 +20,7 @@ namespace osu.Game.Graphics.Containers /// public double DistanceDecayOnRightMouseScrollbar = 0.02; - private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right); + private bool shouldPerformRightMouseScroll(MouseButtonEvent e) => RightMouseScrollbar && e.Button == MouseButton.Right; private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar); @@ -31,9 +30,9 @@ namespace osu.Game.Graphics.Containers protected override bool OnMouseDown(MouseDownEvent e) { - if (shouldPerformRightMouseScroll(state)) + if (shouldPerformRightMouseScroll(e)) { - scrollToRelative(state.Mouse.Position[ScrollDim]); + scrollToRelative(e.MousePosition[ScrollDim]); return true; } @@ -44,7 +43,7 @@ namespace osu.Game.Graphics.Containers { if (mouseScrollBarDragging) { - scrollToRelative(e.Mouse.Position[ScrollDim]); + scrollToRelative(e.MousePosition[ScrollDim]); return true; } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 8e1e5d54fa..a6b79a20dc 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.Containers if (parallaxEnabled) { - Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount; + Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount; double elapsed = MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000); diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index a34a7c53d0..6bd3b986c8 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -43,7 +43,7 @@ namespace osu.Game.Graphics.Cursor { if (dragRotationState != DragRotationState.NotDragging) { - var position = e.Mouse.Position; + var position = e.MousePosition; var distance = Vector2Extensions.Distance(position, positionMouseDown); // don't start rotating until we're moved a minimum distance away from the mouse down location, // else it can have an annoying effect. @@ -52,7 +52,7 @@ namespace osu.Game.Graphics.Cursor // don't rotate when distance is zero to avoid NaN if (dragRotationState == DragRotationState.Rotating && distance > 0) { - Vector2 offset = e.Mouse.Position - positionMouseDown; + Vector2 offset = e.MousePosition - positionMouseDown; float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance @@ -83,14 +83,14 @@ namespace osu.Game.Graphics.Cursor if (e.Button == MouseButton.Left && cursorRotate) { dragRotationState = DragRotationState.DragStarted; - positionMouseDown = state.Mouse.Position; + positionMouseDown = e.MousePosition; } return base.OnMouseDown(e); } protected override bool OnMouseUp(MouseUpEvent e) { - if (!state.Mouse.HasMainButtonPressed) + if (!e.CurrentState.Mouse.HasMainButtonPressed) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 8aa3a3f663..67ee35df04 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -34,7 +34,8 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnKeyDown(KeyDownEvent e) { - if (!state.Keyboard.ControlPressed && !state.Keyboard.ShiftPressed) + var keyboard = e.CurrentState.Keyboard; + if (!keyboard.ControlPressed && !keyboard.ShiftPressed) { switch (e.Key) { @@ -56,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface } } - if (state.Keyboard.ShiftPressed) + if (keyboard.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 0424481f77..5312207e4e 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -206,10 +206,7 @@ namespace osu.Game.Overlays { if (isDragging) { - Trace.Assert(e.Mouse.PositionMouseDown != null); - - // ReSharper disable once PossibleInvalidOperationException - double targetChatHeight = startDragChatHeight - (e.Mouse.Position.Y - e.Mouse.PositionMouseDown.Value.Y) / Parent.DrawSize.Y; + double targetChatHeight = startDragChatHeight - (e.MousePosition.Y - e.MouseDownPosition.Y) / Parent.DrawSize.Y; // If the channel selection screen is shown, mind its minimum height if (channelSelection.State == Visibility.Visible && targetChatHeight > 1f - channel_selection_min_height) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index fb17635806..87325c69aa 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -11,14 +11,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input; using OpenTK.Graphics; using OpenTK.Input; -using JoystickEventArgs = osu.Framework.Input.EventArgs.JoystickEventArgs; namespace osu.Game.Overlays.KeyBinding { @@ -166,14 +164,14 @@ namespace osu.Game.Overlays.KeyBinding } } - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); return true; } protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. - if (!HasFocus || state.Mouse.Buttons.Any()) + if (!HasFocus || e.CurrentState.Mouse.HasAnyButtonPressed) return base.OnMouseUp(e); if (bindTarget.IsHovered) @@ -189,7 +187,7 @@ namespace osu.Game.Overlays.KeyBinding { if (bindTarget.IsHovered) { - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e, e.Mouse.ScrollDelta)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState, e.ScrollDelta)); finalise(); return true; } @@ -207,7 +205,7 @@ namespace osu.Game.Overlays.KeyBinding { case Key.Delete: { - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { bindTarget.UpdateKeyCombination(InputKey.None); finalise(); @@ -218,7 +216,7 @@ namespace osu.Game.Overlays.KeyBinding } } - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); if (!isModifier(e.Key)) finalise(); return true; @@ -232,21 +230,21 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) + protected override bool OnJoystickPress(JoystickPressEvent e) { if (!HasFocus) return false; - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(e.CurrentState)); finalise(); return true; } - protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) + protected override bool OnJoystickRelease(JoystickReleaseEvent e) { if (!HasFocus) - return base.OnJoystickRelease(args); + return base.OnJoystickRelease(e); finalise(); return true; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 7e0954899d..13c01cb88f 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays protected override void OnFocusLost(FocusLostEvent e) { - if (e.Keyboard.Keys.Contains(Key.Escape)) dismiss(); + if (e.CurrentState.Keyboard.IsPressed(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index 40b9793be4..ecb65f6df2 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Mods scaleContainer.ScaleTo(1, 500, Easing.OutElastic); // only trigger the event if we are inside the area of the button - if (Contains(ToScreenSpace(state.Mouse.Position - Position))) + if (Contains(e.ScreenSpaceMousePosition)) { switch (e.Button) { diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 3ba49042e5..4759325bc4 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + buttons[index].SelectNext(e.CurrentState.Keyboard.ShiftPressed ? -1 : 1); } return base.OnKeyDown(e); diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 48c07846b8..17c8d2f154 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -117,14 +117,14 @@ namespace osu.Game.Overlays.Music protected override bool OnDragStart(DragStartEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; draggedItem = items.FirstOrDefault(d => d.IsDraggable); return draggedItem != null || base.OnDragStart(e); } protected override bool OnDrag(DragEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; if (draggedItem == null) return base.OnDrag(e); return true; @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.Music protected override bool OnDragEnd(DragEndEvent e) { - nativeDragPosition = e.Mouse.NativeState.Position; + nativeDragPosition = e.ScreenSpaceMousePosition; var handled = draggedItem != null || base.OnDragEnd(e); draggedItem = null; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index fc2fed890b..e3dc504e4d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -457,20 +457,14 @@ namespace osu.Game.Overlays private class DragContainer : Container { - private Vector2 dragStart; - protected override bool OnDragStart(DragStartEvent e) { - base.OnDragStart(e); - dragStart = e.Mouse.Position; return true; } protected override bool OnDrag(DragEvent e) { - if (base.OnDrag(e)) return true; - - Vector2 change = e.Mouse.Position - dragStart; + Vector2 change = e.MousePosition - e.MouseDownPosition; // Diminish the drag distance as we go further to simulate "rubber band" feeling. change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length; diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 2abfaa1a6d..fc80370cf9 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Profile.Header { if (ranks?.Length > 1) { - graph.UpdateBallPosition(e.Mouse.Position.X); + graph.UpdateBallPosition(e.MousePosition.X); graph.ShowBall(); } return base.OnHover(e); @@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Profile.Header protected override bool OnMouseMove(MouseMoveEvent e) { if (ranks?.Length > 1) - graph.UpdateBallPosition(e.Mouse.Position.X); + graph.UpdateBallPosition(e.MousePosition.X); return base.OnMouseMove(e); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index aa55f8fa41..167d163d8b 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar { base.OnKeyDown(e); - if (state.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) + if (e.CurrentState.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { int requested = e.Key - Key.Number1; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index daf45f71b4..86be652c8c 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Volume protected override bool OnScroll(ScrollEvent e) { - adjust(e.Mouse.ScrollDelta.Y, e.Mouse.HasPreciseScroll); + adjust(e.ScrollDelta.Y, e.IsPrecise); return true; } diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index a16c6d59dd..636ea418f3 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Edit /// /// Invoked when this has requested drag. /// - public event Action DragRequested; + public event Action DragRequested; /// /// The which this applies to. @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Edit if (State == SelectionState.NotSelected) { - SelectionRequested?.Invoke(this, state); + SelectionRequested?.Invoke(this, e.CurrentState); selectionRequested = true; } @@ -114,7 +114,7 @@ namespace osu.Game.Rulesets.Edit if (State == SelectionState.Selected && !selectionRequested) { selectionRequested = true; - SelectionRequested?.Invoke(this, e); + SelectionRequested?.Invoke(this, e.CurrentState); return true; } @@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Edit protected override bool OnDrag(DragEvent e) { - DragRequested?.Invoke(this, e); + DragRequested?.Invoke(this, e.Delta, e.CurrentState); return true; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 91bb505724..fc6f82544e 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -18,6 +18,9 @@ using osu.Game.Input.Handlers; using osu.Game.Screens.Play; using OpenTK.Input; using static osu.Game.Input.Handlers.ReplayInputHandler; +using JoystickState = osu.Framework.Input.States.JoystickState; +using KeyboardState = osu.Framework.Input.States.KeyboardState; +using MouseState = osu.Framework.Input.States.MouseState; namespace osu.Game.Rulesets.UI { @@ -35,13 +38,7 @@ namespace osu.Game.Rulesets.UI protected override InputState CreateInitialState() { var state = base.CreateInitialState(); - return new RulesetInputManagerInputState - { - Mouse = state.Mouse, - Keyboard = state.Keyboard, - Joystick = state.Joystick, - LastReplayState = null - }; + return new RulesetInputManagerInputState(state.Mouse, state.Keyboard, state.Joystick); } protected readonly KeyBindingContainer KeyBindingContainer; @@ -275,5 +272,10 @@ namespace osu.Game.Rulesets.UI where T : struct { public ReplayState LastReplayState; + + public RulesetInputManagerInputState(MouseState mouse = null, KeyboardState keyboard = null, JoystickState joystick = null) + : base(mouse, keyboard, joystick) + { + } } } diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 41ef2065da..4b57e1e92d 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -33,13 +33,13 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts protected override bool OnDragEnd(DragEndEvent e) => true; protected override bool OnDrag(DragEvent e) { - seekToPosition(e.Mouse.NativeState.Position); + seekToPosition(e.ScreenSpaceMousePosition); return true; } protected override bool OnMouseDown(MouseDownEvent e) { - seekToPosition(state.Mouse.NativeState.Position); + seekToPosition(e.ScreenSpaceMousePosition); return true; } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 2cfcf4c415..62cf76ef69 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Edit protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.ScrollDelta.X + e.Mouse.ScrollDelta.Y > 0) + if (e.ScrollDelta.X + e.ScrollDelta.Y > 0) clock.SeekBackward(!clock.IsRunning); else clock.SeekForward(!clock.IsRunning); diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 2e1b2c1ac3..e46be9f7c1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -13,7 +13,6 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; -using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; @@ -264,20 +263,20 @@ namespace osu.Game.Screens.Edit.Screens.Compose protected override bool OnClick(ClickEvent e) { - handleMouseInput(e); + handleMouseInput(e.ScreenSpaceMousePosition); return true; } protected override bool OnDrag(DragEvent e) { - handleMouseInput(e); + handleMouseInput(e.ScreenSpaceMousePosition); return true; } - private void handleMouseInput(InputState state) + private void handleMouseInput(Vector2 screenSpaceMousePosition) { // copied from SliderBar so we can do custom spacing logic. - var xPosition = (ToLocalSpace(state?.Mouse.NativeState.Position ?? Vector2.Zero).X - RangePadding) / UsableWidth; + var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth; CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First(); OnUserChange(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index 6db272e2a4..981ddd989c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -64,8 +64,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers protected override bool OnDrag(DragEvent e) { - var dragPosition = e.Mouse.NativeState.Position; - var dragStartPosition = e.Mouse.NativeState.PositionMouseDown ?? dragPosition; + var dragPosition = e.ScreenSpaceMousePosition; + var dragStartPosition = e.ScreenSpaceMouseDownPosition; var dragQuad = new Quad(dragStartPosition.X, dragStartPosition.Y, dragPosition.X - dragStartPosition.X, dragPosition.Y - dragStartPosition.Y); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index 5ee31769a3..19258d669e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; +using OpenTK; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; namespace osu.Game.Screens.Edit.Screens.Compose.Layers @@ -32,7 +33,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// /// Invoked when any requests drag. /// - public event Action MaskDragRequested; + public event Action MaskDragRequested; private IEnumerable aliveMasks => AliveInternalChildren.Cast(); @@ -103,7 +104,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers } private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state); - private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state); + private void onDragRequested(HitObjectMask mask, Vector2 delta, InputState state) => MaskDragRequested?.Invoke(mask, delta, state); protected override int Compare(Drawable x, Drawable y) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 927e7a2342..635edf82da 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers #region User Input Handling - public void HandleDrag(HitObjectMask m, InputState state) + public void HandleDrag(HitObjectMask m, Vector2 delta, InputState state) { // Todo: Various forms of snapping @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers switch (mask.HitObject.HitObject) { case IHasEditablePosition editablePosition: - editablePosition.OffsetPosition(state.Mouse.Delta); + editablePosition.OffsetPosition(delta); break; } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index 6390f8dd96..bbba439ca7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -99,11 +99,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.HasPreciseScroll) + if (e.IsPrecise) // for now, we don't support zoom when using a precision scroll device. this needs gesture support. return base.OnScroll(e); - setZoomTarget(zoomTarget + e.Mouse.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.Mouse.NativeState.Position).X); + setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X); return true; } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index bf0e0418e9..83d8ef12b8 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -205,7 +205,8 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - if (e.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed) + var keyboard = e.CurrentState.Keyboard; + if (e.Repeat || keyboard.ControlPressed || keyboard.ShiftPressed || keyboard.AltPressed) return false; if (triggerKey == e.Key && triggerKey != Key.Unknown) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index ef86351760..531ce85d4d 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -201,7 +201,8 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - if (!e.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && e.Key == Key.D) + var keyboard = e.CurrentState.Keyboard; + if (!e.Repeat && keyboard.ControlPressed && keyboard.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index ed79d32a39..2c984e6135 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -295,7 +295,7 @@ namespace osu.Game.Screens.Play if (e.Repeat || e.Key != Key.Enter || !Selected) return false; - OnClick(state); + Click(); return true; } } diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 4b3cc57546..1ce557f70f 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD { if (e.Repeat) return false; - if (state.Keyboard.ControlPressed) + if (e.CurrentState.Keyboard.ControlPressed) { if (e.Key == Key.H && ReplayLoaded) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 569764aaf2..347238f1d6 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -62,7 +63,7 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseMove(MouseMoveEvent e) { - positionalAdjust = Vector2.Distance(e.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200; + positionalAdjust = Vector2.Distance(e.ScreenSpaceMousePosition, button.ScreenSpaceDrawQuad.Centre) / 200; return base.OnMouseMove(e); } @@ -182,14 +183,14 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseDown(MouseDownEvent e) { - if (!pendingAnimation && state.Mouse.Buttons.Count() == 1) + if (!pendingAnimation && e.CurrentState.Mouse.Buttons.Count() == 1) BeginConfirm(); return true; } protected override bool OnMouseUp(MouseUpEvent e) { - if (!state.Mouse.Buttons.Any()) + if (!e.CurrentState.Mouse.Buttons.Any()) AbortConfirm(); return true; } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 3091cc5831..aa4d6c039b 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play { if (e.Repeat) return false; - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index a1c43c014a..68bd5f7d00 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(MouseMoveEvent e) { - if (!e.Mouse.HasAnyButtonPressed) + if (!e.CurrentState.Mouse.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; return base.OnMouseMove(e); } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 1521c0f413..4f12082e08 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Select { if (!e.Repeat && e.Key == Hotkey) { - OnClick(state); + Click(); return true; } diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index a03b3f988a..cd775419be 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Select.Options { if (!e.Repeat && e.Key == HotKey) { - OnClick(state); + Click(); return true; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 82f77768db..6195a9788c 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -560,7 +560,7 @@ namespace osu.Game.Screens.Select switch (e.Key) { case Key.Delete: - if (state.Keyboard.ShiftPressed) + if (e.CurrentState.Keyboard.ShiftPressed) { if (!Beatmap.IsDefault) delete(Beatmap.Value.BeatmapSetInfo); diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 698d1a47a5..ebede74171 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual protected override bool OnScroll(ScrollEvent e) { - if (e.Mouse.ScrollDelta.Y > 0) + if (e.ScrollDelta.Y > 0) Clock.SeekBackward(true); else Clock.SeekForward(true); From b7a2ad1aa5980dc8e6fd49f8b990121babf98559 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 12:44:14 +0900 Subject: [PATCH 49/92] Use UIEvent level getters for modifier keys. --- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 5 ++--- osu.Game/Overlays/ChatOverlay.cs | 1 - osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 4 ++-- osu.Game/Overlays/MedalOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSection.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 3 +-- osu.Game/Screens/Menu/MainMenu.cs | 3 +-- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/QuitButton.cs | 2 +- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 17 files changed, 18 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 6bd3b986c8..ba858bf52d 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -90,7 +90,7 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseUp(MouseUpEvent e) { - if (!e.CurrentState.Mouse.HasMainButtonPressed) + if (!e.IsPressed(MouseButton.Left) && !e.IsPressed(MouseButton.Right)) { activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); activeCursor.ScaleTo(1, 500, Easing.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 67ee35df04..08e93fad18 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -34,8 +34,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (!keyboard.ControlPressed && !keyboard.ShiftPressed) + if (!e.ControlPressed && !e.ShiftPressed) { switch (e.Key) { @@ -57,7 +56,7 @@ namespace osu.Game.Graphics.UserInterface } } - if (keyboard.ShiftPressed) + if (e.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 5312207e4e..4832c85e74 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 6eef2fc500..1c462e3a73 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.States; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 87325c69aa..63ddc25fde 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.KeyBinding protected override bool OnMouseUp(MouseUpEvent e) { // don't do anything until the last button is released. - if (!HasFocus || e.CurrentState.Mouse.HasAnyButtonPressed) + if (!HasFocus || e.HasAnyButtonPressed) return base.OnMouseUp(e); if (bindTarget.IsHovered) @@ -205,7 +205,7 @@ namespace osu.Game.Overlays.KeyBinding { case Key.Delete: { - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { bindTarget.UpdateKeyCombination(InputKey.None); finalise(); diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 13c01cb88f..dcd325490a 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -183,7 +183,7 @@ namespace osu.Game.Overlays protected override void OnFocusLost(FocusLostEvent e) { - if (e.CurrentState.Keyboard.IsPressed(Key.Escape)) dismiss(); + if (e.CurrentState.Keyboard.Keys.IsPressed(Key.Escape)) dismiss(); } private const double initial_duration = 400; diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 4759325bc4..c0d2d889c6 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Mods { var index = Array.IndexOf(ToggleKeys, e.Key); if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(e.CurrentState.Keyboard.ShiftPressed ? -1 : 1); + buttons[index].SelectNext(e.ShiftPressed ? -1 : 1); } return base.OnKeyDown(e); diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 167d163d8b..7470dd0cd5 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Toolbar { base.OnKeyDown(e); - if (e.CurrentState.Keyboard.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) + if (e.ControlPressed && !e.Repeat && e.Key >= Key.Number1 && e.Key <= Key.Number9) { int requested = e.Key - Key.Number1; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index fc6f82544e..b0c75a4990 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; 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.Events; using osu.Framework.Input.States; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 83d8ef12b8..2b85ee6158 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -205,8 +205,7 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (e.Repeat || keyboard.ControlPressed || keyboard.ShiftPressed || keyboard.AltPressed) + if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed) return false; if (triggerKey == e.Key && triggerKey != Key.Unknown) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 531ce85d4d..2374d6a2fe 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -201,8 +201,7 @@ namespace osu.Game.Screens.Menu protected override bool OnKeyDown(KeyDownEvent e) { - var keyboard = e.CurrentState.Keyboard; - if (!e.Repeat && keyboard.ControlPressed && keyboard.ShiftPressed && e.Key == Key.D) + if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D) { Push(new Drawings()); return true; diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 1ce557f70f..debce8c680 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.HUD { if (e.Repeat) return false; - if (e.CurrentState.Keyboard.ControlPressed) + if (e.ControlPressed) { if (e.Key == Key.H && ReplayLoaded) { diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 347238f1d6..88547e0169 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -190,7 +190,7 @@ namespace osu.Game.Screens.Play.HUD protected override bool OnMouseUp(MouseUpEvent e) { - if (!e.CurrentState.Mouse.Buttons.Any()) + if (!e.HasAnyButtonPressed) AbortConfirm(); return true; } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index aa4d6c039b..db0d7b6ccc 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Play { if (e.Repeat) return false; - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { switch (e.Key) { diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 68bd5f7d00..cd34623951 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play protected override bool OnMouseMove(MouseMoveEvent e) { - if (!e.CurrentState.Mouse.HasAnyButtonPressed) + if (!e.HasAnyButtonPressed) fadeContainer.State = Visibility.Visible; return base.OnMouseMove(e); } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6195a9788c..7402cf4da0 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -560,7 +560,7 @@ namespace osu.Game.Screens.Select switch (e.Key) { case Key.Delete: - if (e.CurrentState.Keyboard.ShiftPressed) + if (e.ShiftPressed) { if (!Beatmap.IsDefault) delete(Beatmap.Value.BeatmapSetInfo); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5704efd5a0..48400084ca 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 68980fc477f65636ccdc268750959f6581e2fb57 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 2 Oct 2018 14:41:18 +0900 Subject: [PATCH 50/92] Adjust usage of Handle(Non)PositionalInput to follow framework update --- osu.Desktop/Overlays/VersionManager.cs | 3 --- .../Objects/Drawables/Pieces/CirclePiece.cs | 3 +++ .../Drawables/Pieces/SpinnerBackground.cs | 3 --- osu.Game/Graphics/Backgrounds/Triangles.cs | 4 ---- .../Graphics/Containers/LinkFlowContainer.cs | 2 -- osu.Game/Graphics/DrawableDate.cs | 2 -- .../Graphics/UserInterface/OsuDropdown.cs | 3 +++ osu.Game/Overlays/ChatOverlay.cs | 20 ++++++++++++++----- osu.Game/Overlays/OnScreenDisplay.cs | 3 --- osu.Game/Screens/Menu/LogoVisualisation.cs | 3 --- osu.Game/Screens/Menu/MenuSideFlashes.cs | 3 --- osu.Game/Screens/Play/SquareGraph.cs | 3 --- .../Select/Leaderboards/Placeholder.cs | 2 -- .../Drawables/DrawableStoryboard.cs | 2 -- osu.Game/osu.Game.csproj | 2 +- 15 files changed, 22 insertions(+), 36 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 8881884fb4..96857d6b4f 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -27,9 +27,6 @@ namespace osu.Desktop.Overlays private NotificationOverlay notificationOverlay; private GameHost host; - 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.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs index bd7a4ad3f6..6bb6991cc0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -12,6 +12,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class CirclePiece : Container, IKeyBindingHandler { + // IsHovered is used + public override bool HandlePositionalInput => true; + public Func Hit; public CirclePiece() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 0401df7a91..584fd93a70 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -11,9 +11,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - protected Box Disc; public Color4 AccentColour diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index bff9e49dce..4a86d0e4f6 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -30,10 +30,6 @@ namespace osu.Game.Graphics.Backgrounds /// private const float edge_smoothness = 1; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - - public Color4 ColourLight = Color4.White; public Color4 ColourDark = Color4.Black; diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 7c17f95e80..e4e7828d0e 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -20,8 +20,6 @@ namespace osu.Game.Graphics.Containers { } - public override bool HandlePositionalInput => true; - private OsuGame game; private Action showNotImplementedError; diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 1a7ed607e6..28f8bdf82f 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -54,8 +54,6 @@ namespace osu.Game.Graphics Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate); } - public override bool HandlePositionalInput => true; - protected virtual string Format() => Date.Humanize(); private void updateTime() => Text = Format(); diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 830bde9dac..26caf09b1b 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -97,6 +97,9 @@ namespace osu.Game.Graphics.UserInterface #region DrawableOsuDropdownMenuItem public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour { + // IsHovered is used + public override bool HandlePositionalInput => true; + private Color4? accentColour; public Color4 AccentColour { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 4832c85e74..eeadac8e8c 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -51,7 +51,7 @@ namespace osu.Game.Overlays private readonly ChatTabControl channelTabs; private readonly Container chatContainer; - private readonly Container tabsArea; + private readonly TabsArea tabsArea; private readonly Box chatBackground; private readonly Box tabBackground; @@ -145,11 +145,8 @@ namespace osu.Game.Overlays loading = new LoadingAnimation(), } }, - tabsArea = new Container + tabsArea = new TabsArea { - Name = @"tabs area", - RelativeSizeAxes = Axes.X, - Height = TAB_AREA_HEIGHT, Children = new Drawable[] { tabBackground = new Box @@ -541,5 +538,18 @@ namespace osu.Game.Overlays api.Queue(req); } + + private class TabsArea : Container + { + // IsHovered is used + public override bool HandlePositionalInput => true; + + public TabsArea() + { + Name = @"tabs area"; + RelativeSizeAxes = Axes.X; + Height = TAB_AREA_HEIGHT; + } + } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index e40004aa01..97c6554908 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -25,9 +25,6 @@ namespace osu.Game.Overlays { private readonly Container box; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private readonly SpriteText textLine1; private readonly SpriteText textLine2; private readonly SpriteText textLine3; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 5d76206905..34fb0b196b 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -64,9 +64,6 @@ namespace osu.Game.Screens.Menu private readonly float[] frequencyAmplitudes = new float[256]; - 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 a9e3310fbe..3de68fe914 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -19,9 +19,6 @@ namespace osu.Game.Screens.Menu { public class MenuSideFlashes : BeatSyncedContainer { - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private readonly IBindable beatmap = new Bindable(); private Box leftBox; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 6b4918af75..bc4c87e191 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -21,9 +21,6 @@ namespace osu.Game.Screens.Play public int ColumnCount => columns.Length; - public override bool HandleNonPositionalInput => false; - public override bool HandlePositionalInput => false; - private int progress; public int Progress { diff --git a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs index 105f9e2064..468b43e54f 100644 --- a/osu.Game/Screens/Select/Leaderboards/Placeholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/Placeholder.cs @@ -11,8 +11,6 @@ namespace osu.Game.Screens.Select.Leaderboards { protected const float TEXT_SIZE = 22; - public override bool HandlePositionalInput => true; - protected Placeholder() : base(cp => cp.TextSize = TEXT_SIZE) { diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index 02a4b46f1c..ef03539998 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -18,8 +18,6 @@ namespace osu.Game.Storyboards.Drawables protected override Container Content => content; protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); - 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 48400084ca..66bae277b3 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 593dee202c9d3ed492e1817121b4b01edfb5e576 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 4 Oct 2018 03:03:59 +0900 Subject: [PATCH 51/92] Fix gameplay mouse button disable setting no longer having any effect Regressed at https://github.com/ppy/osu/commit/50091252e272564807e046b699d6619382a44891#diff-20562da8cde558aacafa9540b97b7975 --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index b0c75a4990..64bbb8b52b 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -73,12 +73,10 @@ namespace osu.Game.Rulesets.UI #region IHasReplayHandler private ReplayInputHandler replayInputHandler; + public ReplayInputHandler ReplayInputHandler { - get - { - return replayInputHandler; - } + get => replayInputHandler; set { if (replayInputHandler != null) RemoveHandler(replayInputHandler); @@ -220,6 +218,13 @@ namespace osu.Game.Rulesets.UI return base.OnMouseUp(e); } + protected override bool Handle(UIEvent e) + { + if (mouseDisabled.Value && e is MouseDownEvent me && (me.Button == MouseButton.Left || me.Button == MouseButton.Right)) return false; + + return base.Handle(e); + } + #endregion #region Key Counter Attachment @@ -269,7 +274,7 @@ namespace osu.Game.Rulesets.UI } public class RulesetInputManagerInputState : InputState - where T : struct + where T : struct { public ReplayState LastReplayState; From b9d0fc927b54a3bb801dc8a600a3ce443b85c61a Mon Sep 17 00:00:00 2001 From: ekrctb Date: Thu, 4 Oct 2018 17:55:31 +0900 Subject: [PATCH 52/92] Remove duplicated code --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 64bbb8b52b..340833c090 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -206,22 +206,19 @@ namespace osu.Game.Rulesets.UI mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); } - protected override bool OnMouseDown(MouseDownEvent e) - { - if (mouseDisabled.Value && (e.Button == MouseButton.Left || e.Button == MouseButton.Right)) return false; - return base.OnMouseDown(e); - } - - protected override bool OnMouseUp(MouseUpEvent e) - { - if (!CurrentState.Mouse.IsPressed(e.Button)) return false; - return base.OnMouseUp(e); - } - protected override bool Handle(UIEvent e) { - if (mouseDisabled.Value && e is MouseDownEvent me && (me.Button == MouseButton.Left || me.Button == MouseButton.Right)) return false; - + switch (e) + { + case MouseDownEvent mouseDown when mouseDown.Button == MouseButton.Left || mouseDown.Button == MouseButton.Right: + if (mouseDisabled.Value) + return false; + break; + case MouseUpEvent mouseUp: + if (!CurrentState.Mouse.IsPressed(mouseUp.Button)) + return false; + break; + } return base.Handle(e); } From 716eee9a5cdc3738fe4e4758b89ba1547abede73 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 5 Oct 2018 00:25:40 +0900 Subject: [PATCH 53/92] Fix last visit not supporting null values Can now be null if a user chooses to hide their online status --- osu.Game/Overlays/Profile/ProfileHeader.cs | 11 +++++++---- osu.Game/Users/User.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 9d09836d25..4839348e0e 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -386,10 +386,13 @@ namespace osu.Game.Overlays.Profile infoTextLeft.AddText(new DrawableJoinDate(user.JoinDate), boldItalic); } - infoTextLeft.NewLine(); - infoTextLeft.AddText("Last seen ", lightText); - infoTextLeft.AddText(new DrawableDate(user.LastVisit), boldItalic); - infoTextLeft.NewParagraph(); + if (user.LastVisit.HasValue) + { + infoTextLeft.NewLine(); + infoTextLeft.AddText("Last seen ", lightText); + infoTextLeft.AddText(new DrawableDate(user.LastVisit.Value), boldItalic); + infoTextLeft.NewParagraph(); + } if (user.PlayStyle?.Length > 0) { diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 353bae286f..a5d8c03a67 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -84,7 +84,7 @@ namespace osu.Game.Users public string Location; [JsonProperty(@"last_visit")] - public DateTimeOffset LastVisit; + public DateTimeOffset? LastVisit; [JsonProperty(@"twitter")] public string Twitter; From cb1703c6e2181cd2ada72d90dba67c874d068887 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 11:19:01 +0900 Subject: [PATCH 54/92] Fix colours with alpha components not being parsed --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 3 ++- .../Resources/Soleily - Renatus (Gamu) [Insane].osu | 1 + osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 13 +++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index d3351f86f8..af63a39662 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -165,7 +165,7 @@ namespace osu.Game.Tests.Beatmaps.Formats } [Test] - public void TestDecodeBeatmapColors() + public void TestDecodeBeatmapColours() { var decoder = new LegacySkinDecoder(); using (var resStream = Resource.OpenResource("Soleily - Renatus (Gamu) [Insane].osu")) @@ -181,6 +181,7 @@ namespace osu.Game.Tests.Beatmaps.Formats new Color4(128, 255, 128, 255), new Color4(255, 187, 255, 255), new Color4(255, 177, 140, 255), + new Color4(100, 100, 100, 100), }; Assert.AreEqual(expectedColors.Length, comboColors.Count); for (int i = 0; i < expectedColors.Length; i++) diff --git a/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu b/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu index 3e44dc0af8..67570ad21b 100644 --- a/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu +++ b/osu.Game.Tests/Resources/Soleily - Renatus (Gamu) [Insane].osu @@ -101,6 +101,7 @@ Combo3 : 128,255,255 Combo4 : 128,255,128 Combo5 : 255,187,255 Combo6 : 255,177,140 +Combo7 : 100,100,100,100 [HitObjects] 192,168,956,6,0,P|184:128|200:80,1,90,4|0,1:2|0:0,0:0:0:0: diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index e9f37e583b..7ac88dfc5b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -85,13 +85,18 @@ namespace osu.Game.Beatmaps.Formats string[] split = pair.Value.Split(','); - if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); + if (split.Length != 3 && split.Length != 4) + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}"); - if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) + byte a = 255; + + if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b) + || split.Length == 4 && !byte.TryParse(split[3], out a)) + { throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); + } - Color4 colour = new Color4(r, g, b, 255); + Color4 colour = new Color4(r, g, b, a); if (isCombo) { From 40c17cfa5a504577e1c1c119b4970f76d880c67c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 11:55:59 +0900 Subject: [PATCH 55/92] Remove ugly if-statement --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7ac88dfc5b..222f3589dc 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -88,16 +88,17 @@ namespace osu.Game.Beatmaps.Formats if (split.Length != 3 && split.Length != 4) throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B or R,G,B,A): {pair.Value}"); - byte a = 255; + Color4 colour; - if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b) - || split.Length == 4 && !byte.TryParse(split[3], out a)) + try + { + colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : 255); + } + catch (Exception e) { throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); } - Color4 colour = new Color4(r, g, b, a); - if (isCombo) { if (!(output is IHasComboColours tHasComboColours)) return; From 794501cc5a5297dff081c69eaf87e4a3e1a9ce2b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 12:06:24 +0900 Subject: [PATCH 56/92] Fix incorrect result of ternary --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 222f3589dc..a9e1e4c55d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps.Formats try { - colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : 255); + colour = new Color4(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]), split.Length == 4 ? byte.Parse(split[3]) : (byte)255); } catch (Exception e) { From 42664f1c190a065e4f11b3afea5f408ece96d739 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 15:45:45 +0900 Subject: [PATCH 57/92] Make SliderBody use the new SmoothPath --- .../Objects/Drawables/Pieces/SliderBody.cs | 120 +++++++++--------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index f3924ec43b..f4ccf673e9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -8,26 +8,23 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Lines; -using osu.Framework.Graphics.Textures; using OpenTK.Graphics.ES30; using OpenTK.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Rulesets.Objects.Types; using OpenTK; -using SixLabors.ImageSharp; -using SixLabors.ImageSharp.PixelFormats; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SliderBody : Container, ISliderProgress { - private readonly Path path; + private readonly SliderPath path; private readonly BufferedContainer container; public float PathWidth { - get { return path.PathWidth; } - set { path.PathWidth = value; } + get => path.PathWidth; + set => path.PathWidth = value; } /// @@ -43,48 +40,40 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public double? SnakedStart { get; private set; } public double? SnakedEnd { get; private set; } - private Color4 accentColour = Color4.White; - /// /// Used to colour the path. /// public Color4 AccentColour { - get { return accentColour; } + get => path.AccentColour; set { - if (accentColour == value) + if (path.AccentColour == value) return; - accentColour = value; + path.AccentColour = value; - if (LoadState >= LoadState.Ready) - reloadTexture(); + container.ForceRedraw(); } } - private Color4 borderColour = Color4.White; - /// /// Used to colour the path border. /// public new Color4 BorderColour { - get { return borderColour; } + get => path.BorderColour; set { - if (borderColour == value) + if (path.BorderColour == value) return; - borderColour = value; + path.BorderColour = value; - if (LoadState >= LoadState.Ready) - reloadTexture(); + container.ForceRedraw(); } } public Quad PathDrawQuad => container.ScreenSpaceDrawQuad; - private int textureWidth => (int)PathWidth * 2; - private Vector2 topLeftOffset; private readonly Slider slider; @@ -101,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces CacheDrawnFrameBuffer = true, Children = new Drawable[] { - path = new Path + path = new SliderPath { Blending = BlendingMode.None, }, @@ -134,46 +123,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces [BackgroundDependencyLoader] private void load() { - reloadTexture(); computeSize(); } - private void reloadTexture() - { - var texture = new Texture(textureWidth, 1); - - //initialise background - var raw = new Image(textureWidth, 1); - - const float aa_portion = 0.02f; - const float border_portion = 0.128f; - const float gradient_portion = 1 - border_portion; - - const float opacity_at_centre = 0.3f; - const float opacity_at_edge = 0.8f; - - for (int i = 0; i < textureWidth; i++) - { - float progress = (float)i / (textureWidth - 1); - - if (progress <= border_portion) - { - raw[i, 0] = new Rgba32(BorderColour.R, BorderColour.G, BorderColour.B, Math.Min(progress / aa_portion, 1) * BorderColour.A); - } - else - { - progress -= border_portion; - raw[i, 0] = new Rgba32(AccentColour.R, AccentColour.G, AccentColour.B, - (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * AccentColour.A); - } - } - - texture.SetData(new TextureUpload(raw)); - path.Texture = texture; - - container.ForceRedraw(); - } - private void computeSize() { // Generate the entire curve @@ -226,5 +178,53 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces SetRange(start, end); } + + private class SliderPath : SmoothPath + { + private const float border_portion = 0.128f; + private const float gradient_portion = 1 - border_portion; + + private const float opacity_at_centre = 0.3f; + private const float opacity_at_edge = 0.8f; + + private Color4 borderColour = Color4.White; + + public Color4 BorderColour + { + get => borderColour; + set + { + if (borderColour == value) + return; + borderColour = value; + + InvalidateTexture(); + } + } + + private Color4 accentColour = Color4.White; + + public Color4 AccentColour + { + get => accentColour; + set + { + if (accentColour == value) + return; + accentColour = value; + + InvalidateTexture(); + } + } + + protected override Color4 ColourAt(float position) + { + if (position <= border_portion) + return BorderColour; + + position -= border_portion; + return new Color4(AccentColour.R, AccentColour.G, AccentColour.B, (opacity_at_edge - (opacity_at_edge - opacity_at_centre) * position / gradient_portion) * AccentColour.A); + } + } } } From f7ebd063c39f66a0dd24cc61ad875fddd26f63e6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 5 Oct 2018 15:45:53 +0900 Subject: [PATCH 58/92] Make user profile graph use a smooth path --- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 3cb2446acc..ff2c4cf7cd 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -69,7 +69,7 @@ namespace osu.Game.Graphics.UserInterface { Masking = true, RelativeSizeAxes = Axes.Both, - Child = path = new Path { RelativeSizeAxes = Axes.Both, PathWidth = 1 } + Child = path = new SmoothPath { RelativeSizeAxes = Axes.Both, PathWidth = 1 } }); } From 8264dd49de638342b182996e7c6761d8831e46ca Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Fri, 5 Oct 2018 07:13:18 -0400 Subject: [PATCH 59/92] Update bindable only if enabled --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 7470dd0cd5..c698e9eeb0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -76,7 +76,10 @@ namespace osu.Game.Overlays.Toolbar modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, - Action = delegate { ruleset.Value = r; } + Action = delegate + { + if (!ruleset.Disabled) ruleset.Value = r; + } }); } From 8b27741cb0fb83a05766f14aefae59490e3a26b2 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Fri, 5 Oct 2018 11:37:44 -0400 Subject: [PATCH 60/92] Do not propagate positional input to subtree --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index c698e9eeb0..c5b583f390 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -76,10 +76,7 @@ namespace osu.Game.Overlays.Toolbar modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, - Action = delegate - { - if (!ruleset.Disabled) ruleset.Value = r; - } + Action = delegate { ruleset.Value = r; } }); } @@ -108,6 +105,8 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; + public override bool PropagatePositionalInputSubTree => false; + private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); protected override void Update() From ca9cbf1aead025c873fca0675030ec149cca6cd0 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 07:51:56 -0400 Subject: [PATCH 61/92] Fix rulsets being completed unselectable --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index c5b583f390..138f3ffc3f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => false; + public override bool PropagatePositionalInputSubTree => !ruleset.Disabled; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From 6b236e3f2a097279f57477f08ef0c486320ac33a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 08:06:26 -0400 Subject: [PATCH 62/92] Handle non positional input only when opened --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 26caf09b1b..41bdb78a4d 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -51,6 +51,8 @@ namespace osu.Game.Graphics.UserInterface #region OsuDropdownMenu protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour { + public override bool HandleNonPositionalInput => this.State == MenuState.Open; + // todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring public OsuDropdownMenu() { From aedb6e3bb77c331087632ce34c93c53c0cbfe600 Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Sat, 6 Oct 2018 08:12:29 -0400 Subject: [PATCH 63/92] Remove dedundant this qualifier --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 41bdb78a4d..04a7cb64d3 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface #region OsuDropdownMenu protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour { - public override bool HandleNonPositionalInput => this.State == MenuState.Open; + public override bool HandleNonPositionalInput => State == MenuState.Open; // todo: this uses the same styling as OsuMenu. hopefully we can just use OsuMenu in the future with some refactoring public OsuDropdownMenu() From da976000763e6bcf7975714fa971a08b48777bed Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 16:46:58 +0900 Subject: [PATCH 64/92] Fix inaccurate section lengths for first hitobject --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 5e91ed7a97..028e3acc57 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty double sectionLength = section_length * timeRate; // The first object doesn't generate a strain, so we begin with an incremented section end - double currentSectionEnd = 2 * sectionLength; + double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; foreach (OsuDifficultyHitObject h in difficultyBeatmap) { From 61e7ada977c3567463af8d48a38f7145c2605046 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:36:06 +0900 Subject: [PATCH 65/92] Use ints + fix position calculation --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 29de23406b..7f293fd099 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing var computeVertex = new Action(t => { // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPositionAt(t) - slider.LazyEndPosition.Value; + var diff = slider.StackedPositionAt(((int)t - (int)slider.StartTime) / (float)(int)slider.Duration) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From 1ad5090ad68b52da6a49114c5f5187e200bc05cc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:37:33 +0900 Subject: [PATCH 66/92] Separate travel distance from jump distance --- .../Preprocessing/OsuDifficultyHitObject.cs | 16 +++++++++++----- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 7f293fd099..2419709e41 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -21,9 +21,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public OsuHitObject BaseObject { get; } /// - /// Normalized distance from the of the previous . + /// Normalized distance from the end position of the previous . /// - public double Distance { get; private set; } + public double JumpDistance { get; private set; } + + /// + /// Normalized distance from the start position to the end position of the previous . + /// + public double TravelDistance { get; private set; } /// /// Milliseconds elapsed since the StartTime of the previous . @@ -51,10 +56,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private void setDistances() { // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps. - double scalingFactor = normalized_radius / BaseObject.Radius; + float scalingFactor = normalized_radius / (float)BaseObject.Radius; if (BaseObject.Radius < 30) { - double smallCircleBonus = Math.Min(30 - BaseObject.Radius, 5) / 50; + float smallCircleBonus = Math.Min(30 - (float)BaseObject.Radius, 5) / 50; scalingFactor *= 1 + smallCircleBonus; } @@ -69,7 +74,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - Distance = (lastTravelDistance + (BaseObject.StackedPosition - lastCursorPosition).Length) * scalingFactor; + JumpDistance = (BaseObject.StackedPosition - lastCursorPosition).Length * scalingFactor; + TravelDistance = lastTravelDistance * scalingFactor; } private void setTimingValues() diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 0a45c62671..9ffdd280aa 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -14,6 +14,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; - protected override double StrainValueOf(OsuDifficultyHitObject current) => Math.Pow(current.Distance, 0.99) / current.DeltaTime; + protected override double StrainValueOf(OsuDifficultyHitObject current) => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.DeltaTime; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index b807f20037..501a8e8e01 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueOf(OsuDifficultyHitObject current) { - double distance = current.Distance; + double distance = current.TravelDistance + current.JumpDistance; double speedValue; if (distance > single_spacing_threshold) From 35f45e74dc2e5e41da3dd186e78652b329610687 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 17:39:10 +0900 Subject: [PATCH 67/92] Calculate scaled positions prior to square-rooting --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 2419709e41..b9eaf9ff04 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.StackedPosition - lastCursorPosition).Length * scalingFactor; + JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; TravelDistance = lastTravelDistance * scalingFactor; } From 0116db95d0363f0ac15932980a307fd7ff458b5f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 18:37:30 +0900 Subject: [PATCH 68/92] Fix progress calculation --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index b9eaf9ff04..26db2e3faa 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; @@ -93,8 +94,14 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => { + double progress = ((int)t - (int)slider.StartTime) / (float)(int)slider.SpanDuration; + if (progress % 2 > 1) + progress = 1 - progress % 1; + else + progress = progress % 1; + // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPositionAt(((int)t - (int)slider.StartTime) / (float)(int)slider.Duration) - slider.LazyEndPosition.Value; + var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From f8eaccddda1d1b1657127e6ae29778d909904edb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 8 Oct 2018 18:37:49 +0900 Subject: [PATCH 69/92] Stable doesn't use stacked positions --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 26db2e3faa..44bec47e14 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing scalingFactor *= 1 + smallCircleBonus; } - Vector2 lastCursorPosition = lastObject.StackedPosition; + Vector2 lastCursorPosition = lastObject.Position; float lastTravelDistance = 0; var lastSlider = lastObject as Slider; @@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; + JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; TravelDistance = lastTravelDistance * scalingFactor; } @@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { if (slider.LazyEndPosition != null) return; - slider.LazyEndPosition = slider.StackedPosition; + slider.LazyEndPosition = slider.Position; float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => @@ -101,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing progress = progress % 1; // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; + var diff = slider.Position + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From b7499fa95627d054e9a3a881420a92808cf12ebe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 11:34:38 +0900 Subject: [PATCH 70/92] Allow TimingControlPoint to be overridden --- .../Beatmaps/ControlPoints/TimingControlPoint.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index eb60133fed..81eddaa43a 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -16,7 +16,7 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The beat length at this control point. /// - public double BeatLength + public virtual double BeatLength { get => beatLength; set => beatLength = MathHelper.Clamp(value, 6, 60000); diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 181d17932d..5b5bc5d936 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -318,12 +318,12 @@ namespace osu.Game.Beatmaps.Formats if (timingChange) { - handleTimingControlPoint(new TimingControlPoint - { - Time = time, - BeatLength = beatLength, - TimeSignature = timeSignature - }); + var controlPoint = CreateTimingControlPoint(); + controlPoint.Time = time; + controlPoint.BeatLength = beatLength; + controlPoint.TimeSignature = timeSignature; + + handleTimingControlPoint(controlPoint); } handleDifficultyControlPoint(new DifficultyControlPoint @@ -418,6 +418,8 @@ namespace osu.Game.Beatmaps.Formats private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0); + protected virtual TimingControlPoint CreateTimingControlPoint() => new TimingControlPoint(); + [Flags] internal enum EffectFlags { From 9facf707be57018b816417d6a8677f5719d87c35 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 11:49:24 +0900 Subject: [PATCH 71/92] Add diffcalc beatmap decoder --- .../Preprocessing/OsuDifficultyHitObject.cs | 1 - ...egacyDifficultyCalculatorBeatmapDecoder.cs | 36 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 44bec47e14..448dc140a3 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Osu.Objects; using OpenTK; diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs new file mode 100644 index 0000000000..61efd329c0 --- /dev/null +++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using osu.Game.Beatmaps.ControlPoints; + +namespace osu.Game.Beatmaps.Formats +{ + /// + /// A built for difficulty calculation of legacy s + /// + /// To use this, the decoder must be registered by the application through . + /// Doing so will override any existing decoders. + /// + /// + public class LegacyDifficultyCalculatorBeatmapDecoder : LegacyBeatmapDecoder + { + public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) + : base(version) + { + } + + public new static void Register() + { + AddDecoder(@"osu file format v", m => new LegacyDifficultyCalculatorBeatmapDecoder(int.Parse(m.Split('v').Last()))); + } + + protected override TimingControlPoint CreateTimingControlPoint() + => new LegacyDifficultyCalculatorControlPoint(); + + private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint + { + public override double BeatLength { get; set; } = 1000; + } + } +} From 0a3be0d253c076bfda1a95ebb26854808be30293 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 12:03:47 +0900 Subject: [PATCH 72/92] Adjust comments slightly --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 448dc140a3..a118d95ff7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -21,12 +21,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing public OsuHitObject BaseObject { get; } /// - /// Normalized distance from the end position of the previous . + /// Normalized distance from the end position of the previous to the start position of this . /// public double JumpDistance { get; private set; } /// - /// Normalized distance from the start position to the end position of the previous . + /// Normalized distance between the start and end position of the previous . /// public double TravelDistance { get; private set; } From a171ed350006fa6f918d527dbefccddf920c13c7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 9 Oct 2018 16:12:20 +0900 Subject: [PATCH 73/92] Fix joined channels not appearing as joined in the channel list --- osu.Game/Overlays/ChatOverlay.cs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index eeadac8e8c..ff2ff9af14 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -291,7 +291,7 @@ namespace osu.Game.Overlays messageRequest?.Cancel(); ListChannelsRequest req = new ListChannelsRequest(); - req.Success += delegate (List channels) + req.Success += delegate(List channels) { AvailableChannels = channels; @@ -323,10 +323,7 @@ namespace osu.Game.Overlays protected Channel CurrentChannel { - get - { - return currentChannel; - } + get { return currentChannel; } set { @@ -445,13 +442,7 @@ namespace osu.Game.Overlays if (updates?.Presence != null) { foreach (var channel in updates.Presence) - { - if (careChannels.Find(c => c.Id == channel.Id) == null) - { - channel.Joined.Value = true; - addChannel(channel); - } - } + addChannel(AvailableChannels.Find(c => c.Id == channel.Id)); foreach (var group in updates.Messages.GroupBy(m => m.ChannelId)) careChannels.Find(c => c.Id == group.Key)?.AddNewMessages(group.ToArray()); @@ -462,10 +453,7 @@ namespace osu.Game.Overlays fetchReq = null; }; - fetchReq.Failure += delegate - { - fetchReq = null; - }; + fetchReq.Failure += delegate { fetchReq = null; }; api.Queue(fetchReq); } From ccb6723711351e66a509f5c1ce6392a8fcdb27e4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 16:50:29 +0900 Subject: [PATCH 74/92] Debounce music controller seeks --- osu.Game/Overlays/MusicController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e3dc504e4d..b32fd265cb 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -196,10 +196,16 @@ namespace osu.Game.Overlays playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint); } + private ScheduledDelegate seekDelegate; + private void attemptSeek(double progress) { - if (!beatmap.Disabled) - current?.Track.Seek(progress); + seekDelegate?.Cancel(); + seekDelegate = Schedule(() => + { + if (!beatmap.Disabled) + current?.Track.Seek(progress); + }); } private void playlistOrderChanged(BeatmapSetInfo beatmapSetInfo, int index) From 6d24bde72ba8cd3ac6d932d2de8b685a21689d9b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 9 Oct 2018 17:39:27 +0900 Subject: [PATCH 75/92] Fix beatmap details not displaying --- osu.Game/Screens/Select/BeatmapDetails.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index f1bd2b945f..f7b955941d 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -327,11 +327,6 @@ namespace osu.Game.Screens.Select TextSize = 14, }, }, - textFlow = new OsuTextFlowContainer - { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - }, }, }; } @@ -350,6 +345,8 @@ namespace osu.Game.Screens.Select } } + public override bool IsPresent => base.IsPresent || textFlow == null; // Visibility is updated in the LoadComponentAsync callback + private void setTextAsync(string text) { LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14) From ae79c3832e720eef2b26cd9efeacf1081e93415a Mon Sep 17 00:00:00 2001 From: Paul Teng Date: Tue, 9 Oct 2018 11:05:15 -0400 Subject: [PATCH 76/92] Add base. for safety --- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 138f3ffc3f..fa35e53531 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Toolbar public override bool HandleNonPositionalInput => !ruleset.Disabled && base.HandleNonPositionalInput; public override bool HandlePositionalInput => !ruleset.Disabled && base.HandlePositionalInput; - public override bool PropagatePositionalInputSubTree => !ruleset.Disabled; + public override bool PropagatePositionalInputSubTree => !ruleset.Disabled && base.PropagatePositionalInputSubTree; private void disabledChanged(bool isDisabled) => this.FadeColour(isDisabled ? Color4.Gray : Color4.White, 300); From d6784c818e02d02c72a86ee3bb5071009b18be63 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 11:49:54 +0900 Subject: [PATCH 77/92] Fix jump/travel distances in some scenarios --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index a118d95ff7..0400f080d9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -74,8 +74,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing lastTravelDistance = lastSlider.LazyTravelDistance; } - JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; - TravelDistance = lastTravelDistance * scalingFactor; + // Don't need to jump to reach spinners + if (!(BaseObject is Spinner)) + JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; + + // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! + if (BaseObject is Slider) + TravelDistance = lastTravelDistance * scalingFactor; } private void setTimingValues() From 1125075b374ea717111998ab4f0f20a357baf98d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 13:02:27 +0900 Subject: [PATCH 78/92] Use list with post-sort for nested hitobjects --- osu.Game/Rulesets/Objects/HitObject.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index beb9620f78..80a3677b12 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly Lazy> nestedHitObjects = new Lazy>(() => new SortedList((h1, h2) => h1.StartTime.CompareTo(h2.StartTime))); + private readonly Lazy> nestedHitObjects = new Lazy>(() => new List()); [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; @@ -79,6 +79,8 @@ namespace osu.Game.Rulesets.Objects if (nestedHitObjects.IsValueCreated) { + nestedHitObjects.Value.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); + nestedHitObjects.Value.ForEach(h => { h.HitWindows = HitWindows; From 417ebaeb857a50f65f484ca5c6d424539046f3b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 13:03:18 +0900 Subject: [PATCH 79/92] Reduce hitobject size by removing lazy --- osu.Game/Rulesets/Objects/HitObject.cs | 27 ++++++++++---------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 80a3677b12..e52d6b416f 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -1,11 +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 Newtonsoft.Json; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -58,10 +55,10 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly Lazy> nestedHitObjects = new Lazy>(() => new List()); + private readonly List nestedHitObjects = new List(); [JsonIgnore] - public IReadOnlyList NestedHitObjects => nestedHitObjects.Value; + public IReadOnlyList NestedHitObjects => nestedHitObjects; /// /// Applies default values to this HitObject. @@ -72,21 +69,17 @@ namespace osu.Game.Rulesets.Objects { ApplyDefaultsToSelf(controlPointInfo, difficulty); - if (nestedHitObjects.IsValueCreated) - nestedHitObjects.Value.Clear(); + nestedHitObjects.Clear(); CreateNestedHitObjects(); - if (nestedHitObjects.IsValueCreated) - { - nestedHitObjects.Value.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); + nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - nestedHitObjects.Value.ForEach(h => - { - h.HitWindows = HitWindows; - h.ApplyDefaults(controlPointInfo, difficulty); - }); - } + nestedHitObjects.ForEach(h => + { + h.HitWindows = HitWindows; + h.ApplyDefaults(controlPointInfo, difficulty); + }); } protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) @@ -106,7 +99,7 @@ namespace osu.Game.Rulesets.Objects { } - protected void AddNested(HitObject hitObject) => nestedHitObjects.Value.Add(hitObject); + protected void AddNested(HitObject hitObject) => nestedHitObjects.Add(hitObject); /// /// Creates the that represents the scoring information for this . From f53bb81723372ab9bb462b616ecdb89e73058b4c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 14:58:29 +0900 Subject: [PATCH 80/92] Remove unnecessary lambda allocation --- osu.Game/Rulesets/Objects/HitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index e52d6b416f..67a3db7a00 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -75,11 +75,11 @@ namespace osu.Game.Rulesets.Objects nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - nestedHitObjects.ForEach(h => + foreach (var h in nestedHitObjects) { h.HitWindows = HitWindows; h.ApplyDefaults(controlPointInfo, difficulty); - }); + } } protected virtual void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) From 03a95113994fa92d8a296370c373acc0cad65cd7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:08:46 +0900 Subject: [PATCH 81/92] Apparently stable does use stacking --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 0400f080d9..fd36e85f26 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing scalingFactor *= 1 + smallCircleBonus; } - Vector2 lastCursorPosition = lastObject.Position; + Vector2 lastCursorPosition = lastObject.StackedPosition; float lastTravelDistance = 0; var lastSlider = lastObject as Slider; @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing // Don't need to jump to reach spinners if (!(BaseObject is Spinner)) - JumpDistance = (BaseObject.Position * scalingFactor - lastCursorPosition * scalingFactor).Length; + JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! if (BaseObject is Slider) @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing progress = progress % 1; // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.Position + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; + var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value; float dist = diff.Length; if (dist > approxFollowCircleRadius) From d8f77feddd705e9fc986b4c4ec3b0b3c4472f273 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:52:57 +0900 Subject: [PATCH 82/92] Fix using the wrong slider's travel distance --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index fd36e85f26..1c5b28f407 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -64,23 +64,21 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing } Vector2 lastCursorPosition = lastObject.StackedPosition; - float lastTravelDistance = 0; var lastSlider = lastObject as Slider; if (lastSlider != null) { computeSliderCursorPosition(lastSlider); lastCursorPosition = lastSlider.LazyEndPosition ?? lastCursorPosition; - lastTravelDistance = lastSlider.LazyTravelDistance; } // Don't need to jump to reach spinners if (!(BaseObject is Spinner)) JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length; - // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also sliders! + // Todo: BUG!!! Last slider's travel distance is considered ONLY IF we ourselves are also a slider! if (BaseObject is Slider) - TravelDistance = lastTravelDistance * scalingFactor; + TravelDistance = (lastSlider?.LazyTravelDistance ?? 0) * scalingFactor; } private void setTimingValues() From 4e37b5c4a7878b11905efd2c4be80ba5e10f33f0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 18:53:54 +0900 Subject: [PATCH 83/92] 50ms cap shouldn't be included in the strain decay --- .../Preprocessing/OsuDifficultyHitObject.cs | 11 +++++++++-- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 3 ++- osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 1c5b28f407..4905c007b9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -35,6 +35,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing /// public double DeltaTime { get; private set; } + /// + /// Milliseconds elapsed since the start time of the previous , with a minimum of 50ms. + /// + public double StrainTime { get; private set; } + private readonly OsuHitObject lastObject; private readonly double timeRate; @@ -83,8 +88,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private void setTimingValues() { - // Every timing inverval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure. - DeltaTime = Math.Max(50, (BaseObject.StartTime - lastObject.StartTime) / timeRate); + DeltaTime = (BaseObject.StartTime - lastObject.StartTime) / timeRate; + + // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure + StrainTime = Math.Max(50, DeltaTime); } private void computeSliderCursorPosition(Slider slider) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index 9ffdd280aa..f11b6d66f6 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; - protected override double StrainValueOf(OsuDifficultyHitObject current) => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.DeltaTime; + protected override double StrainValueOf(OsuDifficultyHitObject current) + => (Math.Pow(current.TravelDistance, 0.99) + Math.Pow(current.JumpDistance, 0.99)) / current.StrainTime; } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index 501a8e8e01..1cde03624b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills else speedValue = 0.95; - return speedValue / current.DeltaTime; + return speedValue / current.StrainTime; } } } From d28b9860ff5e47ea467f871405626f619b881569 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Oct 2018 19:26:35 +0900 Subject: [PATCH 84/92] Don't use "beatmapset" terminology --- 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 f17496e200..b4f552ce93 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -204,7 +204,7 @@ namespace osu.Game.Screens.Select Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3); - BeatmapOptions.AddButton(@"Delete", @"beatmapset", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); + BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); } if (this.beatmaps == null) From ed0dcb2e7333e47d5cf66d4cdd27cd48d4300292 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 10 Oct 2018 19:41:40 +0900 Subject: [PATCH 85/92] Add comment explaining why --- osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs index d871cdd322..fca04ca513 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableHitObject.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Mods { /// /// Applies this to a list of s. + /// This will only be invoked with top-level s. Access if adjusting nested objects is necessary. /// /// The list of s to apply to. void ApplyToDrawableHitObjects(IEnumerable drawables); From f675c939356a9140c7a4e77b7adbbd602f0e986e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 10 Oct 2018 21:37:02 +0900 Subject: [PATCH 86/92] Stably-sort hitobjects --- .../Difficulty/Preprocessing/OsuDifficultyBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs index 4443a0e66b..24d4677981 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing @@ -23,8 +24,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { // Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases. // This should probably happen before the objects reach the difficulty calculator. - objects.Sort((a, b) => a.StartTime.CompareTo(b.StartTime)); - difficultyObjects = createDifficultyObjectEnumerator(objects, timeRate); + difficultyObjects = createDifficultyObjectEnumerator(objects.OrderBy(h => h.StartTime).ToList(), timeRate); } /// From 7d20efed2c9318b5bd7e1391902714438085a206 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 13:53:29 +0900 Subject: [PATCH 87/92] Fix missing stack position --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 4905c007b9..ccfcc1ef25 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -98,7 +98,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { if (slider.LazyEndPosition != null) return; - slider.LazyEndPosition = slider.Position; + slider.LazyEndPosition = slider.StackedPosition; float approxFollowCircleRadius = (float)(slider.Radius * 3); var computeVertex = new Action(t => From 0c4403ef16b17a71208537321b4ed6fd80c3a975 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 13:53:49 +0900 Subject: [PATCH 88/92] Don't apply version offset during diff calc --- .../Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs index 61efd329c0..13a71aac3d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDifficultyCalculatorBeatmapDecoder.cs @@ -18,6 +18,7 @@ namespace osu.Game.Beatmaps.Formats public LegacyDifficultyCalculatorBeatmapDecoder(int version = LATEST_VERSION) : base(version) { + ApplyOffsets = false; } public new static void Register() From d282d16e1cb31595e4e140d8a49179a182ee8c98 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 11 Oct 2018 20:49:12 +0900 Subject: [PATCH 89/92] Use SortedList again --- osu.Game/Rulesets/Objects/HitObject.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/HitObject.cs b/osu.Game/Rulesets/Objects/HitObject.cs index 67a3db7a00..f5613e927f 100644 --- a/osu.Game/Rulesets/Objects/HitObject.cs +++ b/osu.Game/Rulesets/Objects/HitObject.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using Newtonsoft.Json; +using osu.Framework.Lists; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; @@ -55,7 +56,7 @@ namespace osu.Game.Rulesets.Objects /// public HitWindows HitWindows { get; set; } - private readonly List nestedHitObjects = new List(); + private readonly SortedList nestedHitObjects = new SortedList(compareObjects); [JsonIgnore] public IReadOnlyList NestedHitObjects => nestedHitObjects; @@ -73,8 +74,6 @@ namespace osu.Game.Rulesets.Objects CreateNestedHitObjects(); - nestedHitObjects.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime)); - foreach (var h in nestedHitObjects) { h.HitWindows = HitWindows; @@ -115,5 +114,7 @@ namespace osu.Game.Rulesets.Objects /// /// protected virtual HitWindows CreateHitWindows() => new HitWindows(); + + private static int compareObjects(HitObject first, HitObject second) => first.StartTime.CompareTo(second.StartTime); } } From c52a2929352280e75c32396db4a5a2ce2c9be413 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 16:10:32 +0900 Subject: [PATCH 90/92] Update framework --- 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 66bae277b3..9ff79550fa 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 72c8ae8705bae27510e112b311237f3df4ff749a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 12 Oct 2018 16:47:18 +0900 Subject: [PATCH 91/92] Port the old stacking algorithm --- .../Beatmaps/OsuBeatmapProcessor.cs | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs index cfb1b0f050..db80948c94 100644 --- a/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Osu/Beatmaps/OsuBeatmapProcessor.cs @@ -10,6 +10,8 @@ namespace osu.Game.Rulesets.Osu.Beatmaps { public class OsuBeatmapProcessor : BeatmapProcessor { + private const int stack_distance = 3; + public OsuBeatmapProcessor(IBeatmap beatmap) : base(beatmap) { @@ -18,17 +20,21 @@ namespace osu.Game.Rulesets.Osu.Beatmaps public override void PostProcess() { base.PostProcess(); - applyStacking((Beatmap)Beatmap); + + var osuBeatmap = (Beatmap)Beatmap; + + // Reset stacking + foreach (var h in osuBeatmap.HitObjects) + h.StackHeight = 0; + + if (Beatmap.BeatmapInfo.BeatmapVersion >= 6) + applyStacking(osuBeatmap); + else + applyStackingOld(osuBeatmap); } private void applyStacking(Beatmap beatmap) { - const int stack_distance = 3; - - // Reset stacking - for (int i = 0; i <= beatmap.HitObjects.Count - 1; i++) - beatmap.HitObjects[i].StackHeight = 0; - // Extend the end index to include objects they are stacked on int extendedEndIndex = beatmap.HitObjects.Count - 1; for (int i = beatmap.HitObjects.Count - 1; i >= 0; i--) @@ -167,5 +173,40 @@ namespace osu.Game.Rulesets.Osu.Beatmaps } } } + + private void applyStackingOld(Beatmap beatmap) + { + for (int i = 0; i < beatmap.HitObjects.Count; i++) + { + OsuHitObject currHitObject = beatmap.HitObjects[i]; + + if (currHitObject.StackHeight != 0 && !(currHitObject is Slider)) + continue; + + double startTime = (currHitObject as IHasEndTime)?.EndTime ?? currHitObject.StartTime; + int sliderStack = 0; + + for (int j = i + 1; j < beatmap.HitObjects.Count; j++) + { + double stackThreshold = beatmap.HitObjects[i].TimePreempt * beatmap.BeatmapInfo.StackLeniency; + + if (beatmap.HitObjects[j].StartTime - stackThreshold > startTime) + break; + + if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.Position) < stack_distance) + { + currHitObject.StackHeight++; + startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime; + } + else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, currHitObject.EndPosition) < stack_distance) + { + //Case for sliders - bump notes down and right, rather than up and left. + sliderStack++; + beatmap.HitObjects[j].StackHeight -= sliderStack; + startTime = (beatmap.HitObjects[j] as IHasEndTime)?.EndTime ?? beatmap.HitObjects[i].StartTime; + } + } + } + } } } From 182aa63cc8acd7637d91cf95dd6bb685f2c59373 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Oct 2018 17:08:59 +0900 Subject: [PATCH 92/92] Update nuget dependencies --- osu.Desktop/osu.Desktop.csproj | 6 +++--- .../osu.Game.Rulesets.Catch.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- .../osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 803927bc6f..1e8bf05e01 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,9 +27,9 @@ - - - + + + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 51343d9e91..9e89539e25 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,8 +2,8 @@ - - + + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 3165f69a6b..724614e8d5 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 247d5e18c1..69982b1914 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 08a0579561..11d6025f6d 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index d638af0c38..eb9d819fcb 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -3,7 +3,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 9ff79550fa..22e5901ed6 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,13 +14,13 @@ - + - + - +