1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Rename usages which rely on online backing

This commit is contained in:
Dean Herbert 2021-10-21 16:53:50 +09:00
parent 0706ad70fb
commit 32d01f022f
10 changed files with 32 additions and 32 deletions

View File

@ -23,21 +23,21 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestLocal([Values] BeatmapSetCoverType coverType)
{
AddStep("setup cover", () => Child = new UpdateableBeatmapSetCover(coverType)
AddStep("setup cover", () => Child = new UpdateableOnlineBeatmapSetCover(coverType)
{
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
RelativeSizeAxes = Axes.Both,
Masking = true,
});
AddUntilStep("wait for load", () => this.ChildrenOfType<BeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
AddUntilStep("wait for load", () => this.ChildrenOfType<OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
}
[Test]
public void TestUnloadAndReload()
{
OsuScrollContainer scroll = null;
List<UpdateableBeatmapSetCover> covers = new List<UpdateableBeatmapSetCover>();
List<UpdateableOnlineBeatmapSetCover> covers = new List<UpdateableOnlineBeatmapSetCover>();
AddStep("setup covers", () =>
{
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
var coverType = coverTypes[i % coverTypes.Count];
var cover = new UpdateableBeatmapSetCover(coverType)
var cover = new UpdateableOnlineBeatmapSetCover(coverType)
{
BeatmapSet = setInfo,
Height = 100,
@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.UserInterface
}
});
var loadedCovers = covers.Where(c => c.ChildrenOfType<BeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
var loadedCovers = covers.Where(c => c.ChildrenOfType<OnlineBeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false);
AddUntilStep("some loaded", () => loadedCovers.Any());
AddStep("scroll to end", () => scroll.ScrollToEnd());
@ -95,9 +95,9 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestSetNullBeatmapWhileLoading()
{
TestUpdateableBeatmapSetCover updateableCover = null;
TestUpdateableOnlineBeatmapSetCover updateableCover = null;
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableBeatmapSetCover
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover
{
BeatmapSet = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet,
RelativeSizeAxes = Axes.Both,
@ -112,10 +112,10 @@ namespace osu.Game.Tests.Visual.UserInterface
[Test]
public void TestCoverChangeOnNewBeatmap()
{
TestUpdateableBeatmapSetCover updateableCover = null;
BeatmapSetCover initialCover = null;
TestUpdateableOnlineBeatmapSetCover updateableCover = null;
OnlineBeatmapSetCover initialCover = null;
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableBeatmapSetCover(0)
AddStep("setup cover", () => Child = updateableCover = new TestUpdateableOnlineBeatmapSetCover(0)
{
BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1189904/covers/cover.jpg"),
RelativeSizeAxes = Axes.Both,
@ -123,13 +123,13 @@ namespace osu.Game.Tests.Visual.UserInterface
Alpha = 0.4f
});
AddUntilStep("cover loaded", () => updateableCover.ChildrenOfType<BeatmapSetCover>().Any());
AddStep("store initial cover", () => initialCover = updateableCover.ChildrenOfType<BeatmapSetCover>().Single());
AddUntilStep("cover loaded", () => updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Any());
AddStep("store initial cover", () => initialCover = updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Single());
AddUntilStep("wait for fade complete", () => initialCover.Alpha == 1);
AddStep("switch beatmap",
() => updateableCover.BeatmapSet = createBeatmapWithCover("https://assets.ppy.sh/beatmaps/1079428/covers/cover.jpg"));
AddUntilStep("new cover loaded", () => updateableCover.ChildrenOfType<BeatmapSetCover>().Except(new[] { initialCover }).Any());
AddUntilStep("new cover loaded", () => updateableCover.ChildrenOfType<OnlineBeatmapSetCover>().Except(new[] { initialCover }).Any());
}
private static BeatmapSetInfo createBeatmapWithCover(string coverUrl) => new BeatmapSetInfo
@ -140,11 +140,11 @@ namespace osu.Game.Tests.Visual.UserInterface
}
};
private class TestUpdateableBeatmapSetCover : UpdateableBeatmapSetCover
private class TestUpdateableOnlineBeatmapSetCover : UpdateableOnlineBeatmapSetCover
{
private readonly int loadDelay;
public TestUpdateableBeatmapSetCover(int loadDelay = 10000)
public TestUpdateableOnlineBeatmapSetCover(int loadDelay = 10000)
{
this.loadDelay = loadDelay;
}
@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.UserInterface
if (model == null)
return null;
return new TestBeatmapSetCover(model, loadDelay)
return new TestOnlineBeatmapSetCover(model, loadDelay)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -164,11 +164,11 @@ namespace osu.Game.Tests.Visual.UserInterface
}
}
private class TestBeatmapSetCover : BeatmapSetCover
private class TestOnlineBeatmapSetCover : OnlineBeatmapSetCover
{
private readonly int loadDelay;
public TestBeatmapSetCover(IBeatmapSetOnlineInfo set, int loadDelay)
public TestOnlineBeatmapSetCover(IBeatmapSetOnlineInfo set, int loadDelay)
: base(set)
{
this.loadDelay = loadDelay;

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
},
new UpdateableBeatmapSetCover
new UpdateableOnlineBeatmapSetCover
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.5f),

View File

@ -9,12 +9,12 @@ using osu.Framework.Graphics.Textures;
namespace osu.Game.Beatmaps.Drawables
{
[LongRunningLoad]
public class BeatmapSetCover : Sprite
public class OnlineBeatmapSetCover : Sprite
{
private readonly IBeatmapSetOnlineInfo set;
private readonly BeatmapSetCoverType type;
public BeatmapSetCover(IBeatmapSetOnlineInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
public OnlineBeatmapSetCover(IBeatmapSetOnlineInfo set, BeatmapSetCoverType type = BeatmapSetCoverType.Cover)
{
if (set == null)
throw new ArgumentNullException(nameof(set));

View File

@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables
{
// prefer online cover where available.
if (model?.BeatmapSet?.OnlineInfo != null)
return new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
return new OnlineBeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
return model?.ID > 0
? new BeatmapBackgroundSprite(beatmaps.GetWorkingBeatmap(model))

View File

@ -9,7 +9,7 @@ using osu.Game.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
public class UpdateableBeatmapSetCover : ModelBackedDrawable<IBeatmapSetOnlineInfo>
public class UpdateableOnlineBeatmapSetCover : ModelBackedDrawable<IBeatmapSetOnlineInfo>
{
private readonly BeatmapSetCoverType coverType;
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Drawables
set => base.Masking = value;
}
public UpdateableBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
public UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
{
this.coverType = coverType;
@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps.Drawables
if (model == null)
return null;
return new BeatmapSetCover(model, coverType)
return new OnlineBeatmapSetCover(model, coverType)
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,

View File

@ -76,7 +76,7 @@ namespace osu.Game.Overlays.BeatmapListing
private readonly BeatmapSearchFilterRow<SearchExplicit> explicitContentFilter;
private readonly Box background;
private readonly UpdateableBeatmapSetCover beatmapCover;
private readonly UpdateableOnlineBeatmapSetCover beatmapCover;
public BeatmapListingSearchControl()
{
@ -196,7 +196,7 @@ namespace osu.Game.Overlays.BeatmapListing
}
}
private class TopSearchBeatmapSetCover : UpdateableBeatmapSetCover
private class TopSearchBeatmapSetCover : UpdateableOnlineBeatmapSetCover
{
protected override bool TransformImmediately => true;
}

View File

@ -160,7 +160,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
return icons;
}
protected Drawable CreateBackground() => new UpdateableBeatmapSetCover
protected Drawable CreateBackground() => new UpdateableOnlineBeatmapSetCover
{
RelativeSizeAxes = Axes.Both,
BeatmapSet = SetInfo,

View File

@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet
public readonly Details Details;
public readonly BeatmapPicker Picker;
private readonly UpdateableBeatmapSetCover cover;
private readonly UpdateableOnlineBeatmapSetCover cover;
private readonly Box coverGradient;
private readonly OsuSpriteText title, artist;
private readonly AuthorInfo author;
@ -68,7 +68,7 @@ namespace osu.Game.Overlays.BeatmapSet
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
cover = new UpdateableBeatmapSetCover
cover = new UpdateableOnlineBeatmapSetCover
{
RelativeSizeAxes = Axes.Both,
Masking = true,

View File

@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Dashboard.Home
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 6,
Child = new UpdateableBeatmapSetCover
Child = new UpdateableOnlineBeatmapSetCover
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
{
AddRangeInternal(new Drawable[]
{
new UpdateableBeatmapSetCover(BeatmapSetCoverType.List)
new UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType.List)
{
RelativeSizeAxes = Axes.Y,
Width = cover_width,