Skip to content
Merged

aa #120

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions osu.Game.Tests/Visual/RankedPlay/TestSceneDiscardScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!;

Expand All @@ -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();
}
});
}
}
}
23 changes: 21 additions & 2 deletions osu.Game.Tests/Visual/RankedPlay/TestSceneOpponentPickScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!;

Expand All @@ -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();
}
});
}
}
}
23 changes: 21 additions & 2 deletions osu.Game.Tests/Visual/RankedPlay/TestScenePickScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!;

Expand All @@ -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();
}
});
}
}
}
9 changes: 2 additions & 7 deletions osu.Game/Localisation/MaintenanceSettingsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,9 @@ public static class MaintenanceSettingsStrings
public static LocalisableString SelectNewLocation => new TranslatableString(getKey(@"select_new_location"), @"Please select a new location");

/// <summary>
/// "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."
/// </summary>
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?");

/// <summary>
/// "To complete this operation, osu! will close. Please open it again to use the new data location."
/// </summary>
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.");

/// <summary>
/// "Delete ALL beatmaps"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
() => { }));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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()
Expand All @@ -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);

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
}
}
Loading