mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 09:23:06 +08:00
Remove IBeatmapSetOnlineInfo
implementation from BeatmapSetInfo
to avoid null cases
This commit is contained in:
parent
f268363924
commit
7245baba69
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
|
||||
{
|
||||
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
||||
OnlineInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet.OnlineInfo,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
});
|
||||
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
var cover = new UpdateableOnlineBeatmapSetCover(coverType)
|
||||
{
|
||||
BeatmapSet = setInfo,
|
||||
OnlineInfo = setInfo.OnlineInfo,
|
||||
Height = 100,
|
||||
Masking = true,
|
||||
};
|
||||
@ -99,12 +99,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover
|
||||
{
|
||||
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
|
||||
OnlineInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet.OnlineInfo,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
});
|
||||
|
||||
AddStep("change model", () => updateableCover.BeatmapSet = null);
|
||||
AddStep("change model", () => updateableCover.OnlineInfo = null);
|
||||
AddWaitStep("wait some", 5);
|
||||
AddAssert("no cover added", () => !updateableCover.ChildrenOfType<DelayedLoadUnloadWrapper>().Any());
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover(0)
|
||||
{
|
||||
BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1189904/covers/cover.jpg"),
|
||||
OnlineInfo = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1189904/covers/cover.jpg").OnlineInfo,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Alpha = 0.4f
|
||||
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddUntilStep("wait for fade complete", () => initialCover.Alpha == 1);
|
||||
|
||||
AddStep("switch beatmap",
|
||||
() => updateableCover.BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1079428/covers/cover.jpg"));
|
||||
() => updateableCover.OnlineInfo = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1079428/covers/cover.jpg").OnlineInfo);
|
||||
AddUntilStep("new cover loaded", () => updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Except(new[] { initialCover }).Any());
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.5f),
|
||||
BeatmapSet = BeatmapInfo.BeatmapSet as IBeatmapSetOnlineInfo,
|
||||
OnlineInfo = BeatmapInfo.BeatmapSet as IBeatmapSetOnlineInfo,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>, IBeatmapSetInfo, IBeatmapSetOnlineInfo
|
||||
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>, IBeatmapSetInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
|
@ -57,7 +57,12 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
return new OnlineBeatmapSetCover(online, beatmapSetCoverType);
|
||||
|
||||
if (model is BeatmapInfo localModel)
|
||||
{
|
||||
if (localModel.BeatmapSet?.OnlineInfo != null)
|
||||
return new OnlineBeatmapSetCover(localModel.BeatmapSet.OnlineInfo, beatmapSetCoverType);
|
||||
|
||||
return new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(localModel));
|
||||
}
|
||||
|
||||
return new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
private readonly BeatmapSetCoverType coverType;
|
||||
|
||||
public IBeatmapSetOnlineInfo BeatmapSet
|
||||
public IBeatmapSetOnlineInfo OnlineInfo
|
||||
{
|
||||
get => Model;
|
||||
set => Model = value;
|
||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
return;
|
||||
}
|
||||
|
||||
beatmapCover.BeatmapSet = value;
|
||||
beatmapCover.OnlineInfo = value.OnlineInfo;
|
||||
beatmapCover.FadeTo(0.1f, 200, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
||||
protected Drawable CreateBackground() => new UpdateableOnlineBeatmapSetCover
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BeatmapSet = SetInfo,
|
||||
OnlineInfo = SetInfo.OnlineInfo,
|
||||
};
|
||||
|
||||
public class Statistic : FillFlowContainer
|
||||
|
@ -227,7 +227,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
{
|
||||
Picker.BeatmapSet = rulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue;
|
||||
cover.BeatmapSet = setInfo.NewValue;
|
||||
cover.OnlineInfo = setInfo.NewValue?.OnlineInfo;
|
||||
|
||||
if (setInfo.NewValue == null)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Overlays.Dashboard.Home
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BeatmapSet = SetInfo
|
||||
OnlineInfo = SetInfo.OnlineInfo
|
||||
}
|
||||
},
|
||||
new Container
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = cover_width,
|
||||
BeatmapSet = mostPlayed.BeatmapSet,
|
||||
OnlineInfo = mostPlayed.BeatmapSet,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user