mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Fix APIBeatmapSet.Beatmaps
being IEnumerable
, causing stupid issues
This commit is contained in:
parent
baabe99f78
commit
8f459e6ce8
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = beatmaps,
|
||||
Beatmaps = beatmaps.ToArray(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
RulesetID = difficulty.rulesetId,
|
||||
StarRating = difficulty.stars
|
||||
}).ToList()
|
||||
}).ToArray()
|
||||
};
|
||||
|
||||
[Test]
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -37,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToList()
|
||||
Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToArray()
|
||||
};
|
||||
});
|
||||
|
||||
@ -55,7 +54,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -71,10 +70,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestEmptyBeatmapSet()
|
||||
{
|
||||
AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>()
|
||||
});
|
||||
AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet());
|
||||
|
||||
AddAssert("no ruleset selected", () => selector.SelectedTab == null);
|
||||
AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
|
||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
var set = getBeatmapSet();
|
||||
|
||||
set.Beatmaps = beatmaps;
|
||||
set.Beatmaps = beatmaps.ToArray();
|
||||
|
||||
overlay.ShowBeatmapSet(set);
|
||||
});
|
||||
@ -211,7 +211,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
}
|
||||
|
||||
set.Beatmaps = beatmaps;
|
||||
set.Beatmaps = beatmaps.ToArray();
|
||||
|
||||
return set;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -46,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
static APIBeatmapSet createSet() => new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -129,7 +129,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = beatmaps,
|
||||
Beatmaps = beatmaps.ToArray(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public string Tags { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty(@"beatmaps")]
|
||||
public IEnumerable<APIBeatmap> Beatmaps { get; set; } = Array.Empty<APIBeatmap>();
|
||||
public APIBeatmap[] Beatmaps { get; set; } = Array.Empty<APIBeatmap>();
|
||||
|
||||
public virtual BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
||||
{
|
||||
var icons = new List<DifficultyIcon>();
|
||||
|
||||
if (SetInfo.Beatmaps.Count() > maximum_difficulty_icons)
|
||||
if (SetInfo.Beatmaps.Length > maximum_difficulty_icons)
|
||||
{
|
||||
foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct())
|
||||
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.Where(b => b.RulesetID == ruleset.OnlineID).ToList(), ruleset, this is ListBeatmapPanel ? Color4.White : colours.Gray5));
|
||||
|
@ -280,7 +280,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var apiSet = new APIBeatmapSet
|
||||
{
|
||||
OnlineID = set.OnlineID,
|
||||
Beatmaps = set.Beatmaps.Select(b => new APIBeatmap { OnlineID = b.OnlineID })
|
||||
Beatmaps = set.Beatmaps.Select(b => new APIBeatmap { OnlineID = b.OnlineID }).ToArray(),
|
||||
};
|
||||
|
||||
return Task.FromResult(apiSet);
|
||||
|
Loading…
Reference in New Issue
Block a user