diff --git a/osu.Game.Tests/Visual/RankedPlay/TestSceneDiscardScreen.cs b/osu.Game.Tests/Visual/RankedPlay/TestSceneDiscardScreen.cs index f3e39796ac19..e01e26524fa0 100644 --- a/osu.Game.Tests/Visual/RankedPlay/TestSceneDiscardScreen.cs +++ b/osu.Game.Tests/Visual/RankedPlay/TestSceneDiscardScreen.cs @@ -2,15 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Extensions; +using osu.Game.Online.API; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay; -using osu.Game.Tests.Visual.Multiplayer; namespace osu.Game.Tests.Visual.RankedPlay { - public partial class TestSceneDiscardScreen : MultiplayerTestScene + public partial class TestSceneDiscardScreen : RankedPlayTestScene { private RankedPlayScreen screen = null!; @@ -26,7 +26,26 @@ public override void SetUpSteps() AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!))); AddUntilStep("screen loaded", () => screen.IsLoaded); + var requestHandler = new BeatmapRequestHandler(); + + AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest); + AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely()); + + AddWaitStep("wait some", 5); + + AddStep("reveal cards", () => + { + for (int i = 0; i < 5; i++) + { + int i2 = i; + MultiplayerClient.RankedPlayRevealCard(hand => hand[i2], new MultiplayerPlaylistItem + { + ID = i2, + BeatmapID = requestHandler.Beatmaps[i2].OnlineID + }).WaitSafely(); + } + }); } } } diff --git a/osu.Game.Tests/Visual/RankedPlay/TestSceneOpponentPickScreen.cs b/osu.Game.Tests/Visual/RankedPlay/TestSceneOpponentPickScreen.cs index 838a49d2558f..ddf111e11033 100644 --- a/osu.Game.Tests/Visual/RankedPlay/TestSceneOpponentPickScreen.cs +++ b/osu.Game.Tests/Visual/RankedPlay/TestSceneOpponentPickScreen.cs @@ -2,15 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Extensions; +using osu.Game.Online.API; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay; -using osu.Game.Tests.Visual.Multiplayer; namespace osu.Game.Tests.Visual.RankedPlay { - public partial class TestSceneOpponentPickScreen : MultiplayerTestScene + public partial class TestSceneOpponentPickScreen : RankedPlayTestScene { private RankedPlayScreen screen = null!; @@ -26,7 +26,26 @@ public override void SetUpSteps() AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!))); AddUntilStep("screen loaded", () => screen.IsLoaded); + var requestHandler = new BeatmapRequestHandler(); + + AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest); + AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = 2).WaitSafely()); + + AddWaitStep("wait some", 5); + + AddStep("reveal cards", () => + { + for (int i = 0; i < 5; i++) + { + int i2 = i; + MultiplayerClient.RankedPlayRevealCard(hand => hand[i2], new MultiplayerPlaylistItem + { + ID = i2, + BeatmapID = requestHandler.Beatmaps[i2].OnlineID + }).WaitSafely(); + } + }); } } } diff --git a/osu.Game.Tests/Visual/RankedPlay/TestScenePickScreen.cs b/osu.Game.Tests/Visual/RankedPlay/TestScenePickScreen.cs index 042a56adf8b5..104872d20ff8 100644 --- a/osu.Game.Tests/Visual/RankedPlay/TestScenePickScreen.cs +++ b/osu.Game.Tests/Visual/RankedPlay/TestScenePickScreen.cs @@ -2,15 +2,15 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Extensions; +using osu.Game.Online.API; using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay; -using osu.Game.Tests.Visual.Multiplayer; namespace osu.Game.Tests.Visual.RankedPlay { - public partial class TestScenePickScreen : MultiplayerTestScene + public partial class TestScenePickScreen : RankedPlayTestScene { private RankedPlayScreen screen = null!; @@ -26,7 +26,26 @@ public override void SetUpSteps() AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!))); AddUntilStep("screen loaded", () => screen.IsLoaded); + var requestHandler = new BeatmapRequestHandler(); + + AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest); + AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = API.LocalUser.Value.OnlineID).WaitSafely()); + + AddWaitStep("wait some", 5); + + AddStep("reveal cards", () => + { + for (int i = 0; i < 5; i++) + { + int i2 = i; + MultiplayerClient.RankedPlayRevealCard(hand => hand[i2], new MultiplayerPlaylistItem + { + ID = i2, + BeatmapID = requestHandler.Beatmaps[i2].OnlineID + }).WaitSafely(); + } + }); } } } diff --git a/osu.Game/Localisation/MaintenanceSettingsStrings.cs b/osu.Game/Localisation/MaintenanceSettingsStrings.cs index 6d5e0d5e0e52..daf27c6ea2a2 100644 --- a/osu.Game/Localisation/MaintenanceSettingsStrings.cs +++ b/osu.Game/Localisation/MaintenanceSettingsStrings.cs @@ -40,14 +40,9 @@ public static class MaintenanceSettingsStrings public static LocalisableString SelectNewLocation => new TranslatableString(getKey(@"select_new_location"), @"Please select a new location"); /// - /// "The target directory already seems to have an osu! install. Use that data instead?" + /// "The target directory already seems to have an osu! install. Use that data instead? osu! will restart." /// - public static LocalisableString TargetDirectoryAlreadyInstalledOsu => new TranslatableString(getKey(@"target_directory_already_installed_osu"), @"The target directory already seems to have an osu! install. Use that data instead?"); - - /// - /// "To complete this operation, osu! will close. Please open it again to use the new data location." - /// - public static LocalisableString RestartAndReOpenRequiredForCompletion => new TranslatableString(getKey(@"restart_and_re_open_required_for_completion"), @"To complete this operation, osu! will close. Please open it again to use the new data location."); + public static LocalisableString TargetDirectoryAlreadyInstalledOsu => new TranslatableString(getKey(@"target_directory_already_installed_osu"), @"The target directory already seems to have an osu! install. Use that data instead? osu! will restart."); /// /// "Delete ALL beatmaps" diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs index 309e2a14012f..3a3156f1ebff 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/MigrationSelectScreen.cs @@ -54,11 +54,9 @@ protected override void OnSelection(DirectoryInfo directory) { dialogOverlay.Push(new ConfirmDialog(MaintenanceSettingsStrings.TargetDirectoryAlreadyInstalledOsu, () => { - dialogOverlay.Push(new ConfirmDialog(MaintenanceSettingsStrings.RestartAndReOpenRequiredForCompletion, () => - { - (storage as OsuStorage)?.ChangeDataPath(target.FullName); - game.Exit(); - }, () => { })); + (storage as OsuStorage)?.ChangeDataPath(target.FullName); + game.RestartAppWhenExited(); + game.Exit(); }, () => { })); diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs index 8ece23e4d33b..dfb24827b1ef 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs @@ -97,10 +97,11 @@ public RankedPlayCard(RankedPlayCardWithPlaylistItem item) Origin = Anchor.Centre, Children = [ + new RankedPlayCardBackSide(), cardContent = new Container { RelativeSizeAxes = Axes.Both, - Child = new RankedPlayCardBackSide() + Child = Empty(), }, selectionOutline = new SelectionOutline { @@ -123,9 +124,7 @@ protected override void LoadComplete() { base.LoadComplete(); - playlistItem.BindValueChanged(e => onPlaylistItemChanged(e.NewValue)); - if (playlistItem.Value != null) - loadCardContent(playlistItem.Value, false); + playlistItem.BindValueChanged(e => onPlaylistItemChanged(e.NewValue), true); } protected override void UpdateAfterChildren() @@ -147,14 +146,14 @@ private void onPlaylistItemChanged(MultiplayerPlaylistItem? playlistItem) { if (playlistItem == null) { - SetContent(new RankedPlayCardBackSide(), true); + SetContent(null); return; } - loadCardContent(playlistItem, true); + loadCardContentAsync(playlistItem); } - private void loadCardContent(MultiplayerPlaylistItem playlistItem, bool flip) => Task.Run(async () => + private void loadCardContentAsync(MultiplayerPlaylistItem playlistItem) => Task.Run(async () => { var beatmap = await beatmapLookupCache.GetBeatmapAsync(playlistItem.BeatmapID).ConfigureAwait(false); @@ -168,22 +167,22 @@ private void loadCardContent(MultiplayerPlaylistItem playlistItem, bool flip) => Schedule(() => { - SetContent(new RankedPlayCardContent(beatmap), flip); + SetContent(new RankedPlayCardContent(beatmap)); songPreviewContainer.LoadPreview(beatmap); }); }); - public void SetContent(Drawable newContent, bool flip) + private bool hasContent; + + public void SetContent(Drawable? newContent) { - if (!flip) - { - cardContent.Child = newContent; + if (newContent == null && !hasContent) return; - } + hasContent = newContent != null; content.ScaleTo(new Vector2(0, 1), 100, Easing.In) .Then() - .Schedule(() => cardContent.Child = newContent) + .Schedule(() => cardContent.Child = newContent ?? Empty()) .ScaleTo(new Vector2(1), 300, Easing.OutElasticQuarter); SamplePlaybackHelper.PlayWithRandomPitch(cardFlipSample); diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs index ca8bc0b26239..876f1cbd56ba 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerReadyButton.cs @@ -8,7 +8,6 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions.ObjectExtensions; -using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Online.Multiplayer; @@ -227,21 +226,5 @@ protected override void Dispose(bool isDisposing) if (multiplayerClient.IsNotNull()) multiplayerClient.RoomUpdated -= onRoomUpdated; } - - public override LocalisableString TooltipText - { - get - { - if (room?.ActiveCountdowns.Any(c => c is MatchStartCountdown) == true - && multiplayerClient.IsHost - && multiplayerClient.LocalUser?.State == MultiplayerUserState.Ready - && !room.Settings.AutoStartEnabled) - { - return "Cancel countdown"; - } - - return base.TooltipText; - } - } } }