mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Rewrite test scene and add more tests
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.IO.Network;
|
||||
using osu.Game.Extensions;
|
||||
@ -14,39 +15,45 @@ namespace osu.Game.Online.Multiplayer
|
||||
/// </summary>
|
||||
public class IndexPlaylistScoresRequest : APIRequest<IndexedMultiplayerScores>
|
||||
{
|
||||
private readonly int roomId;
|
||||
private readonly int playlistItemId;
|
||||
private readonly Cursor cursor;
|
||||
private readonly IndexScoresParams indexParams;
|
||||
public readonly int RoomId;
|
||||
public readonly int PlaylistItemId;
|
||||
|
||||
[CanBeNull]
|
||||
public readonly Cursor Cursor;
|
||||
|
||||
[CanBeNull]
|
||||
public readonly IndexScoresParams IndexParams;
|
||||
|
||||
public IndexPlaylistScoresRequest(int roomId, int playlistItemId)
|
||||
{
|
||||
this.roomId = roomId;
|
||||
this.playlistItemId = playlistItemId;
|
||||
RoomId = roomId;
|
||||
PlaylistItemId = playlistItemId;
|
||||
}
|
||||
|
||||
public IndexPlaylistScoresRequest(int roomId, int playlistItemId, [NotNull] Cursor cursor, [NotNull] IndexScoresParams indexParams)
|
||||
: this(roomId, playlistItemId)
|
||||
{
|
||||
this.cursor = cursor;
|
||||
this.indexParams = indexParams;
|
||||
Cursor = cursor;
|
||||
IndexParams = indexParams;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
if (cursor != null)
|
||||
if (Cursor != null)
|
||||
{
|
||||
req.AddCursor(cursor);
|
||||
Debug.Assert(IndexParams != null);
|
||||
|
||||
foreach (var (key, value) in indexParams.Properties)
|
||||
req.AddCursor(Cursor);
|
||||
|
||||
foreach (var (key, value) in IndexParams.Properties)
|
||||
req.AddParameter(key, value.ToString());
|
||||
}
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string Target => $@"rooms/{roomId}/playlist/{playlistItemId}/scores";
|
||||
protected override string Target => $@"rooms/{RoomId}/playlist/{PlaylistItemId}/scores";
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,10 @@ namespace osu.Game.Screens.Multi.Ranking
|
||||
private readonly int roomId;
|
||||
private readonly PlaylistItem playlistItem;
|
||||
|
||||
private LoadingSpinner leftLoadingLayer;
|
||||
private LoadingSpinner centreLoadingLayer;
|
||||
private LoadingSpinner rightLoadingLayer;
|
||||
protected LoadingSpinner LeftSpinner { get; private set; }
|
||||
protected LoadingSpinner CentreSpinner { get; private set; }
|
||||
protected LoadingSpinner RightSpinner { get; private set; }
|
||||
|
||||
private MultiplayerScores higherScores;
|
||||
private MultiplayerScores lowerScores;
|
||||
|
||||
@ -47,18 +48,18 @@ namespace osu.Game.Screens.Multi.Ranking
|
||||
Padding = new MarginPadding { Bottom = TwoLayerButton.SIZE_EXTENDED.Y },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leftLoadingLayer = new PanelListLoadingSpinner(ScorePanelList)
|
||||
LeftSpinner = new PanelListLoadingSpinner(ScorePanelList)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
centreLoadingLayer = new PanelListLoadingSpinner(ScorePanelList)
|
||||
CentreSpinner = new PanelListLoadingSpinner(ScorePanelList)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
State = { Value = Score == null ? Visibility.Visible : Visibility.Hidden },
|
||||
},
|
||||
rightLoadingLayer = new PanelListLoadingSpinner(ScorePanelList)
|
||||
RightSpinner = new PanelListLoadingSpinner(ScorePanelList)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.Centre,
|
||||
@ -110,9 +111,9 @@ namespace osu.Game.Screens.Multi.Ranking
|
||||
return null;
|
||||
|
||||
if (pivot == higherScores)
|
||||
leftLoadingLayer.Show();
|
||||
LeftSpinner.Show();
|
||||
else
|
||||
rightLoadingLayer.Show();
|
||||
RightSpinner.Show();
|
||||
|
||||
return createIndexRequest(scoresCallback, pivot);
|
||||
}
|
||||
@ -174,12 +175,12 @@ namespace osu.Game.Screens.Multi.Ranking
|
||||
|
||||
private void hideLoadingSpinners([CanBeNull] MultiplayerScores pivot = null)
|
||||
{
|
||||
centreLoadingLayer.Hide();
|
||||
CentreSpinner.Hide();
|
||||
|
||||
if (pivot == lowerScores)
|
||||
rightLoadingLayer.Hide();
|
||||
RightSpinner.Hide();
|
||||
else if (pivot == higherScores)
|
||||
leftLoadingLayer.Hide();
|
||||
LeftSpinner.Hide();
|
||||
}
|
||||
|
||||
private class PanelListLoadingSpinner : LoadingSpinner
|
||||
|
Reference in New Issue
Block a user