From dd9b9a18ac4571ffda22f5b883452d16dbabcc66 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 8 May 2018 16:21:54 +0300 Subject: [PATCH 01/42] Prevent user from scrolling outside the timeline in the editor --- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Edit/EditorClock.cs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index adb749b492..0e0f3fa9f1 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Edit { // TODO: should probably be done at a RulesetContainer level to share logic with Player. var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); - clock = new EditorClock(Beatmap.Value.Beatmap.ControlPointInfo, beatDivisor) { IsCoupled = false }; + clock = new EditorClock(Beatmap, beatDivisor) { IsCoupled = false }; clock.ChangeSource(sourceClock); dependencies.CacheAs(clock); diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 67025f0620..02bf581716 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -3,8 +3,10 @@ using System; using System.Linq; +using osu.Framework.Configuration; using osu.Framework.MathUtils; using osu.Framework.Timing; +using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Screens.Edit.Screens.Compose; @@ -15,10 +17,20 @@ namespace osu.Game.Screens.Edit /// public class EditorClock : DecoupleableInterpolatingFramedClock { + public Bindable Beatmap = new Bindable(); + public ControlPointInfo ControlPointInfo; private readonly BindableBeatDivisor beatDivisor; + public EditorClock(Bindable beatmap, BindableBeatDivisor beatDivisor) + { + this.beatDivisor = beatDivisor; + + Beatmap.BindTo(beatmap); + + ControlPointInfo = Beatmap.Value.Beatmap.ControlPointInfo; + } public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor) { this.beatDivisor = beatDivisor; @@ -111,6 +123,7 @@ namespace osu.Game.Screens.Edit if (seekTime > nextTimingPoint?.Time) seekTime = nextTimingPoint.Time; + seekTime = Math.Min(Math.Max(0, seekTime), Beatmap.Value.Track.Length); // Ensure the sought point is within the song's length Seek(seekTime); } } From e44062b77a54e792fdcb84fd1c9379cec473aafc Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 8 May 2018 16:37:06 +0300 Subject: [PATCH 02/42] Fix tests and implementation --- osu.Game/Screens/Edit/EditorClock.cs | 15 +++++++++------ osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 02bf581716..88d8477233 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -17,7 +17,9 @@ namespace osu.Game.Screens.Edit /// public class EditorClock : DecoupleableInterpolatingFramedClock { - public Bindable Beatmap = new Bindable(); + //public Bindable Beatmap = new Bindable(); + + public double TrackLength; public ControlPointInfo ControlPointInfo; @@ -27,15 +29,15 @@ namespace osu.Game.Screens.Edit { this.beatDivisor = beatDivisor; - Beatmap.BindTo(beatmap); - - ControlPointInfo = Beatmap.Value.Beatmap.ControlPointInfo; + ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo; + TrackLength = beatmap.Value.Track.Length; } - public EditorClock(ControlPointInfo controlPointInfo, BindableBeatDivisor beatDivisor) + public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor) { this.beatDivisor = beatDivisor; ControlPointInfo = controlPointInfo; + TrackLength = trackLength; } /// @@ -123,7 +125,8 @@ namespace osu.Game.Screens.Edit if (seekTime > nextTimingPoint?.Time) seekTime = nextTimingPoint.Time; - seekTime = Math.Min(Math.Max(0, seekTime), Beatmap.Value.Track.Length); // Ensure the sought point is within the song's length + // Ensure the sought point is within the boundaries + seekTime = Math.Min(Math.Max(0, seekTime), TrackLength); Seek(seekTime); } } diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 43b20f7021..85d3684530 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual protected EditorClockTestCase() { - Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false }; + Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false }; } [BackgroundDependencyLoader] From 6676c55fe05f0f413b95740381f35738e13adfcd Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Wed, 9 May 2018 17:22:37 +0300 Subject: [PATCH 03/42] Introduce InputSettings --- .../Play/PlayerSettings/InputSettings.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 osu.Game/Screens/Play/PlayerSettings/InputSettings.cs diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs new file mode 100644 index 0000000000..f9dda01c8c --- /dev/null +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -0,0 +1,39 @@ +// 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.Game.Configuration; + +namespace osu.Game.Screens.Play.PlayerSettings +{ + public class InputSettings : PlayerSettingsGroup + { + protected override string Title => "Input settings"; + + private readonly PlayerCheckbox mouseWheelCheckbox; + private readonly PlayerCheckbox mouseButtonsCheckbox; + + public InputSettings() + { + Children = new Drawable[] + { + mouseWheelCheckbox = new PlayerCheckbox + { + LabelText = "Disable mouse wheel during gameplay" + }, + mouseButtonsCheckbox = new PlayerCheckbox + { + LabelText = "Disable mouse buttons during gameplay" + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseWheelCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableWheel); + mouseButtonsCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableButtons); + } + } +} From ccf82cacb029784988189ab9cbf462b1f91609df Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Wed, 9 May 2018 17:31:52 +0300 Subject: [PATCH 04/42] Show InputSettings on the PlayerLoader screen --- osu.Game/Screens/Play/PlayerLoader.cs | 18 +++++++++++++----- .../Play/PlayerSettings/InputSettings.cs | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 56fbd7b6e7..13293b6f93 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -7,15 +7,15 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Input; +using osu.Framework.Localisation; using osu.Framework.Screens; +using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using OpenTK; -using osu.Framework.Localisation; -using osu.Framework.Threading; using osu.Game.Screens.Menu; using osu.Game.Screens.Play.PlayerSettings; +using OpenTK; namespace osu.Game.Screens.Play { @@ -51,11 +51,19 @@ namespace osu.Game.Screens.Play Origin = Anchor.Centre, }); - Add(new VisualSettings + Add(new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Margin = new MarginPadding(25) + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Vertical, + Spacing = new Vector2(0, 20), + Margin = new MarginPadding { Top = 100, Right = 10 }, + Children = new PlayerSettingsGroup[] + { + new VisualSettings(), + new InputSettings() + } }); loadTask = LoadComponentAsync(player); diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index f9dda01c8c..25b6ebc2c3 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -20,11 +20,11 @@ namespace osu.Game.Screens.Play.PlayerSettings { mouseWheelCheckbox = new PlayerCheckbox { - LabelText = "Disable mouse wheel during gameplay" + LabelText = "Disable mouse wheel" }, mouseButtonsCheckbox = new PlayerCheckbox { - LabelText = "Disable mouse buttons during gameplay" + LabelText = "Disable mouse buttons" } }; } From 93029fd5482d4fec1f493bfb83f41417283dcd67 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Thu, 10 May 2018 20:38:55 +0300 Subject: [PATCH 05/42] Remove mouseWheelCheckbox from InputSettings player overlay --- osu.Game/Screens/Play/PlayerSettings/InputSettings.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index 25b6ebc2c3..755ba468cc 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -11,17 +11,12 @@ namespace osu.Game.Screens.Play.PlayerSettings { protected override string Title => "Input settings"; - private readonly PlayerCheckbox mouseWheelCheckbox; private readonly PlayerCheckbox mouseButtonsCheckbox; public InputSettings() { Children = new Drawable[] { - mouseWheelCheckbox = new PlayerCheckbox - { - LabelText = "Disable mouse wheel" - }, mouseButtonsCheckbox = new PlayerCheckbox { LabelText = "Disable mouse buttons" @@ -30,10 +25,6 @@ namespace osu.Game.Screens.Play.PlayerSettings } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - mouseWheelCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableWheel); - mouseButtonsCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableButtons); - } + private void load(OsuConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableButtons); } } From 2a90686da622cbf9d6619bb787e3cc370de07906 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Sat, 12 May 2018 15:09:53 +0300 Subject: [PATCH 06/42] Simplify expression --- osu-framework | 2 +- osu.Game/Screens/Edit/EditorClock.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu-framework b/osu-framework index 0773d895d9..e793a08417 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 0773d895d9aa0729995cd4a23efc28238e35ceed +Subproject commit e793a084177f53920645c4f6f70cfef91e7fd19e diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 88d8477233..6cae4d9187 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -9,6 +9,7 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Screens.Edit.Screens.Compose; +using OpenTK; namespace osu.Game.Screens.Edit { @@ -126,7 +127,7 @@ namespace osu.Game.Screens.Edit seekTime = nextTimingPoint.Time; // Ensure the sought point is within the boundaries - seekTime = Math.Min(Math.Max(0, seekTime), TrackLength); + seekTime = MathHelper.Clamp(seekTime, 0, TrackLength); Seek(seekTime); } } From 6f94c110a56e975c74417548efbc9841e67c6315 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Thu, 17 May 2018 23:09:13 +0300 Subject: [PATCH 07/42] Fix submodule conflict --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index e793a08417..fac688633b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit e793a084177f53920645c4f6f70cfef91e7fd19e +Subproject commit fac688633b8fcf34ae5d0514c26b03e217161eb4 From 1f37dca7b7ea0ce8a19ae1ea7b426b1e7a4547c8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 19 May 2018 14:47:06 +0900 Subject: [PATCH 08/42] Fix HR / EZ being applied twice to AR --- .../Difficulty/OsuPerformanceCalculator.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index eeb776fa6e..ae74f12339 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -61,17 +61,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (mods.Any(m => !m.Ranked)) return 0; - // Todo: In the future we should apply changes to PreEmpt/AR at an OsuHitObject/BaseDifficulty level, but this is done - // locally for now as doing so would modify animations and other things unexpectedly - // DO NOT MODIFY THIS - double ar = Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate; - if (mods.Any(m => m is OsuModHardRock)) - ar = Math.Min(10, ar * 1.4); - if (mods.Any(m => m is OsuModEasy)) - ar = Math.Max(0, ar / 2); - - double preEmpt = BeatmapDifficulty.DifficultyRange(ar, 1800, 1200, 450) / TimeRate; double hitWindowGreat = (Beatmap.HitObjects.First().HitWindows.Great / 2 - 0.5) / TimeRate; + double preEmpt = BeatmapDifficulty.DifficultyRange(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / TimeRate; realApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5; realOverallDifficulty = (80 - 0.5 - hitWindowGreat) / 6; From a54bda6ce1f15c98643014534e1be914834fa2ae Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 21 May 2018 13:23:39 +0300 Subject: [PATCH 09/42] Apply requested changes --- osu-framework | 2 +- osu.Game/Screens/Edit/EditorClock.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index fac688633b..80e78fd45b 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit fac688633b8fcf34ae5d0514c26b03e217161eb4 +Subproject commit 80e78fd45bb79ca4bc46ecc05deb6058f3879faa diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 6cae4d9187..72fb91e7df 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -18,9 +18,7 @@ namespace osu.Game.Screens.Edit /// public class EditorClock : DecoupleableInterpolatingFramedClock { - //public Bindable Beatmap = new Bindable(); - - public double TrackLength; + public readonly double TrackLength; public ControlPointInfo ControlPointInfo; @@ -33,6 +31,7 @@ namespace osu.Game.Screens.Edit ControlPointInfo = beatmap.Value.Beatmap.ControlPointInfo; TrackLength = beatmap.Value.Track.Length; } + public EditorClock(ControlPointInfo controlPointInfo, double trackLength, BindableBeatDivisor beatDivisor) { this.beatDivisor = beatDivisor; From 30956b64aa394fa51bc2b23084519b23fd9b2417 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Mon, 21 May 2018 18:57:01 +0300 Subject: [PATCH 10/42] Do not change Margin for player settings groups on the PlayerLoader screen --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 13293b6f93..06c1503fd1 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 20), - Margin = new MarginPadding { Top = 100, Right = 10 }, + Margin = new MarginPadding(25), Children = new PlayerSettingsGroup[] { new VisualSettings(), From 1210368e29bdf8ebfb159894067cb9679add1fae Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Mon, 21 May 2018 23:00:02 -0300 Subject: [PATCH 11/42] Add MultiplayerScreen base class. --- osu.Game/Screens/Multi/Header.cs | 3 +- .../Multi/Screens/MultiplayerScreen.cs | 57 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index db8898495f..f6b7bbfcef 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -10,6 +10,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.SearchableList; +using osu.Game.Screens.Multi.Screens; using OpenTK; using OpenTK.Graphics; @@ -85,7 +86,7 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => screenTitle.Text = s.ToString(); + breadcrumbs.Current.ValueChanged += s => screenTitle.Text = s is MultiplayerScreen m ? m.Title : s.ToString(); breadcrumbs.Current.TriggerChange(); } diff --git a/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs b/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs new file mode 100644 index 0000000000..5a17a32d8c --- /dev/null +++ b/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; +using osu.Game.Graphics.Containers; + +namespace osu.Game.Screens.Multi.Screens +{ + public abstract class MultiplayerScreen : OsuScreen + { + private const Easing in_easing = Easing.OutQuint; + private const Easing out_easing = Easing.InSine; + + protected virtual Container TransitionContent => Content; + + public abstract string Title { get; } + public abstract string Name { get; } + + public override string ToString() => Name; + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + + TransitionContent.MoveToX(200); + + TransitionContent.FadeInFromZero(WaveContainer.APPEAR_DURATION, in_easing); + TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing); + } + + protected override bool OnExiting(Screen next) + { + Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing); + TransitionContent.MoveToX(200, WaveContainer.DISAPPEAR_DURATION, out_easing); + + return base.OnExiting(next); + } + + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + + Content.FadeIn(WaveContainer.APPEAR_DURATION, in_easing); + TransitionContent.MoveToX(0, WaveContainer.APPEAR_DURATION, in_easing); + } + + protected override void OnSuspending(Screen next) + { + base.OnSuspending(next); + + Content.FadeOut(WaveContainer.DISAPPEAR_DURATION, out_easing); + TransitionContent.MoveToX(-200, WaveContainer.DISAPPEAR_DURATION, out_easing); + } + } +} From cae09492c30749096e2b6c54351234527f47be27 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 00:07:04 -0300 Subject: [PATCH 12/42] Basic Lounge functionality. --- osu.Game.Tests/Visual/TestCaseLounge.cs | 158 ++++++++++++++++++ osu.Game.Tests/Visual/TestCaseMultiHeader.cs | 6 +- .../Screens/Multi/Components/DrawableRoom.cs | 33 +++- osu.Game/Screens/Multi/Multiplayer.cs | 8 +- osu.Game/Screens/Multi/Screens/Lobby.cs | 16 -- osu.Game/Screens/Multi/Screens/Lounge.cs | 115 +++++++++++++ osu.Game/Screens/Multi/Screens/Match.cs | 5 + 7 files changed, 312 insertions(+), 29 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseLounge.cs delete mode 100644 osu.Game/Screens/Multi/Screens/Lobby.cs create mode 100644 osu.Game/Screens/Multi/Screens/Lounge.cs diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs new file mode 100644 index 0000000000..b621899949 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLounge.cs @@ -0,0 +1,158 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Online.Multiplayer; +using osu.Game.Rulesets; +using osu.Game.Screens.Multi.Screens; +using osu.Game.Users; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseLounge : OsuTestCase + { + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets) + { + Lounge lounge = new Lounge(); + + Room[] rooms = + { + new Room + { + Name = { Value = @"Just Another Room" }, + Host = { Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } } }, + Status = { Value = new RoomStatusPlaying() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 5.65, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"Sidetracked Day (Short Ver.)", + Artist = @"VINXIS", + AuthorString = @"Hobbes2", + }, + BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh/beatmaps/767600/covers/cover.jpg?1526243446", + }, + }, + }, + } + }, + MaxParticipants = { Value = 10 }, + Participants = + { + Value = new[] + { + new User { Username = @"flyte", Id = 3103765, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 142 } } }, + new User { Username = @"Cookiezi", Id = 124493, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 546 } } }, + new User { Username = @"Angelsim", Id = 1777162, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 287 } } }, + new User { Username = @"Rafis", Id = 2558286, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 468 } } }, + new User { Username = @"hvick225", Id = 50265, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 325 } } }, + new User { Username = @"peppy", Id = 2, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 625 } } }, + } + } + }, + new Room + { + Name = { Value = @"Not Just Any Room" }, + Host = { Value = new User { Username = @"Monstrata", Id = 2706438, Country = new Country { FlagName = @"CA" } } }, + Status = { Value = new RoomStatusOpen() }, + Type = { Value = new GameTypeTeamVersus() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 2.73, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"lit(var)", + Artist = @"kensuke ushio", + AuthorString = @"Monstrata", + }, + BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh/beatmaps/623972/covers/cover.jpg?1521167183", + }, + }, + }, + } + }, + Participants = + { + Value = new[] + { + new User { Username = @"Jeby", Id = 3136279, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 3497 } } }, + new User { Username = @"DualAkira", Id = 5220933, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 643 } } }, + new User { Username = @"Datenshi Yohane", Id = 7171857, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 10555 } } }, + } + } + }, + new Room + { + Name = { Value = @"room THE FINAL" }, + Host = { Value = new User { Username = @"Delis", Id = 1603923, Country = new Country { FlagName = @"JP" } } }, + Status = { Value = new RoomStatusPlaying() }, + Type = { Value = new GameTypeTagTeam() }, + Beatmap = + { + Value = new BeatmapInfo + { + StarDifficulty = 4.48, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"663098", + Artist = @"OISHII", + AuthorString = @"Mentholzzz", + }, + BeatmapSet = new BeatmapSetInfo + { + OnlineInfo = new BeatmapSetOnlineInfo + { + Covers = new BeatmapSetOnlineCovers + { + Cover = @"https://assets.ppy.sh/beatmaps/663098/covers/cover.jpg?1521898837", + }, + }, + }, + } + }, + MaxParticipants = { Value = 30 }, + Participants = + { + Value = new[] + { + new User { Username = @"KizuA", Id = 6510442, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 5372 } } }, + new User { Username = @"Colored", Id = 827563, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 810 } } }, + new User { Username = @"Beryl", Id = 3817591, Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 10096 } } }, + } + } + }, + }; + + AddStep(@"show", () => Add(lounge)); + AddStep(@"set rooms", () => lounge.Rooms = rooms); + AddStep(@"clear rooms", () => lounge.Rooms = new Room[] {}); + AddStep(@"set rooms", () => lounge.Rooms = rooms); + AddStep(@"exit", lounge.Exit); + } + } +} diff --git a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs index af51a6221f..4406676aca 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs @@ -13,14 +13,14 @@ namespace osu.Game.Tests.Visual { public TestCaseMultiHeader() { - Lobby lobby; + Lounge lounge; Children = new Drawable[] { - lobby = new Lobby + lounge = new Lounge { Padding = new MarginPadding { Top = Header.HEIGHT }, }, - new Header(lobby), + new Header(lounge), }; } } diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 88a253d719..e5ba1a87cf 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; @@ -25,8 +26,8 @@ namespace osu.Game.Screens.Multi.Components { public class DrawableRoom : OsuClickableContainer, IStateful { + public const float SELECTION_BORDER_WIDTH = 4; private const float corner_radius = 5; - private const float selection_border_width = 4; private const float transition_duration = 100; private const float content_padding = 10; private const float height = 100; @@ -62,6 +63,17 @@ namespace osu.Game.Screens.Multi.Components } } + private Action action; + public new Action Action + { + get { return action; } + set + { + action = value; + Enabled.Value = action != null; + } + } + public event Action StateChanged; public DrawableRoom(Room room) @@ -69,8 +81,8 @@ namespace osu.Game.Screens.Multi.Components Room = room; RelativeSizeAxes = Axes.X; - Height = height + selection_border_width * 2; - CornerRadius = corner_radius + selection_border_width / 2; + Height = height + SELECTION_BORDER_WIDTH * 2; + CornerRadius = corner_radius + SELECTION_BORDER_WIDTH / 2; Masking = true; // create selectionBox here so State can be set before being loaded @@ -79,8 +91,6 @@ namespace osu.Game.Screens.Multi.Components RelativeSizeAxes = Axes.Both, Alpha = 0f, }; - - Action += () => State = SelectionState.Selected; } [BackgroundDependencyLoader] @@ -98,7 +108,7 @@ namespace osu.Game.Screens.Multi.Components new Container { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding(selection_border_width), + Padding = new MarginPadding(SELECTION_BORDER_WIDTH), Child = new Container { RelativeSizeAxes = Axes.Both, @@ -272,5 +282,16 @@ namespace osu.Game.Screens.Multi.Components beatmapBind.BindTo(Room.Beatmap); participantsBind.BindTo(Room.Participants); } + + protected override bool OnClick(InputState state) + { + if (Enabled.Value) + { + Action?.Invoke(this); + State = SelectionState.Selected; + } + + return true; + } } } diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index b3d393209c..347a12dd56 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi RelativeSizeAxes = Axes.Both, }; - Lobby lobby; + Lounge lounge; Children = new Drawable[] { new Container @@ -52,12 +52,12 @@ namespace osu.Game.Screens.Multi { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, - Child = lobby = new Lobby(), + Child = lounge = new Lounge(), }, - new Header(lobby), + new Header(lounge), }; - lobby.Exited += s => Exit(); + lounge.Exited += s => Exit(); } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Multi/Screens/Lobby.cs b/osu.Game/Screens/Multi/Screens/Lobby.cs deleted file mode 100644 index dcda40e0d7..0000000000 --- a/osu.Game/Screens/Multi/Screens/Lobby.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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; - -namespace osu.Game.Screens.Multi.Screens -{ - public class Lobby : ScreenWhiteBox - { - protected override IEnumerable PossibleChildren => new[] { - typeof(MatchCreate), - typeof(Match) - }; - } -} diff --git a/osu.Game/Screens/Multi/Screens/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge.cs new file mode 100644 index 0000000000..b2ce94dd64 --- /dev/null +++ b/osu.Game/Screens/Multi/Screens/Lounge.cs @@ -0,0 +1,115 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Linq; +using System.Collections.Generic; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.UserInterface; +using osu.Game.Online.Multiplayer; +using osu.Game.Overlays.SearchableList; +using osu.Game.Screens.Multi.Components; +using OpenTK; + +namespace osu.Game.Screens.Multi.Screens +{ + public class Lounge : MultiplayerScreen + { + private readonly Container content; + private readonly FillFlowContainer roomsFlow; + private readonly RoomInspector roomInspector; + + protected override Container TransitionContent => content; + + public override string Title => "lounge"; + public override string Name => "Lounge"; + + private IEnumerable rooms; + public IEnumerable Rooms + { + get { return rooms; } + set + { + if (Equals(value, rooms)) return; + rooms = value; + + var enumerable = rooms.ToList(); + + roomsFlow.Children = enumerable.Select(r => new DrawableRoom(r) + { + Action = didSelect, + }).ToList(); + + if (!enumerable.Contains(roomInspector.Room)) + roomInspector.Room = null; + } + } + + public Lounge() + { + Children = new Drawable[] + { + content = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + new ScrollContainer + { + RelativeSizeAxes = Axes.Both, + Width = 0.55f, + Padding = new MarginPadding + { + Vertical = 35 - DrawableRoom.SELECTION_BORDER_WIDTH, + Right = 20 - DrawableRoom.SELECTION_BORDER_WIDTH + }, + Child = roomsFlow = new FillFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + LayoutEasing = Easing.OutQuint, + LayoutDuration = 200, + Spacing = new Vector2(10 - DrawableRoom.SELECTION_BORDER_WIDTH * 2), + }, + }, + roomInspector = new RoomInspector + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.Both, + Width = 0.45f, + }, + }, + }, + }; + } + + protected override void UpdateAfterChildren() + { + base.UpdateAfterChildren(); + + content.Padding = new MarginPadding + { + Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, + Right = SearchableListOverlay.WIDTH_PADDING, + }; + } + + private void didSelect(DrawableRoom room) + { + roomsFlow.Children.ForEach(c => + { + if (c != room) + c.State = SelectionState.NotSelected; + }); + + roomInspector.Room = room.Room; + + // open the room if its selected and is clicked again + if (room.State == SelectionState.Selected) + Push(new Match(room.Room)); + } + } +} diff --git a/osu.Game/Screens/Multi/Screens/Match.cs b/osu.Game/Screens/Multi/Screens/Match.cs index 4ba7fe9f6a..f6178d5691 100644 --- a/osu.Game/Screens/Multi/Screens/Match.cs +++ b/osu.Game/Screens/Multi/Screens/Match.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Screens; +using osu.Game.Online.Multiplayer; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using osu.Game.Screens.Select; @@ -21,6 +22,10 @@ namespace osu.Game.Screens.Multi.Screens protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); + public Match(Room room) + { + } + protected override void OnEntering(Screen last) { base.OnEntering(last); From f7a4a4eeef45c7afc392729949b70ecd12231b40 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 00:24:39 -0300 Subject: [PATCH 13/42] Add Lounge FilterControl. --- osu.Game.Tests/Visual/TestCaseLounge.cs | 2 +- osu.Game.Tests/Visual/TestCaseMultiHeader.cs | 2 +- osu.Game/Online/Multiplayer/Room.cs | 1 + .../Online/Multiplayer/RoomAvailability.cs | 18 +++++++++ osu.Game/Screens/Multi/Multiplayer.cs | 2 +- .../Multi/Screens/Lounge/FilterControl.cs | 27 +++++++++++++ .../Multi/Screens/{ => Lounge}/Lounge.cs | 40 ++++++++++++++++++- 7 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 osu.Game/Online/Multiplayer/RoomAvailability.cs create mode 100644 osu.Game/Screens/Multi/Screens/Lounge/FilterControl.cs rename osu.Game/Screens/Multi/Screens/{ => Lounge}/Lounge.cs (78%) diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs index b621899949..9dbc4012d5 100644 --- a/osu.Game.Tests/Visual/TestCaseLounge.cs +++ b/osu.Game.Tests/Visual/TestCaseLounge.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; -using osu.Game.Screens.Multi.Screens; +using osu.Game.Screens.Multi.Screens.Lounge; using osu.Game.Users; namespace osu.Game.Tests.Visual diff --git a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs index 4406676aca..d27a447077 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Multi; -using osu.Game.Screens.Multi.Screens; +using osu.Game.Screens.Multi.Screens.Lounge; namespace osu.Game.Tests.Visual { diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index f1c23e9e84..ae3fb5ec6e 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -12,6 +12,7 @@ namespace osu.Game.Online.Multiplayer public Bindable Name = new Bindable(); public Bindable Host = new Bindable(); public Bindable Status = new Bindable(); + public Bindable Availability = new Bindable(); public Bindable Type = new Bindable(); public Bindable Beatmap = new Bindable(); public Bindable MaxParticipants = new Bindable(); diff --git a/osu.Game/Online/Multiplayer/RoomAvailability.cs b/osu.Game/Online/Multiplayer/RoomAvailability.cs new file mode 100644 index 0000000000..6c154207ff --- /dev/null +++ b/osu.Game/Online/Multiplayer/RoomAvailability.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.ComponentModel; + +namespace osu.Game.Online.Multiplayer +{ + public enum RoomAvailability + { + Public, + + [Description(@"Friends Only")] + FriendsOnly, + + [Description(@"Invite Only")] + InviteOnly, + } +} diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 347a12dd56..ddaeb26806 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -8,7 +8,7 @@ using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; -using osu.Game.Screens.Multi.Screens; +using osu.Game.Screens.Multi.Screens.Lounge; namespace osu.Game.Screens.Multi { diff --git a/osu.Game/Screens/Multi/Screens/Lounge/FilterControl.cs b/osu.Game/Screens/Multi/Screens/Lounge/FilterControl.cs new file mode 100644 index 0000000000..421c89479a --- /dev/null +++ b/osu.Game/Screens/Multi/Screens/Lounge/FilterControl.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Graphics; +using osu.Game.Online.Multiplayer; +using osu.Game.Overlays.SearchableList; +using OpenTK.Graphics; + +namespace osu.Game.Screens.Multi.Screens.Lounge +{ + public class FilterControl : SearchableListFilterControl + { + protected override Color4 BackgroundColour => OsuColour.FromHex(@"362e42"); + protected override LoungeTab DefaultTab => LoungeTab.Public; + + public FilterControl() + { + DisplayStyleControl.Hide(); + } + } + + public enum LoungeTab + { + Public = RoomAvailability.Public, + Private = RoomAvailability.FriendsOnly, + } +} diff --git a/osu.Game/Screens/Multi/Screens/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs similarity index 78% rename from osu.Game/Screens/Multi/Screens/Lounge.cs rename to osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index b2ce94dd64..39aa1d73e7 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -1,21 +1,24 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using System.Collections.Generic; +using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; +using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; using osu.Game.Overlays.SearchableList; using osu.Game.Screens.Multi.Components; using OpenTK; -namespace osu.Game.Screens.Multi.Screens +namespace osu.Game.Screens.Multi.Screens.Lounge { public class Lounge : MultiplayerScreen { + private readonly FilterControl filter; private readonly Container content; private readonly FillFlowContainer roomsFlow; private readonly RoomInspector roomInspector; @@ -50,6 +53,7 @@ namespace osu.Game.Screens.Multi.Screens { Children = new Drawable[] { + filter = new FilterControl(), content = new Container { RelativeSizeAxes = Axes.Both, @@ -84,6 +88,8 @@ namespace osu.Game.Screens.Multi.Screens }, }, }; + + filter.Search.Exit += Exit; } protected override void UpdateAfterChildren() @@ -92,11 +98,41 @@ namespace osu.Game.Screens.Multi.Screens content.Padding = new MarginPadding { + Top = filter.DrawHeight, Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, Right = SearchableListOverlay.WIDTH_PADDING, }; } + protected override void OnFocus(InputState state) + { + GetContainingInputManager().ChangeFocus(filter.Search); + } + + protected override void OnEntering(Screen last) + { + base.OnEntering(last); + filter.Search.HoldFocus = true; + } + + protected override bool OnExiting(Screen next) + { + filter.Search.HoldFocus = false; + return base.OnExiting(next); + } + + protected override void OnResuming(Screen last) + { + base.OnResuming(last); + filter.Search.HoldFocus = true; + } + + protected override void OnSuspending(Screen next) + { + base.OnSuspending(next); + filter.Search.HoldFocus = false; + } + private void didSelect(DrawableRoom room) { roomsFlow.Children.ForEach(c => From 6aac4269e6c4e458a41ee5ebf64d0adca01d07ac Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 00:33:41 -0300 Subject: [PATCH 14/42] Add filtering. --- .../Screens/Multi/Components/DrawableRoom.cs | 18 ++++++- .../Screens/Multi/Screens/Lounge/Lounge.cs | 52 ++++++++++++++++--- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index e5ba1a87cf..94f5f95062 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Configuration; @@ -24,7 +25,7 @@ using OpenTK.Graphics; namespace osu.Game.Screens.Multi.Components { - public class DrawableRoom : OsuClickableContainer, IStateful + public class DrawableRoom : OsuClickableContainer, IStateful, IFilterable { public const float SELECTION_BORDER_WIDTH = 4; private const float corner_radius = 5; @@ -63,6 +64,21 @@ namespace osu.Game.Screens.Multi.Components } } + public IEnumerable FilterTerms => new[] { Room.Name.Value }; + + private bool matchingFilter; + public bool MatchingFilter + { + get { return matchingFilter; } + set + { + if (value == matchingFilter) return; + matchingFilter = value; + + this.FadeTo(MatchingFilter ? 1 : 0, 200); + } + } + private Action action; public new Action Action { diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 39aa1d73e7..26c4acdcfd 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -20,7 +20,8 @@ namespace osu.Game.Screens.Multi.Screens.Lounge { private readonly FilterControl filter; private readonly Container content; - private readonly FillFlowContainer roomsFlow; + private readonly SearchContainer search; + private readonly RoomsFilterContainer roomsFlow; private readonly RoomInspector roomInspector; protected override Container TransitionContent => content; @@ -46,6 +47,8 @@ namespace osu.Game.Screens.Multi.Screens.Lounge if (!enumerable.Contains(roomInspector.Room)) roomInspector.Room = null; + + filterRooms(); } } @@ -68,14 +71,17 @@ namespace osu.Game.Screens.Multi.Screens.Lounge Vertical = 35 - DrawableRoom.SELECTION_BORDER_WIDTH, Right = 20 - DrawableRoom.SELECTION_BORDER_WIDTH }, - Child = roomsFlow = new FillFlowContainer + Child = search = new SearchContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - LayoutEasing = Easing.OutQuint, - LayoutDuration = 200, - Spacing = new Vector2(10 - DrawableRoom.SELECTION_BORDER_WIDTH * 2), + Child = roomsFlow = new RoomsFilterContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Spacing = new Vector2(10 - DrawableRoom.SELECTION_BORDER_WIDTH * 2), + }, }, }, roomInspector = new RoomInspector @@ -89,6 +95,8 @@ namespace osu.Game.Screens.Multi.Screens.Lounge }, }; + filter.Search.Current.ValueChanged += s => filterRooms(); + filter.Tabs.Current.ValueChanged += t => filterRooms(); filter.Search.Exit += Exit; } @@ -133,6 +141,17 @@ namespace osu.Game.Screens.Multi.Screens.Lounge filter.Search.HoldFocus = false; } + private void filterRooms() + { + search.SearchTerm = filter.Search.Current.Value ?? string.Empty; + + foreach (DrawableRoom r in roomsFlow.Children) + { + r.MatchingFilter = r.MatchingFilter && + r.Room.Availability.Value == (RoomAvailability)filter.Tabs.Current.Value; + } + } + private void didSelect(DrawableRoom room) { roomsFlow.Children.ForEach(c => @@ -147,5 +166,26 @@ namespace osu.Game.Screens.Multi.Screens.Lounge if (room.State == SelectionState.Selected) Push(new Match(room.Room)); } + + private class RoomsFilterContainer : FillFlowContainer, IHasFilterableChildren + { + public IEnumerable FilterTerms => new string[] { }; + public IEnumerable FilterableChildren => Children; + + public bool MatchingFilter + { + set + { + if (value) + InvalidateLayout(); + } + } + + public RoomsFilterContainer() + { + LayoutDuration = 200; + LayoutEasing = Easing.OutQuint; + } + } } } From 662559d3c993859a9fd24c3aaab74c690edbdf82 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 01:22:23 -0300 Subject: [PATCH 15/42] More test steps. --- osu.Game.Tests/Visual/TestCaseLounge.cs | 58 ++++++++++++++++++- .../Screens/Multi/Components/DrawableRoom.cs | 2 - .../Screens/Multi/Screens/Lounge/Lounge.cs | 48 +++++++-------- 3 files changed, 80 insertions(+), 28 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs index 9dbc4012d5..a89c12a1be 100644 --- a/osu.Game.Tests/Visual/TestCaseLounge.cs +++ b/osu.Game.Tests/Visual/TestCaseLounge.cs @@ -1,23 +1,29 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; +using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Multi.Screens.Lounge; using osu.Game.Users; +using OpenTK.Input; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseLounge : OsuTestCase + public class TestCaseLounge : ManualInputManagerTestCase { + private TestLounge lounge; + [BackgroundDependencyLoader] private void load(RulesetStore rulesets) { - Lounge lounge = new Lounge(); + lounge = new TestLounge(); Room[] rooms = { @@ -26,6 +32,7 @@ namespace osu.Game.Tests.Visual Name = { Value = @"Just Another Room" }, Host = { Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } } }, Status = { Value = new RoomStatusPlaying() }, + Availability = { Value = RoomAvailability.Public }, Type = { Value = new GameTypeTagTeam() }, Beatmap = { @@ -70,6 +77,7 @@ namespace osu.Game.Tests.Visual Name = { Value = @"Not Just Any Room" }, Host = { Value = new User { Username = @"Monstrata", Id = 2706438, Country = new Country { FlagName = @"CA" } } }, Status = { Value = new RoomStatusOpen() }, + Availability = { Value = RoomAvailability.FriendsOnly }, Type = { Value = new GameTypeTeamVersus() }, Beatmap = { @@ -110,6 +118,7 @@ namespace osu.Game.Tests.Visual Name = { Value = @"room THE FINAL" }, Host = { Value = new User { Username = @"Delis", Id = 1603923, Country = new Country { FlagName = @"JP" } } }, Status = { Value = new RoomStatusPlaying() }, + Availability = { Value = RoomAvailability.Public }, Type = { Value = new GameTypeTagTeam() }, Beatmap = { @@ -150,9 +159,54 @@ namespace osu.Game.Tests.Visual AddStep(@"show", () => Add(lounge)); AddStep(@"set rooms", () => lounge.Rooms = rooms); + selectAssert(0); + AddStep(@"clear rooms", () => lounge.Rooms = new Room[] {}); + AddAssert(@"no room selected", () => lounge.SelectedRoom == null); + AddStep(@"set rooms", () => lounge.Rooms = rooms); + selectAssert(1); + AddStep(@"open room 1", () => clickRoom(1)); + AddStep(@"make lounge current", lounge.MakeCurrent); + filterAssert(@"THE FINAL", LoungeTab.Public, 1); + filterAssert(string.Empty, LoungeTab.Public, 2); + filterAssert(string.Empty, LoungeTab.Private, 1); + filterAssert(string.Empty, LoungeTab.Public, 2); + filterAssert(@"no matches", LoungeTab.Public, 0); AddStep(@"clear rooms", () => lounge.Rooms = new Room[] {}); AddStep(@"set rooms", () => lounge.Rooms = rooms); + AddAssert(@"no matches after clear", () => lounge.MatchedCount == 0); + filterAssert(string.Empty, LoungeTab.Public, 2); AddStep(@"exit", lounge.Exit); } + + private void clickRoom(int n) + { + InputManager.MoveMouseTo(lounge.ChildRooms[n]); + InputManager.Click(MouseButton.Left); + } + + private void selectAssert(int n) + { + AddStep($@"select room {n}", () => clickRoom(n)); + AddAssert($@"room {n} selected", () => lounge.SelectedRoom == lounge.ChildRooms[n].Room); + } + + private void filterAssert(string filter, LoungeTab tab, int endCount) + { + AddStep($@"filter '{filter}', {tab}", () => lounge.SetFilter(filter, tab)); + AddAssert(@"filtered correctly", () => lounge.MatchedCount == endCount); + } + + private class TestLounge : Lounge + { + public IReadOnlyList ChildRooms => RoomsContainer.Children; + public Room SelectedRoom => Inspector.Room; + public int MatchedCount => ChildRooms.Count(r => r.MatchingFilter); + + public void SetFilter(string filter, LoungeTab tab) + { + Filter.Search.Current.Value = filter; + Filter.Tabs.Current.Value = tab; + } + } } } diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 94f5f95062..d11d4a4795 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -72,9 +72,7 @@ namespace osu.Game.Screens.Multi.Components get { return matchingFilter; } set { - if (value == matchingFilter) return; matchingFilter = value; - this.FadeTo(MatchingFilter ? 1 : 0, 200); } } diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 26c4acdcfd..30ca897c1a 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -18,16 +18,16 @@ namespace osu.Game.Screens.Multi.Screens.Lounge { public class Lounge : MultiplayerScreen { - private readonly FilterControl filter; private readonly Container content; private readonly SearchContainer search; - private readonly RoomsFilterContainer roomsFlow; - private readonly RoomInspector roomInspector; - protected override Container TransitionContent => content; + protected readonly FilterControl Filter; + protected readonly FillFlowContainer RoomsContainer; + protected readonly RoomInspector Inspector; public override string Title => "lounge"; public override string Name => "Lounge"; + protected override Container TransitionContent => content; private IEnumerable rooms; public IEnumerable Rooms @@ -40,13 +40,13 @@ namespace osu.Game.Screens.Multi.Screens.Lounge var enumerable = rooms.ToList(); - roomsFlow.Children = enumerable.Select(r => new DrawableRoom(r) + RoomsContainer.Children = enumerable.Select(r => new DrawableRoom(r) { Action = didSelect, }).ToList(); - if (!enumerable.Contains(roomInspector.Room)) - roomInspector.Room = null; + if (!enumerable.Contains(Inspector.Room)) + Inspector.Room = null; filterRooms(); } @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge { Children = new Drawable[] { - filter = new FilterControl(), + Filter = new FilterControl(), content = new Container { RelativeSizeAxes = Axes.Both, @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, - Child = roomsFlow = new RoomsFilterContainer + Child = RoomsContainer = new RoomsFilterContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, @@ -84,7 +84,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge }, }, }, - roomInspector = new RoomInspector + Inspector = new RoomInspector { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -95,9 +95,9 @@ namespace osu.Game.Screens.Multi.Screens.Lounge }, }; - filter.Search.Current.ValueChanged += s => filterRooms(); - filter.Tabs.Current.ValueChanged += t => filterRooms(); - filter.Search.Exit += Exit; + Filter.Search.Current.ValueChanged += s => filterRooms(); + Filter.Tabs.Current.ValueChanged += t => filterRooms(); + Filter.Search.Exit += Exit; } protected override void UpdateAfterChildren() @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge content.Padding = new MarginPadding { - Top = filter.DrawHeight, + Top = Filter.DrawHeight, Left = SearchableListOverlay.WIDTH_PADDING - DrawableRoom.SELECTION_BORDER_WIDTH, Right = SearchableListOverlay.WIDTH_PADDING, }; @@ -114,53 +114,53 @@ namespace osu.Game.Screens.Multi.Screens.Lounge protected override void OnFocus(InputState state) { - GetContainingInputManager().ChangeFocus(filter.Search); + GetContainingInputManager().ChangeFocus(Filter.Search); } protected override void OnEntering(Screen last) { base.OnEntering(last); - filter.Search.HoldFocus = true; + Filter.Search.HoldFocus = true; } protected override bool OnExiting(Screen next) { - filter.Search.HoldFocus = false; + Filter.Search.HoldFocus = false; return base.OnExiting(next); } protected override void OnResuming(Screen last) { base.OnResuming(last); - filter.Search.HoldFocus = true; + Filter.Search.HoldFocus = true; } protected override void OnSuspending(Screen next) { base.OnSuspending(next); - filter.Search.HoldFocus = false; + Filter.Search.HoldFocus = false; } private void filterRooms() { - search.SearchTerm = filter.Search.Current.Value ?? string.Empty; + search.SearchTerm = Filter.Search.Current.Value ?? string.Empty; - foreach (DrawableRoom r in roomsFlow.Children) + foreach (DrawableRoom r in RoomsContainer.Children) { r.MatchingFilter = r.MatchingFilter && - r.Room.Availability.Value == (RoomAvailability)filter.Tabs.Current.Value; + r.Room.Availability.Value == (RoomAvailability)Filter.Tabs.Current.Value; } } private void didSelect(DrawableRoom room) { - roomsFlow.Children.ForEach(c => + RoomsContainer.Children.ForEach(c => { if (c != room) c.State = SelectionState.NotSelected; }); - roomInspector.Room = room.Room; + Inspector.Room = room.Room; // open the room if its selected and is clicked again if (room.State == SelectionState.Selected) From fba79a4de651a3cab48ceb58b8acd2cd120df4fc Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 01:31:01 -0300 Subject: [PATCH 16/42] Test typo. --- osu.Game.Tests/Visual/TestCaseLounge.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs index a89c12a1be..8a3bc79e8d 100644 --- a/osu.Game.Tests/Visual/TestCaseLounge.cs +++ b/osu.Game.Tests/Visual/TestCaseLounge.cs @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual Ruleset = rulesets.GetRuleset(3), Metadata = new BeatmapMetadata { - Title = @"663098", + Title = @"ONIGIRI FREEWAY", Artist = @"OISHII", AuthorString = @"Mentholzzz", }, From 3cc5bb516e6c875f415ca7d519ed78468eed2665 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 01:39:25 -0300 Subject: [PATCH 17/42] Remove unused Match ctor param. --- osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs | 2 +- osu.Game/Screens/Multi/Screens/Match.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 30ca897c1a..01a7510f76 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge // open the room if its selected and is clicked again if (room.State == SelectionState.Selected) - Push(new Match(room.Room)); + Push(new Match()); } private class RoomsFilterContainer : FillFlowContainer, IHasFilterableChildren diff --git a/osu.Game/Screens/Multi/Screens/Match.cs b/osu.Game/Screens/Multi/Screens/Match.cs index f6178d5691..d57f43fcd1 100644 --- a/osu.Game/Screens/Multi/Screens/Match.cs +++ b/osu.Game/Screens/Multi/Screens/Match.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Screens; -using osu.Game.Online.Multiplayer; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using osu.Game.Screens.Select; @@ -22,7 +21,7 @@ namespace osu.Game.Screens.Multi.Screens protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - public Match(Room room) + public Match() { } From 349b0a33221acf335cb9bae3a99178fc2522036b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 01:46:08 -0300 Subject: [PATCH 18/42] Remove empty ctor. --- osu.Game/Screens/Multi/Screens/Match.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Multi/Screens/Match.cs b/osu.Game/Screens/Multi/Screens/Match.cs index d57f43fcd1..4ba7fe9f6a 100644 --- a/osu.Game/Screens/Multi/Screens/Match.cs +++ b/osu.Game/Screens/Multi/Screens/Match.cs @@ -21,10 +21,6 @@ namespace osu.Game.Screens.Multi.Screens protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); - public Match() - { - } - protected override void OnEntering(Screen last) { base.OnEntering(last); From 0b19b7d9e56f64032207c9c36ea0a4382919e781 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 22 May 2018 02:08:50 -0300 Subject: [PATCH 19/42] Fix test case. --- osu.Game.Tests/Visual/TestCaseLounge.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLounge.cs b/osu.Game.Tests/Visual/TestCaseLounge.cs index 8a3bc79e8d..b96d705d5c 100644 --- a/osu.Game.Tests/Visual/TestCaseLounge.cs +++ b/osu.Game.Tests/Visual/TestCaseLounge.cs @@ -173,34 +173,33 @@ namespace osu.Game.Tests.Visual filterAssert(@"no matches", LoungeTab.Public, 0); AddStep(@"clear rooms", () => lounge.Rooms = new Room[] {}); AddStep(@"set rooms", () => lounge.Rooms = rooms); - AddAssert(@"no matches after clear", () => lounge.MatchedCount == 0); + AddAssert(@"no matches after clear", () => !lounge.ChildRooms.Any()); filterAssert(string.Empty, LoungeTab.Public, 2); AddStep(@"exit", lounge.Exit); } private void clickRoom(int n) { - InputManager.MoveMouseTo(lounge.ChildRooms[n]); + InputManager.MoveMouseTo(lounge.ChildRooms.ElementAt(n)); InputManager.Click(MouseButton.Left); } private void selectAssert(int n) { AddStep($@"select room {n}", () => clickRoom(n)); - AddAssert($@"room {n} selected", () => lounge.SelectedRoom == lounge.ChildRooms[n].Room); + AddAssert($@"room {n} selected", () => lounge.SelectedRoom == lounge.ChildRooms.ElementAt(n).Room); } private void filterAssert(string filter, LoungeTab tab, int endCount) { AddStep($@"filter '{filter}', {tab}", () => lounge.SetFilter(filter, tab)); - AddAssert(@"filtered correctly", () => lounge.MatchedCount == endCount); + AddAssert(@"filtered correctly", () => lounge.ChildRooms.Count() == endCount); } private class TestLounge : Lounge { - public IReadOnlyList ChildRooms => RoomsContainer.Children; + public IEnumerable ChildRooms => RoomsContainer.Children.Where(r => r.MatchingFilter); public Room SelectedRoom => Inspector.Room; - public int MatchedCount => ChildRooms.Count(r => r.MatchingFilter); public void SetFilter(string filter, LoungeTab tab) { From be0fc24ad409fb0583c79edb423110ec79484961 Mon Sep 17 00:00:00 2001 From: frankhjwx Date: Tue, 22 May 2018 20:51:37 +0800 Subject: [PATCH 20/42] Fixed banana generation on catch specific maps --- osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 9dfe12f25e..5f9439534b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -8,8 +8,9 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal sealed class ConvertSpinner : HitObject, IHasEndTime + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition { + public float X { get; set; } public double EndTime { get; set; } public double Duration => EndTime - StartTime; From b324337fa1457dcf4019c28036535f0406cf9a14 Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 22 May 2018 15:29:52 +0200 Subject: [PATCH 21/42] Add icon next to beatmap title/username to open in browser --- .../Visual/TestCaseExternalLinkButton.cs | 20 +++++++ .../UserInterface/ExternalLinkButton.cs | 58 +++++++++++++++++++ osu.Game/Overlays/BeatmapSet/Header.cs | 24 +++++++- osu.Game/Overlays/Profile/ProfileHeader.cs | 45 +++++++------- 4 files changed, 119 insertions(+), 28 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs create mode 100644 osu.Game/Graphics/UserInterface/ExternalLinkButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs new file mode 100644 index 0000000000..bdb077ce5a --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using osu.Game.Graphics.UserInterface; +using OpenTK; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseExternalLinkButton : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] { typeof(ExternalLinkButton) }; + + public TestCaseExternalLinkButton() + { + Child = new ExternalLinkButton("https://osu.ppy.sh/home") + { + Size = new Vector2(50) + }; + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs new file mode 100644 index 0000000000..800f77f547 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -0,0 +1,58 @@ +using System.Diagnostics; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Input; +using OpenTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + public class ExternalLinkButton : CompositeDrawable, IHasTooltip + { + public string Link { get; set; } + + private Color4 hoverColour; + + public ExternalLinkButton(string link = null) + { + Link = link; + InternalChild = new SpriteIcon + { + Icon = FontAwesome.fa_external_link, + RelativeSizeAxes = Axes.Both + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + hoverColour = colours.Yellow; + } + + protected override bool OnHover(InputState state) + { + InternalChild.FadeColour(hoverColour, 500, Easing.OutQuint); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + InternalChild.FadeColour(Color4.White, 500, Easing.OutQuint); + base.OnHoverLost(state); + } + + protected override bool OnClick(InputState state) + { + if(Link != null) + Process.Start(new ProcessStartInfo + { + FileName = Link, + UseShellExecute = true //see https://github.com/dotnet/corefx/issues/10361 + }); + return true; + } + + public string TooltipText => "View in browser"; + } +} diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 9b25d61f58..7d07816d11 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -11,6 +11,7 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.BeatmapSet.Buttons; using OpenTK; using OpenTK.Graphics; @@ -93,6 +94,7 @@ namespace osu.Game.Overlays.BeatmapSet public Header() { + ExternalLinkButton externalLink; RelativeSizeAxes = Axes.X; Height = 400; Masking = true; @@ -160,10 +162,25 @@ namespace osu.Game.Overlays.BeatmapSet Height = 113, Child = Picker = new BeatmapPicker(), }, - title = new OsuSpriteText + new FillFlowContainer { - Font = @"Exo2.0-BoldItalic", - TextSize = 37, + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + title = new OsuSpriteText + { + Font = @"Exo2.0-BoldItalic", + TextSize = 37, + }, + externalLink = new ExternalLinkButton + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font + Size = new Vector2(18), + }, + } }, artist = new OsuSpriteText { @@ -247,6 +264,7 @@ namespace osu.Game.Overlays.BeatmapSet }; Picker.Beatmap.ValueChanged += b => Details.Beatmap = b; + Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet?.OnlineBeatmapSetID}#{b?.Ruleset.ShortName}/{b?.OnlineBeatmapID}"; } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 4c411b3210..1a4a00da2b 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Diagnostics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; @@ -10,13 +9,13 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; @@ -105,11 +104,29 @@ namespace osu.Game.Overlays.Profile Y = -75, Size = new Vector2(25, 25) }, - new ProfileLink(user) + new FillFlowContainer { + Direction = FillDirection.Horizontal, + AutoSizeAxes = Axes.Both, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = -48, + Children = new Drawable[] + { + new OsuSpriteText + { + Text = user.Username, + Font = @"Exo2.0-RegularItalic", + TextSize = 30, + }, + new ExternalLinkButton($@"https://osu.ppy.sh/users/{user.Id}") + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Margin = new MarginPadding { Left = 3, Bottom = 3 }, //To better lineup with the font + Size = new Vector2(18), + }, + } }, countryFlag = new DrawableFlag(user.Country) { @@ -455,28 +472,6 @@ namespace osu.Game.Overlays.Profile infoTextRight.NewLine(); } - private class ProfileLink : OsuHoverContainer, IHasTooltip - { - public string TooltipText => "View Profile in Browser"; - - public override bool HandleMouseInput => true; - - public ProfileLink(User user) - { - Action = () => Process.Start($@"https://osu.ppy.sh/users/{user.Id}"); - - AutoSizeAxes = Axes.Both; - - Child = new OsuSpriteText - { - Text = user.Username, - Font = @"Exo2.0-RegularItalic", - TextSize = 30, - }; - } - } - - private class GradeBadge : Container { private const float width = 50; From 8fbda5bc59a736ca837f33e369812791202f8caf Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 22 May 2018 15:41:10 +0200 Subject: [PATCH 22/42] add license header --- osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs | 5 ++++- osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs index bdb077ce5a..7d8535f428 100644 --- a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs +++ b/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using osu.Game.Graphics.UserInterface; using OpenTK; diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 800f77f547..025874a1a2 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -1,4 +1,7 @@ -using System.Diagnostics; +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From f894d73501d813d1999fb39d73bd193257b4f611 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 23 May 2018 14:36:09 +0900 Subject: [PATCH 23/42] Fix possible MusicController nullref --- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 8c8ff89420..966f09975d 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Music private void updateSelectedSet() { foreach (PlaylistItem s in items.Children) - s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo.ID; + s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value?.BeatmapSetInfo?.ID; } public string SearchTerm From 28ad5398cc928deb58ec68fbb3d0d24313bec175 Mon Sep 17 00:00:00 2001 From: frankhjwx Date: Wed, 23 May 2018 13:46:12 +0800 Subject: [PATCH 24/42] Remove the changes in convert spinner --- osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 5f9439534b..9dfe12f25e 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -8,9 +8,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition + internal sealed class ConvertSpinner : HitObject, IHasEndTime { - public float X { get; set; } public double EndTime { get; set; } public double Duration => EndTime - StartTime; From fda7025ac3793c575da44ca4620edf1a31d7ddab Mon Sep 17 00:00:00 2001 From: frankhjwx Date: Wed, 23 May 2018 13:47:33 +0800 Subject: [PATCH 25/42] Re-order positionData judgement for correct banana creation --- .../Beatmaps/CatchBeatmapConverter.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index f40ef67dfb..60671d9383 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -28,7 +28,20 @@ namespace osu.Game.Rulesets.Catch.Beatmaps var endTime = obj as IHasEndTime; if (positionData == null) + { + if (endTime != null) + { + yield return new BananaShower + { + StartTime = obj.StartTime, + Samples = obj.Samples, + Duration = endTime.Duration, + NewCombo = comboData?.NewCombo ?? false + }; + + } yield break; + } if (curveData != null) { @@ -48,19 +61,6 @@ namespace osu.Game.Rulesets.Catch.Beatmaps yield break; } - if (endTime != null) - { - yield return new BananaShower - { - StartTime = obj.StartTime, - Samples = obj.Samples, - Duration = endTime.Duration, - NewCombo = comboData?.NewCombo ?? false - }; - - yield break; - } - yield return new Fruit { StartTime = obj.StartTime, From fb78854485072b1a919c8a4318b261a799349286 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 23 May 2018 19:41:13 +0900 Subject: [PATCH 26/42] Fix audio playback getting paused if playlist changes beatmap --- osu.Game/Overlays/Music/PlaylistOverlay.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 76c2222f8b..085a44ecba 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -79,7 +79,10 @@ namespace osu.Game.Overlays.Music { BeatmapInfo beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault(); if (beatmap != null) + { beatmapBacking.Value = beatmaps.GetWorkingBeatmap(beatmap); + beatmapBacking.Value.Track.Restart(); + } }; } @@ -109,6 +112,7 @@ namespace osu.Game.Overlays.Music } beatmapBacking.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First()); + beatmapBacking.Value.Track.Restart(); } } From 568d4882c681b187d80e4bba3b99d0b00abeaaae Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 May 2018 11:00:56 +0900 Subject: [PATCH 27/42] Remove unnecessary null coalesce --- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 966f09975d..d4bc8c5b27 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Music private void updateSelectedSet() { foreach (PlaylistItem s in items.Children) - s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value?.BeatmapSetInfo?.ID; + s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo?.ID; } public string SearchTerm From 7d06a08c3a3f3da1871cac6108c057afac4b5990 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 May 2018 17:44:56 +0900 Subject: [PATCH 28/42] Fix quit button test occasionally failing --- osu.Game.Tests/Visual/TestCaseQuitButton.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseQuitButton.cs b/osu.Game.Tests/Visual/TestCaseQuitButton.cs index f0f8d41074..fd0d602ffd 100644 --- a/osu.Game.Tests/Visual/TestCaseQuitButton.cs +++ b/osu.Game.Tests/Visual/TestCaseQuitButton.cs @@ -31,10 +31,6 @@ namespace osu.Game.Tests.Visual var text = quitButton.Children.OfType().First(); - // initial display - AddUntilStep(() => text.IsPresent && !exitAction, "Text visible"); - AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible"); - AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(quitButton)); AddUntilStep(() => text.IsPresent && !exitAction, "Text visible"); AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One)); From 1cb7d50407e10b09ded9a4f0ea9ef086488e3efc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 May 2018 18:51:57 +0900 Subject: [PATCH 29/42] Add and use default size (smaller than before) --- osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 2 ++ osu.Game/Overlays/BeatmapSet/Header.cs | 1 - osu.Game/Overlays/Profile/ProfileHeader.cs | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 025874a1a2..77079894cc 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface @@ -20,6 +21,7 @@ namespace osu.Game.Graphics.UserInterface public ExternalLinkButton(string link = null) { Link = link; + Size = new Vector2(12); InternalChild = new SpriteIcon { Icon = FontAwesome.fa_external_link, diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 7d07816d11..8833a89479 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -178,7 +178,6 @@ namespace osu.Game.Overlays.BeatmapSet Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font - Size = new Vector2(18), }, } }, diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 1a4a00da2b..067144c26e 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -124,7 +124,6 @@ namespace osu.Game.Overlays.Profile Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 3, Bottom = 3 }, //To better lineup with the font - Size = new Vector2(18), }, } }, From 897767008839c64e56d29d92c4e19cdb85ab962d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 May 2018 19:08:46 +0900 Subject: [PATCH 30/42] Update framework --- osu-framework | 2 +- osu.Game.Tests/Visual/TestCaseQuitButton.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu-framework b/osu-framework index eb076a3301..a191c104b8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit eb076a3301231eb73917073499051e49a9b12978 +Subproject commit a191c104b8e254e81a1a7bb1c200ccdf02628796 diff --git a/osu.Game.Tests/Visual/TestCaseQuitButton.cs b/osu.Game.Tests/Visual/TestCaseQuitButton.cs index f0f8d41074..c2ddc5fef5 100644 --- a/osu.Game.Tests/Visual/TestCaseQuitButton.cs +++ b/osu.Game.Tests/Visual/TestCaseQuitButton.cs @@ -44,13 +44,13 @@ namespace osu.Game.Tests.Visual { exitAction = false; InputManager.MoveMouseTo(quitButton); - InputManager.ButtonDown(MouseButton.Left); + InputManager.PressButton(MouseButton.Left); }); - AddStep("Early release", () => InputManager.ButtonUp(MouseButton.Left)); + AddStep("Early release", () => InputManager.ReleaseButton(MouseButton.Left)); AddAssert("action not triggered", () => !exitAction); - AddStep("Trigger exit action", () => InputManager.ButtonDown(MouseButton.Left)); + AddStep("Trigger exit action", () => InputManager.PressButton(MouseButton.Left)); AddUntilStep(() => exitAction, $"{nameof(quitButton.Action)} was triggered"); } } From 765a50d00737643039cf2789ad17f9605e0d0723 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 25 May 2018 20:05:53 +0900 Subject: [PATCH 31/42] Remove 0.5 offsets Checked up against DB values + server-side build versions, and these 0.5s don't seem to exist. Brings calculations more in-line with osu!stable. --- .../Difficulty/ManiaPerformanceCalculator.cs | 2 +- .../Difficulty/OsuPerformanceCalculator.cs | 6 +++--- .../Difficulty/TaikoPerformanceCalculator.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index e6e3028d62..bebe07cdee 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty private double computeAccuracyValue(double strainValue) { - double hitWindowGreat = (Beatmap.HitObjects.First().HitWindows.Great / 2 - 0.5) / TimeRate; + double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; if (hitWindowGreat <= 0) return 0; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index ae74f12339..9803ebaf52 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -61,11 +61,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (mods.Any(m => !m.Ranked)) return 0; - double hitWindowGreat = (Beatmap.HitObjects.First().HitWindows.Great / 2 - 0.5) / TimeRate; - double preEmpt = BeatmapDifficulty.DifficultyRange(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / TimeRate; + double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; + double preEmpt = (int)BeatmapDifficulty.DifficultyRange(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / TimeRate; realApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5; - realOverallDifficulty = (80 - 0.5 - hitWindowGreat) / 6; + realOverallDifficulty = (80 - hitWindowGreat) / 6; // Custom multipliers for NoFail and SpunOut. double multiplier = 1.12f; // This is being adjusted to keep the final pp value scaled around what it used to be when changing things diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs index 9c9cd1f0fb..b1d73fc1ff 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs @@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty private double computeAccuracyValue() { - double hitWindowGreat = (Beatmap.HitObjects.First().HitWindows.Great / 2 - 0.5) / TimeRate; + double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; if (hitWindowGreat <= 0) return 0; From 215cc9fba7fedbf46d4c05b86eb677454a6a8e6b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 25 May 2018 20:07:14 +0900 Subject: [PATCH 32/42] Change all performance calculators to use int hitwindows Has a pretty large (>6) effect on pp for some maps. --- .../Difficulty/ManiaPerformanceCalculator.cs | 1 + osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs | 1 + .../Difficulty/TaikoPerformanceCalculator.cs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index bebe07cdee..e1f5f38da7 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -105,6 +105,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty private double computeAccuracyValue(double strainValue) { + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; if (hitWindowGreat <= 0) return 0; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 9803ebaf52..0158af87d8 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -61,6 +61,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (mods.Any(m => !m.Ranked)) return 0; + // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; double preEmpt = (int)BeatmapDifficulty.DifficultyRange(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / TimeRate; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs index b1d73fc1ff..6b1a25d667 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoPerformanceCalculator.cs @@ -94,7 +94,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty private double computeAccuracyValue() { - double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future + double hitWindowGreat = (int)(Beatmap.HitObjects.First().HitWindows.Great / 2) / TimeRate; if (hitWindowGreat <= 0) return 0; From e2d840c2dea4c880924c5cc3bfa3a71a858c801a Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 21:13:40 +0200 Subject: [PATCH 33/42] Rename CursorOverrideContainer to MenuCursorContainer --- osu.Game.Tests/Visual/TestCaseCursors.cs | 12 ++++++------ osu.Game/Graphics/Cursor/CursorOverrideContainer.cs | 4 ++-- osu.Game/OsuGame.cs | 6 +++--- osu.Game/OsuGameBase.cs | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index 977f241f7a..0aa8e9691e 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -19,12 +19,12 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseCursors : ManualInputManagerTestCase { - private readonly CursorOverrideContainer cursorOverrideContainer; + private readonly MenuCursorContainer menuCursorContainer; private readonly CustomCursorBox[] cursorBoxes = new CustomCursorBox[6]; public TestCaseCursors() { - Child = cursorOverrideContainer = new CursorOverrideContainer + Child = menuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both, Children = new[] @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual AddAssert("Check green cursor at mouse", () => checkAtMouse(cursorBoxes[0].Cursor)); AddStep("Move out", moveOut); AddAssert("Check green cursor invisible", () => !checkVisible(cursorBoxes[0].Cursor)); - AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor)); + AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor)); } /// @@ -112,11 +112,11 @@ namespace osu.Game.Tests.Visual AddStep("Move to purple area", () => InputManager.MoveMouseTo(cursorBoxes[3])); AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor)); AddAssert("Check purple cursor at mouse", () => checkAtMouse(cursorBoxes[3].Cursor)); - AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor)); - AddAssert("Check global cursor at mouse", () => checkAtMouse(cursorOverrideContainer.Cursor)); + AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor)); + AddAssert("Check global cursor at mouse", () => checkAtMouse(menuCursorContainer.Cursor)); AddStep("Move out", moveOut); AddAssert("Check purple cursor visible", () => checkVisible(cursorBoxes[3].Cursor)); - AddAssert("Check global cursor visible", () => checkVisible(cursorOverrideContainer.Cursor)); + AddAssert("Check global cursor visible", () => checkVisible(menuCursorContainer.Cursor)); } /// diff --git a/osu.Game/Graphics/Cursor/CursorOverrideContainer.cs b/osu.Game/Graphics/Cursor/CursorOverrideContainer.cs index 1e56cb6052..5823fad93a 100644 --- a/osu.Game/Graphics/Cursor/CursorOverrideContainer.cs +++ b/osu.Game/Graphics/Cursor/CursorOverrideContainer.cs @@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Cursor /// /// A container which provides a which can be overridden by hovered s. /// - public class CursorOverrideContainer : Container, IProvideCursor + public class MenuCursorContainer : Container, IProvideCursor { protected override Container Content => content; private readonly Container content; @@ -25,7 +25,7 @@ namespace osu.Game.Graphics.Cursor public CursorContainer Cursor { get; } public bool ProvidingUserCursor => true; - public CursorOverrideContainer() + public MenuCursorContainer() { AddRangeInternal(new Drawable[] { diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ec93b1ae46..a43c1507b6 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -212,7 +212,7 @@ namespace osu.Game protected override void LoadComplete() { - // this needs to be cached before base.LoadComplete as it is used by CursorOverrideContainer. + // this needs to be cached before base.LoadComplete as it is used by MenuCursorContainer. dependencies.Cache(screenshotManager = new ScreenshotManager()); base.LoadComplete(); @@ -220,7 +220,7 @@ namespace osu.Game // The next time this is updated is in UpdateAfterChildren, which occurs too late and results // in the cursor being shown for a few frames during the intro. // This prevents the cursor from showing until we have a screen with CursorVisible = true - CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; + MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; // hook up notifications to components. SkinManager.PostNotification = n => notifications?.Post(n); @@ -548,7 +548,7 @@ namespace osu.Game mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; - CursorOverrideContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; + MenuCursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false; } private void screenAdded(Screen newScreen) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 487cb50c9a..a3a081d6d1 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -57,7 +57,7 @@ namespace osu.Game protected SettingsStore SettingsStore; - protected CursorOverrideContainer CursorOverrideContainer; + protected MenuCursorContainer MenuCursorContainer; protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -191,14 +191,14 @@ namespace osu.Game GlobalActionContainer globalBinding; - CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both }; - CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this) + MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }; + MenuCursorContainer.Child = globalBinding = new GlobalActionContainer(this) { RelativeSizeAxes = Axes.Both, - Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both } + Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both } }; - base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorOverrideContainer }); + base.Content.Add(new DrawSizePreservingFillContainer { Child = MenuCursorContainer }); KeyBindingStore.Register(globalBinding); dependencies.Cache(globalBinding); From 63fb9ddec4f7364e41f6ed11e48973ffe1ed70dc Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Fri, 25 May 2018 21:20:42 +0200 Subject: [PATCH 34/42] Forgot file name --- .../Cursor/{CursorOverrideContainer.cs => MenuCursorContainer.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename osu.Game/Graphics/Cursor/{CursorOverrideContainer.cs => MenuCursorContainer.cs} (100%) diff --git a/osu.Game/Graphics/Cursor/CursorOverrideContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs similarity index 100% rename from osu.Game/Graphics/Cursor/CursorOverrideContainer.cs rename to osu.Game/Graphics/Cursor/MenuCursorContainer.cs From d850e34003b2a7b307c93ae3c692c48aa88fe49c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 26 May 2018 09:25:16 +0900 Subject: [PATCH 35/42] Actually cast to int --- .../Difficulty/ManiaPerformanceCalculator.cs | 2 +- osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index e1f5f38da7..93652f7610 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty private double computeAccuracyValue(double strainValue) { // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; + double hitWindowGreat = (int)(Beatmap.HitObjects.First().HitWindows.Great / 2) / TimeRate; if (hitWindowGreat <= 0) return 0; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 0158af87d8..57cf962fa7 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty return 0; // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - double hitWindowGreat = Beatmap.HitObjects.First().HitWindows.Great / 2 / TimeRate; + double hitWindowGreat = (int)(Beatmap.HitObjects.First().HitWindows.Great / 2) / TimeRate; double preEmpt = (int)BeatmapDifficulty.DifficultyRange(Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / TimeRate; realApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5; From 8b2a6b8ccefd62aa32e399a5ace23c26917af793 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 26 May 2018 12:38:33 +0900 Subject: [PATCH 36/42] Fix formatting --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs index 60671d9383..ad500606ed 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapConverter.cs @@ -38,8 +38,8 @@ namespace osu.Game.Rulesets.Catch.Beatmaps Duration = endTime.Duration, NewCombo = comboData?.NewCombo ?? false }; - } + yield break; } From 975ce82177f819a4dfdf1656f1b28ae90862a97e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 26 May 2018 14:46:05 +0900 Subject: [PATCH 37/42] Ensure autoplay tests actually increase score above zero --- osu.Game.Tests/Visual/TestCaseAutoplay.cs | 16 +++++++++++++++- osu.Game/Screens/Play/Player.cs | 18 +++++++++--------- osu.Game/Tests/Visual/TestCasePlayer.cs | 6 ++++-- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseAutoplay.cs b/osu.Game.Tests/Visual/TestCaseAutoplay.cs index cecb327b6c..bf7aa725e5 100644 --- a/osu.Game.Tests/Visual/TestCaseAutoplay.cs +++ b/osu.Game.Tests/Visual/TestCaseAutoplay.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.Linq; using osu.Game.Beatmaps; using osu.Game.Rulesets; +using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual @@ -15,7 +16,20 @@ namespace osu.Game.Tests.Visual protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) { beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }); - return base.CreatePlayer(beatmap, ruleset); + return new ScoreAccessiblePlayer + { + InitialBeatmap = beatmap, + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, + }; + } + + protected override bool ContinueCondition(Player player) => base.ContinueCondition(player) && ((ScoreAccessiblePlayer)player).ScoreProcessor.TotalScore > 0; + + private class ScoreAccessiblePlayer : Player + { + public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0150d76251..9985a24cab 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Play private SampleChannel sampleRestart; - private ScoreProcessor scoreProcessor; + protected ScoreProcessor ScoreProcessor; protected RulesetContainer RulesetContainer; private HUDOverlay hudOverlay; @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play userAudioOffset.ValueChanged += v => offsetClock.Offset = v; userAudioOffset.TriggerChange(); - scoreProcessor = RulesetContainer.CreateScoreProcessor(); + ScoreProcessor = RulesetContainer.CreateScoreProcessor(); Children = new Drawable[] { @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play RelativeSizeAxes = Axes.Both, Child = RulesetContainer }, - new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor) + new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor) { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play Breaks = beatmap.Breaks }, RulesetContainer.Cursor?.CreateProxy() ?? new Container(), - hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock) + hudOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock) { Clock = Clock, // hud overlay doesn't want to use the audio clock directly ProcessCustomClock = false, @@ -225,11 +225,11 @@ namespace osu.Game.Screens.Play initializeStoryboard(false); // Bind ScoreProcessor to ourselves - scoreProcessor.AllJudged += onCompletion; - scoreProcessor.Failed += onFail; + ScoreProcessor.AllJudged += onCompletion; + ScoreProcessor.Failed += onFail; foreach (var mod in Beatmap.Value.Mods.Value.OfType()) - mod.ApplyToScoreProcessor(scoreProcessor); + mod.ApplyToScoreProcessor(ScoreProcessor); } private void applyRateFromMods() @@ -254,7 +254,7 @@ namespace osu.Game.Screens.Play private void onCompletion() { // Only show the completion screen if the player hasn't failed - if (scoreProcessor.HasFailed || onCompletionEvent != null) + if (ScoreProcessor.HasFailed || onCompletionEvent != null) return; ValidForResume = false; @@ -272,7 +272,7 @@ namespace osu.Game.Screens.Play Beatmap = Beatmap.Value.BeatmapInfo, Ruleset = ruleset }; - scoreProcessor.PopulateScore(score); + ScoreProcessor.PopulateScore(score); score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; Push(new Results(score)); }); diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index bda438d906..bf6236e4d5 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual { Player p = null; AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset)); - AddUntilStep(() => p.IsLoaded); + AddUntilStep(() => ContinueCondition(p)); } else { @@ -52,11 +52,13 @@ namespace osu.Game.Tests.Visual { Player p = null; AddStep(r.Name, () => p = loadPlayerFor(r)); - AddUntilStep(() => p.IsLoaded); + AddUntilStep(() => ContinueCondition(p)); } } } + protected virtual bool ContinueCondition(Player player) => player.IsLoaded; + protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); private Player loadPlayerFor(RulesetInfo ri) => loadPlayerFor(ri.CreateInstance()); From 95315e46f06dfc70acebf3cce07f03b166128150 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 27 May 2018 14:12:20 +0900 Subject: [PATCH 38/42] Make drawable rooms fade in when first displayed Stops filtered rooms from briefly displaying. --- osu.Game/Screens/Multi/Components/DrawableRoom.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index d11d4a4795..8e93fda68f 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -297,6 +297,12 @@ namespace osu.Game.Screens.Multi.Components participantsBind.BindTo(Room.Participants); } + protected override void LoadComplete() + { + base.LoadComplete(); + this.FadeInFromZero(transition_duration); + } + protected override bool OnClick(InputState state) { if (Enabled.Value) From 4f0d7bd63ef09798dcbd6aa9ff59cae9533166a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 27 May 2018 15:14:25 +0900 Subject: [PATCH 39/42] Update framework --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index a191c104b8..84fdfc77a8 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit a191c104b8e254e81a1a7bb1c200ccdf02628796 +Subproject commit 84fdfc77a86d581638e69f5e8061c118de4b30f9 From 0ca6d73f0ec7d43773b404d66666cd89c77657e0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 May 2018 12:28:11 +0900 Subject: [PATCH 40/42] Add a delay before the osu! logo appears when exiting multiplayer --- osu.Game/Screens/Multi/Multiplayer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index ddaeb26806..7822fa68dc 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -8,6 +8,7 @@ using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; +using osu.Game.Screens.Menu; using osu.Game.Screens.Multi.Screens.Lounge; namespace osu.Game.Screens.Multi @@ -84,6 +85,13 @@ namespace osu.Game.Screens.Multi waves.Hide(); } + protected override void LogoExiting(OsuLogo logo) + { + // the wave overlay transition takes longer than expected to run. + logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut(); + base.LogoExiting(logo); + } + private class MultiplayerWaveContainer : WaveContainer { protected override bool StartHidden => true; From 02c37ebc1f928d96fbeaa79df5337e3cd1a1703e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 May 2018 13:02:06 +0900 Subject: [PATCH 41/42] Move screen titles to OsuScreen --- .../Visual/TestCaseScreenBreadcrumbControl.cs | 7 ++----- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 3 ++- osu.Game/Screens/Multi/Header.cs | 2 +- osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs | 2 +- osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs | 5 ----- osu.Game/Screens/OsuScreen.cs | 10 +++++++++- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 7a743655f4..83bbbfddd1 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -84,12 +84,9 @@ namespace osu.Game.Tests.Visual private abstract class TestScreen : OsuScreen { - protected abstract string Title { get; } protected abstract string NextTitle { get; } protected abstract TestScreen CreateNextScreen(); - public override string ToString() => Title; - public TestScreen PushNext() { TestScreen screen = CreateNextScreen(); @@ -130,14 +127,14 @@ namespace osu.Game.Tests.Visual private class TestScreenOne : TestScreen { - protected override string Title => @"Screen One"; + public override string Title => @"Screen One"; protected override string NextTitle => @"Two"; protected override TestScreen CreateNextScreen() => new TestScreenTwo(); } private class TestScreenTwo : TestScreen { - protected override string Title => @"Screen Two"; + public override string Title => @"Screen Two"; protected override string NextTitle => @"One"; protected override TestScreen CreateNextScreen() => new TestScreenOne(); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index fc14a9c6ba..d015a563f6 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -6,6 +6,7 @@ using System.Linq; using OpenTK; using OpenTK.Graphics; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -157,7 +158,7 @@ namespace osu.Game.Graphics.UserInterface Margin = new MarginPadding { Top = 5, Bottom = 5 }, Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, - Text = (value as Enum)?.GetDescription() ?? value.ToString(), + Text = (value as IHasDescription)?.Description ?? (value as Enum)?.GetDescription() ?? value.ToString(), TextSize = 14, Font = @"Exo2.0-Bold", // Font should only turn bold when active? }, diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index f6b7bbfcef..de71b20007 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => screenTitle.Text = s is MultiplayerScreen m ? m.Title : s.ToString(); + breadcrumbs.Current.ValueChanged += s => screenTitle.Text = ((MultiplayerScreen)s).Title; breadcrumbs.Current.TriggerChange(); } diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 01a7510f76..60ffe2c0b9 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Multi.Screens.Lounge protected readonly RoomInspector Inspector; public override string Title => "lounge"; - public override string Name => "Lounge"; + protected override Container TransitionContent => content; private IEnumerable rooms; diff --git a/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs b/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs index 5a17a32d8c..191fe66037 100644 --- a/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs +++ b/osu.Game/Screens/Multi/Screens/MultiplayerScreen.cs @@ -15,11 +15,6 @@ namespace osu.Game.Screens.Multi.Screens protected virtual Container TransitionContent => Content; - public abstract string Title { get; } - public abstract string Name { get; } - - public override string ToString() => Name; - protected override void OnEntering(Screen last) { base.OnEntering(last); diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index a188b7aa64..cd9cbe119f 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -20,10 +21,17 @@ using OpenTK.Input; namespace osu.Game.Screens { - public abstract class OsuScreen : Screen, IKeyBindingHandler + public abstract class OsuScreen : Screen, IKeyBindingHandler, IHasDescription { public BackgroundScreen Background { get; private set; } + /// + /// A user-facing title for this screen. + /// + public virtual string Title => GetType().ShortDisplayName(); + + public string Description => Title; + protected virtual bool AllowBackButton => true; /// From ed7c8608028149b4549026f09efe7de500cffc49 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 28 May 2018 13:02:15 +0900 Subject: [PATCH 42/42] Adjust transitions of DrawableRoom --- osu.Game/Screens/Multi/Components/DrawableRoom.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 8e93fda68f..1851f4618e 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multi.Components { public const float SELECTION_BORDER_WIDTH = 4; private const float corner_radius = 5; - private const float transition_duration = 100; + private const float transition_duration = 60; private const float content_padding = 10; private const float height = 100; private const float side_strip_width = 5; @@ -254,7 +254,7 @@ namespace osu.Game.Screens.Multi.Components status.Text = s.Message; foreach (Drawable d in new Drawable[] { selectionBox, sideStrip, status }) - d.FadeColour(s.GetAppropriateColour(colours), 100); + d.FadeColour(s.GetAppropriateColour(colours), transition_duration); }; beatmapBind.ValueChanged += b =>